id
int32
0
27.3k
func
stringlengths
26
142k
target
bool
2 classes
project
stringclasses
2 values
commit_id
stringlengths
40
40
func_clean
stringlengths
26
131k
vul_lines
dict
normalized_func
stringlengths
24
132k
lines
listlengths
1
2.8k
label
listlengths
1
2.8k
line_no
listlengths
1
2.8k
12,219
static int init_file(AVFormatContext *s, OutputStream *os, int64_t start_ts) { int ret, i; ret = avio_open2(&os->out, os->temp_filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL); if (ret < 0) return ret; avio_wb32(os->out, 0); avio_wl32(os->out, MKTAG('m','d','a','t')); for (i = 0; i < os->nb_extra_packets; i++) { AV_WB24(os->extra_packets[i] + 4, start_ts); os->extra_packets[i][7] = (start_ts >> 24) & 0x7f; avio_write(os->out, os->extra_packets[i], os->extra_packet_sizes[i]); } return 0; }
false
FFmpeg
9f61abc8111c7c43f49ca012e957a108b9cc7610
static int init_file(AVFormatContext *s, OutputStream *os, int64_t start_ts) { int ret, i; ret = avio_open2(&os->out, os->temp_filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL); if (ret < 0) return ret; avio_wb32(os->out, 0); avio_wl32(os->out, MKTAG('m','d','a','t')); for (i = 0; i < os->nb_extra_packets; i++) { AV_WB24(os->extra_packets[i] + 4, start_ts); os->extra_packets[i][7] = (start_ts >> 24) & 0x7f; avio_write(os->out, os->extra_packets[i], os->extra_packet_sizes[i]); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, OutputStream *VAR_1, int64_t VAR_2) { int VAR_3, VAR_4; VAR_3 = avio_open2(&VAR_1->out, VAR_1->temp_filename, AVIO_FLAG_WRITE, &VAR_0->interrupt_callback, NULL); if (VAR_3 < 0) return VAR_3; avio_wb32(VAR_1->out, 0); avio_wl32(VAR_1->out, MKTAG('m','d','a','t')); for (VAR_4 = 0; VAR_4 < VAR_1->nb_extra_packets; VAR_4++) { AV_WB24(VAR_1->extra_packets[VAR_4] + 4, VAR_2); VAR_1->extra_packets[VAR_4][7] = (VAR_2 >> 24) & 0x7f; avio_write(VAR_1->out, VAR_1->extra_packets[VAR_4], VAR_1->extra_packet_sizes[VAR_4]); } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, OutputStream *VAR_1, int64_t VAR_2)\n{", "int VAR_3, VAR_4;", "VAR_3 = avio_open2(&VAR_1->out, VAR_1->temp_filename, AVIO_FLAG_WRITE,\n&VAR_0->interrupt_callback, NULL);", "if (VAR_3 < 0)\nreturn VAR_3;", "avio_wb32(VAR_1->out, 0);", "avio_wl32(VAR_1->out, MKTAG('m','d','a','t'));", "for (VAR_4 = 0; VAR_4 < VAR_1->nb_extra_packets; VAR_4++) {", "AV_WB24(VAR_1->extra_packets[VAR_4] + 4, VAR_2);", "VAR_1->extra_packets[VAR_4][7] = (VAR_2 >> 24) & 0x7f;", "avio_write(VAR_1->out, VAR_1->extra_packets[VAR_4], VAR_1->extra_packet_sizes[VAR_4]);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
12,220
static inline void log_input_change(void *ctx, AVFilterLink *link, AVFilterBufferRef *ref) { char old_layout_str[16], new_layout_str[16]; av_get_channel_layout_string(old_layout_str, sizeof(old_layout_str), -1, link->channel_layout); av_get_channel_layout_string(new_layout_str, sizeof(new_layout_str), -1, ref->audio->channel_layout); av_log(ctx, AV_LOG_INFO, "Audio input format changed: " "%s:%s:%"PRId64" -> %s:%s:%u, normalizing\n", av_get_sample_fmt_name(link->format), old_layout_str, link->sample_rate, av_get_sample_fmt_name(ref->format), new_layout_str, ref->audio->sample_rate); }
false
FFmpeg
4381bddc9f93da34a44e683bdc4c05c6f061244e
static inline void log_input_change(void *ctx, AVFilterLink *link, AVFilterBufferRef *ref) { char old_layout_str[16], new_layout_str[16]; av_get_channel_layout_string(old_layout_str, sizeof(old_layout_str), -1, link->channel_layout); av_get_channel_layout_string(new_layout_str, sizeof(new_layout_str), -1, ref->audio->channel_layout); av_log(ctx, AV_LOG_INFO, "Audio input format changed: " "%s:%s:%"PRId64" -> %s:%s:%u, normalizing\n", av_get_sample_fmt_name(link->format), old_layout_str, link->sample_rate, av_get_sample_fmt_name(ref->format), new_layout_str, ref->audio->sample_rate); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(void *VAR_0, AVFilterLink *VAR_1, AVFilterBufferRef *VAR_2) { char VAR_3[16], VAR_4[16]; av_get_channel_layout_string(VAR_3, sizeof(VAR_3), -1, VAR_1->channel_layout); av_get_channel_layout_string(VAR_4, sizeof(VAR_4), -1, VAR_2->audio->channel_layout); av_log(VAR_0, AV_LOG_INFO, "Audio input format changed: " "%s:%s:%"PRId64" -> %s:%s:%u, normalizing\n", av_get_sample_fmt_name(VAR_1->format), VAR_3, VAR_1->sample_rate, av_get_sample_fmt_name(VAR_2->format), VAR_4, VAR_2->audio->sample_rate); }
[ "static inline void FUNC_0(void *VAR_0, AVFilterLink *VAR_1, AVFilterBufferRef *VAR_2)\n{", "char VAR_3[16], VAR_4[16];", "av_get_channel_layout_string(VAR_3, sizeof(VAR_3),\n-1, VAR_1->channel_layout);", "av_get_channel_layout_string(VAR_4, sizeof(VAR_4),\n-1, VAR_2->audio->channel_layout);", "av_log(VAR_0, AV_LOG_INFO,\n\"Audio input format changed: \"\n\"%s:%s:%\"PRId64\" -> %s:%s:%u, normalizing\\n\",\nav_get_sample_fmt_name(VAR_1->format),\nVAR_3, VAR_1->sample_rate,\nav_get_sample_fmt_name(VAR_2->format),\nVAR_4, VAR_2->audio->sample_rate);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ], [ 15, 17, 19, 21, 23, 25, 27 ], [ 29 ] ]
12,221
static int decode_mime_header(AMRWBContext *ctx, const uint8_t *buf) { /* Decode frame header (1st octet) */ ctx->fr_cur_mode = buf[0] >> 3 & 0x0F; ctx->fr_quality = (buf[0] & 0x4) != 0x4; return 1; }
true
FFmpeg
ca00a7e809a4b9c9fb146403d278964b88d16b85
static int decode_mime_header(AMRWBContext *ctx, const uint8_t *buf) { ctx->fr_cur_mode = buf[0] >> 3 & 0x0F; ctx->fr_quality = (buf[0] & 0x4) != 0x4; return 1; }
{ "code": [ " ctx->fr_quality = (buf[0] & 0x4) != 0x4;" ], "line_no": [ 9 ] }
static int FUNC_0(AMRWBContext *VAR_0, const uint8_t *VAR_1) { VAR_0->fr_cur_mode = VAR_1[0] >> 3 & 0x0F; VAR_0->fr_quality = (VAR_1[0] & 0x4) != 0x4; return 1; }
[ "static int FUNC_0(AMRWBContext *VAR_0, const uint8_t *VAR_1)\n{", "VAR_0->fr_cur_mode = VAR_1[0] >> 3 & 0x0F;", "VAR_0->fr_quality = (VAR_1[0] & 0x4) != 0x4;", "return 1;", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ] ]
12,222
static void init_entropy_decoder(APEContext *ctx) { /* Read the CRC */ ctx->CRC = bytestream_get_be32(&ctx->ptr); /* Read the frame flags if they exist */ ctx->frameflags = 0; if ((ctx->fileversion > 3820) && (ctx->CRC & 0x80000000)) { ctx->CRC &= ~0x80000000; ctx->frameflags = bytestream_get_be32(&ctx->ptr); } /* Keep a count of the blocks decoded in this frame */ ctx->blocksdecoded = 0; /* Initialize the rice structs */ ctx->riceX.k = 10; ctx->riceX.ksum = (1 << ctx->riceX.k) * 16; ctx->riceY.k = 10; ctx->riceY.ksum = (1 << ctx->riceY.k) * 16; /* The first 8 bits of input are ignored. */ ctx->ptr++; range_start_decoding(ctx); }
true
FFmpeg
a4c32c9a63142b602820800742f2d543b58cd278
static void init_entropy_decoder(APEContext *ctx) { ctx->CRC = bytestream_get_be32(&ctx->ptr); ctx->frameflags = 0; if ((ctx->fileversion > 3820) && (ctx->CRC & 0x80000000)) { ctx->CRC &= ~0x80000000; ctx->frameflags = bytestream_get_be32(&ctx->ptr); } ctx->blocksdecoded = 0; ctx->riceX.k = 10; ctx->riceX.ksum = (1 << ctx->riceX.k) * 16; ctx->riceY.k = 10; ctx->riceY.ksum = (1 << ctx->riceY.k) * 16; ctx->ptr++; range_start_decoding(ctx); }
{ "code": [ "static void init_entropy_decoder(APEContext *ctx)" ], "line_no": [ 1 ] }
static void FUNC_0(APEContext *VAR_0) { VAR_0->CRC = bytestream_get_be32(&VAR_0->ptr); VAR_0->frameflags = 0; if ((VAR_0->fileversion > 3820) && (VAR_0->CRC & 0x80000000)) { VAR_0->CRC &= ~0x80000000; VAR_0->frameflags = bytestream_get_be32(&VAR_0->ptr); } VAR_0->blocksdecoded = 0; VAR_0->riceX.k = 10; VAR_0->riceX.ksum = (1 << VAR_0->riceX.k) * 16; VAR_0->riceY.k = 10; VAR_0->riceY.ksum = (1 << VAR_0->riceY.k) * 16; VAR_0->ptr++; range_start_decoding(VAR_0); }
[ "static void FUNC_0(APEContext *VAR_0)\n{", "VAR_0->CRC = bytestream_get_be32(&VAR_0->ptr);", "VAR_0->frameflags = 0;", "if ((VAR_0->fileversion > 3820) && (VAR_0->CRC & 0x80000000)) {", "VAR_0->CRC &= ~0x80000000;", "VAR_0->frameflags = bytestream_get_be32(&VAR_0->ptr);", "}", "VAR_0->blocksdecoded = 0;", "VAR_0->riceX.k = 10;", "VAR_0->riceX.ksum = (1 << VAR_0->riceX.k) * 16;", "VAR_0->riceY.k = 10;", "VAR_0->riceY.ksum = (1 << VAR_0->riceY.k) * 16;", "VAR_0->ptr++;", "range_start_decoding(VAR_0);", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 29 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 51 ], [ 53 ] ]
12,223
static gboolean qio_channel_yield_enter(QIOChannel *ioc, GIOCondition condition, gpointer opaque) { QIOChannelYieldData *data = opaque; qemu_coroutine_enter(data->co, NULL); return FALSE; }
true
qemu
0b8b8753e4d94901627b3e86431230f2319215c4
static gboolean qio_channel_yield_enter(QIOChannel *ioc, GIOCondition condition, gpointer opaque) { QIOChannelYieldData *data = opaque; qemu_coroutine_enter(data->co, NULL); return FALSE; }
{ "code": [ " qemu_coroutine_enter(data->co, NULL);", " qemu_coroutine_enter(data->co, NULL);" ], "line_no": [ 11, 11 ] }
static gboolean FUNC_0(QIOChannel *ioc, GIOCondition condition, gpointer opaque) { QIOChannelYieldData *data = opaque; qemu_coroutine_enter(data->co, NULL); return FALSE; }
[ "static gboolean FUNC_0(QIOChannel *ioc,\nGIOCondition condition,\ngpointer opaque)\n{", "QIOChannelYieldData *data = opaque;", "qemu_coroutine_enter(data->co, NULL);", "return FALSE;", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
12,224
void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp) { int i; if (s->portnr > NB_PORTS) { error_setg(errp, "Too many ports! Max. port number is %d.", NB_PORTS); usb_bus_new(&s->bus, sizeof(s->bus), s->companion_enable ? &ehci_bus_ops_companion : &ehci_bus_ops_standalone, dev); for (i = 0; i < s->portnr; i++) { usb_register_port(&s->bus, &s->ports[i], s, i, &ehci_port_ops, USB_SPEED_MASK_HIGH); s->ports[i].dev = 0; s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, s); s->async_bh = qemu_bh_new(ehci_work_bh, s); s->device = dev; s->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
true
qemu
2a7f2630684ee556a394a354d64159a4470c0151
void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp) { int i; if (s->portnr > NB_PORTS) { error_setg(errp, "Too many ports! Max. port number is %d.", NB_PORTS); usb_bus_new(&s->bus, sizeof(s->bus), s->companion_enable ? &ehci_bus_ops_companion : &ehci_bus_ops_standalone, dev); for (i = 0; i < s->portnr; i++) { usb_register_port(&s->bus, &s->ports[i], s, i, &ehci_port_ops, USB_SPEED_MASK_HIGH); s->ports[i].dev = 0; s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, s); s->async_bh = qemu_bh_new(ehci_work_bh, s); s->device = dev; s->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
{ "code": [], "line_no": [] }
void FUNC_0(EHCIState *VAR_0, DeviceState *VAR_1, Error **VAR_2) { int VAR_3; if (VAR_0->portnr > NB_PORTS) { error_setg(VAR_2, "Too many ports! Max. port number is %d.", NB_PORTS); usb_bus_new(&VAR_0->bus, sizeof(VAR_0->bus), VAR_0->companion_enable ? &ehci_bus_ops_companion : &ehci_bus_ops_standalone, VAR_1); for (VAR_3 = 0; VAR_3 < VAR_0->portnr; VAR_3++) { usb_register_port(&VAR_0->bus, &VAR_0->ports[VAR_3], VAR_0, VAR_3, &ehci_port_ops, USB_SPEED_MASK_HIGH); VAR_0->ports[VAR_3].VAR_1 = 0; VAR_0->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, VAR_0); VAR_0->async_bh = qemu_bh_new(ehci_work_bh, VAR_0); VAR_0->device = VAR_1; VAR_0->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, VAR_0);
[ "void FUNC_0(EHCIState *VAR_0, DeviceState *VAR_1, Error **VAR_2)\n{", "int VAR_3;", "if (VAR_0->portnr > NB_PORTS) {", "error_setg(VAR_2, \"Too many ports! Max. port number is %d.\",\nNB_PORTS);", "usb_bus_new(&VAR_0->bus, sizeof(VAR_0->bus), VAR_0->companion_enable ?\n&ehci_bus_ops_companion : &ehci_bus_ops_standalone, VAR_1);", "for (VAR_3 = 0; VAR_3 < VAR_0->portnr; VAR_3++) {", "usb_register_port(&VAR_0->bus, &VAR_0->ports[VAR_3], VAR_0, VAR_3, &ehci_port_ops,\nUSB_SPEED_MASK_HIGH);", "VAR_0->ports[VAR_3].VAR_1 = 0;", "VAR_0->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, VAR_0);", "VAR_0->async_bh = qemu_bh_new(ehci_work_bh, VAR_0);", "VAR_0->device = VAR_1;", "VAR_0->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, VAR_0);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 24, 26 ], [ 28 ], [ 30, 32 ], [ 34 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ] ]
12,226
void qemu_system_guest_panicked(void) { qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort); vm_stop(RUN_STATE_GUEST_PANICKED);
true
qemu
bac05aa9a77af1ca7972c8dc07560f4daa7c2dfc
void qemu_system_guest_panicked(void) { qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort); vm_stop(RUN_STATE_GUEST_PANICKED);
{ "code": [], "line_no": [] }
void FUNC_0(void) { qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort); vm_stop(RUN_STATE_GUEST_PANICKED);
[ "void FUNC_0(void)\n{", "qapi_event_send_guest_panicked(GUEST_PANIC_ACTION_PAUSE, &error_abort);", "vm_stop(RUN_STATE_GUEST_PANICKED);" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 8 ], [ 10 ] ]
12,227
static void get_sub_picture(CinepakEncContext *s, int x, int y, AVPicture *in, AVPicture *out) { out->data[0] = in->data[0] + x + y * in->linesize[0]; out->linesize[0] = in->linesize[0]; if(s->pix_fmt == AV_PIX_FMT_YUV420P) { out->data[1] = in->data[1] + (x >> 1) + (y >> 1) * in->linesize[1]; out->linesize[1] = in->linesize[1]; out->data[2] = in->data[2] + (x >> 1) + (y >> 1) * in->linesize[2]; out->linesize[2] = in->linesize[2]; } }
true
FFmpeg
7da9f4523159670d577a2808d4481e64008a8894
static void get_sub_picture(CinepakEncContext *s, int x, int y, AVPicture *in, AVPicture *out) { out->data[0] = in->data[0] + x + y * in->linesize[0]; out->linesize[0] = in->linesize[0]; if(s->pix_fmt == AV_PIX_FMT_YUV420P) { out->data[1] = in->data[1] + (x >> 1) + (y >> 1) * in->linesize[1]; out->linesize[1] = in->linesize[1]; out->data[2] = in->data[2] + (x >> 1) + (y >> 1) * in->linesize[2]; out->linesize[2] = in->linesize[2]; } }
{ "code": [ " if(s->pix_fmt == AV_PIX_FMT_YUV420P) {", " if(s->pix_fmt == AV_PIX_FMT_YUV420P) {", " if(s->pix_fmt == AV_PIX_FMT_YUV420P) {", " if(s->pix_fmt == AV_PIX_FMT_YUV420P) {" ], "line_no": [ 11, 11, 11, 11 ] }
static void FUNC_0(CinepakEncContext *VAR_0, int VAR_1, int VAR_2, AVPicture *VAR_3, AVPicture *VAR_4) { VAR_4->data[0] = VAR_3->data[0] + VAR_1 + VAR_2 * VAR_3->linesize[0]; VAR_4->linesize[0] = VAR_3->linesize[0]; if(VAR_0->pix_fmt == AV_PIX_FMT_YUV420P) { VAR_4->data[1] = VAR_3->data[1] + (VAR_1 >> 1) + (VAR_2 >> 1) * VAR_3->linesize[1]; VAR_4->linesize[1] = VAR_3->linesize[1]; VAR_4->data[2] = VAR_3->data[2] + (VAR_1 >> 1) + (VAR_2 >> 1) * VAR_3->linesize[2]; VAR_4->linesize[2] = VAR_3->linesize[2]; } }
[ "static void FUNC_0(CinepakEncContext *VAR_0, int VAR_1, int VAR_2, AVPicture *VAR_3, AVPicture *VAR_4)\n{", "VAR_4->data[0] = VAR_3->data[0] + VAR_1 + VAR_2 * VAR_3->linesize[0];", "VAR_4->linesize[0] = VAR_3->linesize[0];", "if(VAR_0->pix_fmt == AV_PIX_FMT_YUV420P) {", "VAR_4->data[1] = VAR_3->data[1] + (VAR_1 >> 1) + (VAR_2 >> 1) * VAR_3->linesize[1];", "VAR_4->linesize[1] = VAR_3->linesize[1];", "VAR_4->data[2] = VAR_3->data[2] + (VAR_1 >> 1) + (VAR_2 >> 1) * VAR_3->linesize[2];", "VAR_4->linesize[2] = VAR_3->linesize[2];", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
12,228
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options) { int ret = 0; AVDictionary *tmp = NULL; if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) return AVERROR(EINVAL); if (options) av_dict_copy(&tmp, *options, 0); /* If there is a user-supplied mutex locking routine, call it. */ if (ff_lockmgr_cb) { if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; entangled_thread_counter++; if(entangled_thread_counter != 1){ av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n"); goto end; if(avctx->codec || !codec) { ret = AVERROR(EINVAL); goto end; avctx->internal = av_mallocz(sizeof(AVCodecInternal)); if (!avctx->internal) { ret = AVERROR(ENOMEM); goto end; if (codec->priv_data_size > 0) { if(!avctx->priv_data){ avctx->priv_data = av_mallocz(codec->priv_data_size); if (!avctx->priv_data) { ret = AVERROR(ENOMEM); goto end; if (codec->priv_class) { *(AVClass**)avctx->priv_data= codec->priv_class; av_opt_set_defaults(avctx->priv_data); if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) } else { avctx->priv_data = NULL; if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) //We only call avcodec_set_dimensions() for non h264 codecs so as not to overwrite previously setup dimensions if(!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == CODEC_ID_H264)){ if(avctx->coded_width && avctx->coded_height) avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); else if(avctx->width && avctx->height) avcodec_set_dimensions(avctx, avctx->width, avctx->height); if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { av_log(avctx, AV_LOG_WARNING, "ignoring invalid width/height values\n"); avcodec_set_dimensions(avctx, 0, 0); /* if the decoder init function was already called previously, free the already allocated subtitle_header before overwriting it */ if (codec->decode) av_freep(&avctx->subtitle_header); #define SANE_NB_CHANNELS 128U if (avctx->channels > SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); avctx->codec = codec; if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && avctx->codec_id == CODEC_ID_NONE) { avctx->codec_type = codec->type; avctx->codec_id = codec->id; if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n"); ret = AVERROR(EINVAL); avctx->frame_number = 0; #if FF_API_ER av_log(avctx, AV_LOG_DEBUG, "err{or,}_recognition separate: %d; %X\n", avctx->error_recognition, avctx->err_recognition); switch(avctx->error_recognition){ case FF_ER_EXPLODE : avctx->err_recognition |= AV_EF_EXPLODE | AV_EF_COMPLIANT | AV_EF_CAREFUL; break; case FF_ER_VERY_AGGRESSIVE: case FF_ER_AGGRESSIVE : avctx->err_recognition |= AV_EF_AGGRESSIVE; case FF_ER_COMPLIANT : avctx->err_recognition |= AV_EF_COMPLIANT; case FF_ER_CAREFUL : avctx->err_recognition |= AV_EF_CAREFUL; av_log(avctx, AV_LOG_DEBUG, "err{or,}_recognition combined: %d; %X\n", avctx->error_recognition, avctx->err_recognition); #endif if (!HAVE_THREADS) av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n"); if (HAVE_THREADS && !avctx->thread_opaque) { ret = ff_thread_init(avctx); if (ret < 0) { if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS)) avctx->thread_count = 1; if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); ret = AVERROR(EINVAL); if (avctx->codec->encode) { int i; if (avctx->codec->sample_fmts) { for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) break; if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n"); ret = AVERROR(EINVAL); if (avctx->codec->supported_samplerates) { for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++) if (avctx->sample_rate == avctx->codec->supported_samplerates[i]) break; if (avctx->codec->supported_samplerates[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified sample_rate is not supported\n"); ret = AVERROR(EINVAL); if (avctx->codec->channel_layouts) { if (!avctx->channel_layout) { av_log(avctx, AV_LOG_WARNING, "channel_layout not specified\n"); } else { for (i = 0; avctx->codec->channel_layouts[i] != 0; i++) if (avctx->channel_layout == avctx->codec->channel_layouts[i]) break; if (avctx->codec->channel_layouts[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified channel_layout is not supported\n"); ret = AVERROR(EINVAL); if (avctx->channel_layout && avctx->channels) { if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { av_log(avctx, AV_LOG_ERROR, "channel layout does not match number of channels\n"); ret = AVERROR(EINVAL); } else if (avctx->channel_layout) { avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout); avctx->pts_correction_num_faulty_pts = avctx->pts_correction_num_faulty_dts = 0; avctx->pts_correction_last_pts = avctx->pts_correction_last_dts = INT64_MIN; if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){ ret = avctx->codec->init(avctx); if (ret < 0) { ret=0; end: entangled_thread_counter--; /* Release any user-supplied mutex. */ if (ff_lockmgr_cb) { (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE); if (options) { av_dict_free(options); *options = tmp; return ret; free_and_end: av_dict_free(&tmp); av_freep(&avctx->priv_data); av_freep(&avctx->internal); avctx->codec= NULL; goto end;
true
FFmpeg
8d95eb6702b46cd07385c5478b10924ea78e6f18
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options) { int ret = 0; AVDictionary *tmp = NULL; if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) return AVERROR(EINVAL); if (options) av_dict_copy(&tmp, *options, 0); if (ff_lockmgr_cb) { if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; entangled_thread_counter++; if(entangled_thread_counter != 1){ av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n"); goto end; if(avctx->codec || !codec) { ret = AVERROR(EINVAL); goto end; avctx->internal = av_mallocz(sizeof(AVCodecInternal)); if (!avctx->internal) { ret = AVERROR(ENOMEM); goto end; if (codec->priv_data_size > 0) { if(!avctx->priv_data){ avctx->priv_data = av_mallocz(codec->priv_data_size); if (!avctx->priv_data) { ret = AVERROR(ENOMEM); goto end; if (codec->priv_class) { *(AVClass**)avctx->priv_data= codec->priv_class; av_opt_set_defaults(avctx->priv_data); if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) } else { avctx->priv_data = NULL; if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) if(!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == CODEC_ID_H264)){ if(avctx->coded_width && avctx->coded_height) avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); else if(avctx->width && avctx->height) avcodec_set_dimensions(avctx, avctx->width, avctx->height); if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { av_log(avctx, AV_LOG_WARNING, "ignoring invalid width/height values\n"); avcodec_set_dimensions(avctx, 0, 0); if (codec->decode) av_freep(&avctx->subtitle_header); #define SANE_NB_CHANNELS 128U if (avctx->channels > SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); avctx->codec = codec; if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && avctx->codec_id == CODEC_ID_NONE) { avctx->codec_type = codec->type; avctx->codec_id = codec->id; if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n"); ret = AVERROR(EINVAL); avctx->frame_number = 0; #if FF_API_ER av_log(avctx, AV_LOG_DEBUG, "err{or,}_recognition separate: %d; %X\n", avctx->error_recognition, avctx->err_recognition); switch(avctx->error_recognition){ case FF_ER_EXPLODE : avctx->err_recognition |= AV_EF_EXPLODE | AV_EF_COMPLIANT | AV_EF_CAREFUL; break; case FF_ER_VERY_AGGRESSIVE: case FF_ER_AGGRESSIVE : avctx->err_recognition |= AV_EF_AGGRESSIVE; case FF_ER_COMPLIANT : avctx->err_recognition |= AV_EF_COMPLIANT; case FF_ER_CAREFUL : avctx->err_recognition |= AV_EF_CAREFUL; av_log(avctx, AV_LOG_DEBUG, "err{or,}_recognition combined: %d; %X\n", avctx->error_recognition, avctx->err_recognition); #endif if (!HAVE_THREADS) av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n"); if (HAVE_THREADS && !avctx->thread_opaque) { ret = ff_thread_init(avctx); if (ret < 0) { if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS)) avctx->thread_count = 1; if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); ret = AVERROR(EINVAL); if (avctx->codec->encode) { int i; if (avctx->codec->sample_fmts) { for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) break; if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n"); ret = AVERROR(EINVAL); if (avctx->codec->supported_samplerates) { for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++) if (avctx->sample_rate == avctx->codec->supported_samplerates[i]) break; if (avctx->codec->supported_samplerates[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified sample_rate is not supported\n"); ret = AVERROR(EINVAL); if (avctx->codec->channel_layouts) { if (!avctx->channel_layout) { av_log(avctx, AV_LOG_WARNING, "channel_layout not specified\n"); } else { for (i = 0; avctx->codec->channel_layouts[i] != 0; i++) if (avctx->channel_layout == avctx->codec->channel_layouts[i]) break; if (avctx->codec->channel_layouts[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified channel_layout is not supported\n"); ret = AVERROR(EINVAL); if (avctx->channel_layout && avctx->channels) { if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { av_log(avctx, AV_LOG_ERROR, "channel layout does not match number of channels\n"); ret = AVERROR(EINVAL); } else if (avctx->channel_layout) { avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout); avctx->pts_correction_num_faulty_pts = avctx->pts_correction_num_faulty_dts = 0; avctx->pts_correction_last_pts = avctx->pts_correction_last_dts = INT64_MIN; if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){ ret = avctx->codec->init(avctx); if (ret < 0) { ret=0; end: entangled_thread_counter--; if (ff_lockmgr_cb) { (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE); if (options) { av_dict_free(options); *options = tmp; return ret; free_and_end: av_dict_free(&tmp); av_freep(&avctx->priv_data); av_freep(&avctx->internal); avctx->codec= NULL; goto end;
{ "code": [], "line_no": [] }
int VAR_0 avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options) { int ret = 0; AVDictionary *tmp = NULL; if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) return AVERROR(EINVAL); if (options) av_dict_copy(&tmp, *options, 0); if (ff_lockmgr_cb) { if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; entangled_thread_counter++; if(entangled_thread_counter != 1){ av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n"); goto end; if(avctx->codec || !codec) { ret = AVERROR(EINVAL); goto end; avctx->internal = av_mallocz(sizeof(AVCodecInternal)); if (!avctx->internal) { ret = AVERROR(ENOMEM); goto end; if (codec->priv_data_size > 0) { if(!avctx->priv_data){ avctx->priv_data = av_mallocz(codec->priv_data_size); if (!avctx->priv_data) { ret = AVERROR(ENOMEM); goto end; if (codec->priv_class) { *(AVClass**)avctx->priv_data= codec->priv_class; av_opt_set_defaults(avctx->priv_data); if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) } else { avctx->priv_data = NULL; if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) if(!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == CODEC_ID_H264)){ if(avctx->coded_width && avctx->coded_height) avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); else if(avctx->width && avctx->height) avcodec_set_dimensions(avctx, avctx->width, avctx->height); if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { av_log(avctx, AV_LOG_WARNING, "ignoring invalid width/height values\n"); avcodec_set_dimensions(avctx, 0, 0); if (codec->decode) av_freep(&avctx->subtitle_header); #define SANE_NB_CHANNELS 128U if (avctx->channels > SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); avctx->codec = codec; if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && avctx->codec_id == CODEC_ID_NONE) { avctx->codec_type = codec->type; avctx->codec_id = codec->id; if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n"); ret = AVERROR(EINVAL); avctx->frame_number = 0; #if FF_API_ER av_log(avctx, AV_LOG_DEBUG, "err{or,}_recognition separate: %d; %X\n", avctx->error_recognition, avctx->err_recognition); switch(avctx->error_recognition){ case FF_ER_EXPLODE : avctx->err_recognition |= AV_EF_EXPLODE | AV_EF_COMPLIANT | AV_EF_CAREFUL; break; case FF_ER_VERY_AGGRESSIVE: case FF_ER_AGGRESSIVE : avctx->err_recognition |= AV_EF_AGGRESSIVE; case FF_ER_COMPLIANT : avctx->err_recognition |= AV_EF_COMPLIANT; case FF_ER_CAREFUL : avctx->err_recognition |= AV_EF_CAREFUL; av_log(avctx, AV_LOG_DEBUG, "err{or,}_recognition combined: %d; %X\n", avctx->error_recognition, avctx->err_recognition); #endif if (!HAVE_THREADS) av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n"); if (HAVE_THREADS && !avctx->thread_opaque) { ret = ff_thread_init(avctx); if (ret < 0) { if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS)) avctx->thread_count = 1; if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); ret = AVERROR(EINVAL); if (avctx->codec->encode) { int i; if (avctx->codec->sample_fmts) { for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) break; if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n"); ret = AVERROR(EINVAL); if (avctx->codec->supported_samplerates) { for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++) if (avctx->sample_rate == avctx->codec->supported_samplerates[i]) break; if (avctx->codec->supported_samplerates[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified sample_rate is not supported\n"); ret = AVERROR(EINVAL); if (avctx->codec->channel_layouts) { if (!avctx->channel_layout) { av_log(avctx, AV_LOG_WARNING, "channel_layout not specified\n"); } else { for (i = 0; avctx->codec->channel_layouts[i] != 0; i++) if (avctx->channel_layout == avctx->codec->channel_layouts[i]) break; if (avctx->codec->channel_layouts[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified channel_layout is not supported\n"); ret = AVERROR(EINVAL); if (avctx->channel_layout && avctx->channels) { if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { av_log(avctx, AV_LOG_ERROR, "channel layout does not match number of channels\n"); ret = AVERROR(EINVAL); } else if (avctx->channel_layout) { avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout); avctx->pts_correction_num_faulty_pts = avctx->pts_correction_num_faulty_dts = 0; avctx->pts_correction_last_pts = avctx->pts_correction_last_dts = INT64_MIN; if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){ ret = avctx->codec->init(avctx); if (ret < 0) { ret=0; end: entangled_thread_counter--; if (ff_lockmgr_cb) { (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE); if (options) { av_dict_free(options); *options = tmp; return ret; free_and_end: av_dict_free(&tmp); av_freep(&avctx->priv_data); av_freep(&avctx->internal); avctx->codec= NULL; goto end;
[ "int VAR_0 avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)\n{", "int ret = 0;", "AVDictionary *tmp = NULL;", "if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)\nreturn AVERROR(EINVAL);", "if (options)\nav_dict_copy(&tmp, *options, 0);", "if (ff_lockmgr_cb) {", "if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN))\nreturn -1;", "entangled_thread_counter++;", "if(entangled_thread_counter != 1){", "av_log(avctx, AV_LOG_ERROR, \"insufficient thread locking around avcodec_open/close()\\n\");", "goto end;", "if(avctx->codec || !codec) {", "ret = AVERROR(EINVAL);", "goto end;", "avctx->internal = av_mallocz(sizeof(AVCodecInternal));", "if (!avctx->internal) {", "ret = AVERROR(ENOMEM);", "goto end;", "if (codec->priv_data_size > 0) {", "if(!avctx->priv_data){", "avctx->priv_data = av_mallocz(codec->priv_data_size);", "if (!avctx->priv_data) {", "ret = AVERROR(ENOMEM);", "goto end;", "if (codec->priv_class) {", "*(AVClass**)avctx->priv_data= codec->priv_class;", "av_opt_set_defaults(avctx->priv_data);", "if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0)\n} else {", "avctx->priv_data = NULL;", "if ((ret = av_opt_set_dict(avctx, &tmp)) < 0)\nif(!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == CODEC_ID_H264)){", "if(avctx->coded_width && avctx->coded_height)\navcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height);", "else if(avctx->width && avctx->height)\navcodec_set_dimensions(avctx, avctx->width, avctx->height);", "if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)\n&& ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0\n|| av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) {", "av_log(avctx, AV_LOG_WARNING, \"ignoring invalid width/height values\\n\");", "avcodec_set_dimensions(avctx, 0, 0);", "if (codec->decode)\nav_freep(&avctx->subtitle_header);", "#define SANE_NB_CHANNELS 128U\nif (avctx->channels > SANE_NB_CHANNELS) {", "ret = AVERROR(EINVAL);", "avctx->codec = codec;", "if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) &&\navctx->codec_id == CODEC_ID_NONE) {", "avctx->codec_type = codec->type;", "avctx->codec_id = codec->id;", "if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type\n&& avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) {", "av_log(avctx, AV_LOG_ERROR, \"codec type or id mismatches\\n\");", "ret = AVERROR(EINVAL);", "avctx->frame_number = 0;", "#if FF_API_ER\nav_log(avctx, AV_LOG_DEBUG, \"err{or,}_recognition separate: %d; %X\\n\",", "avctx->error_recognition, avctx->err_recognition);", "switch(avctx->error_recognition){", "case FF_ER_EXPLODE : avctx->err_recognition |= AV_EF_EXPLODE | AV_EF_COMPLIANT | AV_EF_CAREFUL;", "break;", "case FF_ER_VERY_AGGRESSIVE:\ncase FF_ER_AGGRESSIVE : avctx->err_recognition |= AV_EF_AGGRESSIVE;", "case FF_ER_COMPLIANT : avctx->err_recognition |= AV_EF_COMPLIANT;", "case FF_ER_CAREFUL : avctx->err_recognition |= AV_EF_CAREFUL;", "av_log(avctx, AV_LOG_DEBUG, \"err{or,}_recognition combined: %d; %X\\n\",", "avctx->error_recognition, avctx->err_recognition);", "#endif\nif (!HAVE_THREADS)\nav_log(avctx, AV_LOG_WARNING, \"Warning: not compiled with thread support, using thread emulation\\n\");", "if (HAVE_THREADS && !avctx->thread_opaque) {", "ret = ff_thread_init(avctx);", "if (ret < 0) {", "if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS))\navctx->thread_count = 1;", "if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) {", "av_log(avctx, AV_LOG_ERROR, \"The maximum value for lowres supported by the decoder is %d\\n\",\navctx->codec->max_lowres);", "ret = AVERROR(EINVAL);", "if (avctx->codec->encode) {", "int i;", "if (avctx->codec->sample_fmts) {", "for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++)", "if (avctx->sample_fmt == avctx->codec->sample_fmts[i])\nbreak;", "if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {", "av_log(avctx, AV_LOG_ERROR, \"Specified sample_fmt is not supported.\\n\");", "ret = AVERROR(EINVAL);", "if (avctx->codec->supported_samplerates) {", "for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++)", "if (avctx->sample_rate == avctx->codec->supported_samplerates[i])\nbreak;", "if (avctx->codec->supported_samplerates[i] == 0) {", "av_log(avctx, AV_LOG_ERROR, \"Specified sample_rate is not supported\\n\");", "ret = AVERROR(EINVAL);", "if (avctx->codec->channel_layouts) {", "if (!avctx->channel_layout) {", "av_log(avctx, AV_LOG_WARNING, \"channel_layout not specified\\n\");", "} else {", "for (i = 0; avctx->codec->channel_layouts[i] != 0; i++)", "if (avctx->channel_layout == avctx->codec->channel_layouts[i])\nbreak;", "if (avctx->codec->channel_layouts[i] == 0) {", "av_log(avctx, AV_LOG_ERROR, \"Specified channel_layout is not supported\\n\");", "ret = AVERROR(EINVAL);", "if (avctx->channel_layout && avctx->channels) {", "if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) {", "av_log(avctx, AV_LOG_ERROR, \"channel layout does not match number of channels\\n\");", "ret = AVERROR(EINVAL);", "} else if (avctx->channel_layout) {", "avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout);", "avctx->pts_correction_num_faulty_pts =\navctx->pts_correction_num_faulty_dts = 0;", "avctx->pts_correction_last_pts =\navctx->pts_correction_last_dts = INT64_MIN;", "if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){", "ret = avctx->codec->init(avctx);", "if (ret < 0) {", "ret=0;", "end:\nentangled_thread_counter--;", "if (ff_lockmgr_cb) {", "(*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE);", "if (options) {", "av_dict_free(options);", "*options = tmp;", "return ret;", "free_and_end:\nav_dict_free(&tmp);", "av_freep(&avctx->priv_data);", "av_freep(&avctx->internal);", "avctx->codec= NULL;", "goto end;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5, 6 ], [ 7, 8 ], [ 10 ], [ 11, 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33, 34 ], [ 35 ], [ 36, 38 ], [ 39, 40 ], [ 41, 42 ], [ 43, 44, 45 ], [ 46 ], [ 47 ], [ 50, 51 ], [ 52, 53 ], [ 54 ], [ 55 ], [ 56, 57 ], [ 58 ], [ 59 ], [ 60, 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65, 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70 ], [ 71, 72 ], [ 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77, 78, 79 ], [ 80 ], [ 81 ], [ 82 ], [ 83, 84 ], [ 85 ], [ 86, 87 ], [ 88 ], [ 89 ], [ 90 ], [ 91 ], [ 92 ], [ 93, 94 ], [ 95 ], [ 96 ], [ 97 ], [ 98 ], [ 99 ], [ 100, 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 108 ], [ 109 ], [ 110, 111 ], [ 112 ], [ 113 ], [ 114 ], [ 115 ], [ 116 ], [ 117 ], [ 118 ], [ 119 ], [ 120 ], [ 121, 122 ], [ 123, 124 ], [ 125 ], [ 126 ], [ 127 ], [ 128 ], [ 129, 130 ], [ 132 ], [ 133 ], [ 134 ], [ 135 ], [ 136 ], [ 137 ], [ 138, 139 ], [ 140 ], [ 141 ], [ 142 ], [ 143 ] ]
12,229
static void cpu_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); CPUClass *k = CPU_CLASS(klass); k->class_by_name = cpu_common_class_by_name; k->reset = cpu_common_reset; k->get_arch_id = cpu_common_get_arch_id; k->get_paging_enabled = cpu_common_get_paging_enabled; k->get_memory_mapping = cpu_common_get_memory_mapping; k->write_elf32_qemunote = cpu_common_write_elf32_qemunote; k->write_elf32_note = cpu_common_write_elf32_note; k->write_elf64_qemunote = cpu_common_write_elf64_qemunote; k->write_elf64_note = cpu_common_write_elf64_note; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = cpu_common_gdb_write_register; dc->realize = cpu_common_realizefn; dc->no_user = 1; }
true
qemu
efec3dd631d94160288392721a5f9c39e50fb2bc
static void cpu_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); CPUClass *k = CPU_CLASS(klass); k->class_by_name = cpu_common_class_by_name; k->reset = cpu_common_reset; k->get_arch_id = cpu_common_get_arch_id; k->get_paging_enabled = cpu_common_get_paging_enabled; k->get_memory_mapping = cpu_common_get_memory_mapping; k->write_elf32_qemunote = cpu_common_write_elf32_qemunote; k->write_elf32_note = cpu_common_write_elf32_note; k->write_elf64_qemunote = cpu_common_write_elf64_qemunote; k->write_elf64_note = cpu_common_write_elf64_note; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = cpu_common_gdb_write_register; dc->realize = cpu_common_realizefn; dc->no_user = 1; }
{ "code": [ " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;", " dc->no_user = 1;" ], "line_no": [ 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35 ] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); CPUClass *k = CPU_CLASS(VAR_0); k->class_by_name = cpu_common_class_by_name; k->reset = cpu_common_reset; k->get_arch_id = cpu_common_get_arch_id; k->get_paging_enabled = cpu_common_get_paging_enabled; k->get_memory_mapping = cpu_common_get_memory_mapping; k->write_elf32_qemunote = cpu_common_write_elf32_qemunote; k->write_elf32_note = cpu_common_write_elf32_note; k->write_elf64_qemunote = cpu_common_write_elf64_qemunote; k->write_elf64_note = cpu_common_write_elf64_note; k->gdb_read_register = cpu_common_gdb_read_register; k->gdb_write_register = cpu_common_gdb_write_register; dc->realize = cpu_common_realizefn; dc->no_user = 1; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "CPUClass *k = CPU_CLASS(VAR_0);", "k->class_by_name = cpu_common_class_by_name;", "k->reset = cpu_common_reset;", "k->get_arch_id = cpu_common_get_arch_id;", "k->get_paging_enabled = cpu_common_get_paging_enabled;", "k->get_memory_mapping = cpu_common_get_memory_mapping;", "k->write_elf32_qemunote = cpu_common_write_elf32_qemunote;", "k->write_elf32_note = cpu_common_write_elf32_note;", "k->write_elf64_qemunote = cpu_common_write_elf64_qemunote;", "k->write_elf64_note = cpu_common_write_elf64_note;", "k->gdb_read_register = cpu_common_gdb_read_register;", "k->gdb_write_register = cpu_common_gdb_write_register;", "dc->realize = cpu_common_realizefn;", "dc->no_user = 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
12,230
static int fill_note_info(struct elf_note_info *info, long signr, const CPUArchState *env) { #define NUMNOTES 3 CPUState *cpu = ENV_GET_CPU((CPUArchState *)env); TaskState *ts = (TaskState *)cpu->opaque; int i; info->notes = g_malloc0(NUMNOTES * sizeof (struct memelfnote)); if (info->notes == NULL) return (-ENOMEM); info->prstatus = g_malloc0(sizeof (*info->prstatus)); if (info->prstatus == NULL) return (-ENOMEM); info->psinfo = g_malloc0(sizeof (*info->psinfo)); if (info->prstatus == NULL) return (-ENOMEM); /* * First fill in status (and registers) of current thread * including process info & aux vector. */ fill_prstatus(info->prstatus, ts, signr); elf_core_copy_regs(&info->prstatus->pr_reg, env); fill_note(&info->notes[0], "CORE", NT_PRSTATUS, sizeof (*info->prstatus), info->prstatus); fill_psinfo(info->psinfo, ts); fill_note(&info->notes[1], "CORE", NT_PRPSINFO, sizeof (*info->psinfo), info->psinfo); fill_auxv_note(&info->notes[2], ts); info->numnote = 3; info->notes_size = 0; for (i = 0; i < info->numnote; i++) info->notes_size += note_size(&info->notes[i]); /* read and fill status of all threads */ cpu_list_lock(); CPU_FOREACH(cpu) { if (cpu == thread_cpu) { continue; } fill_thread_info(info, (CPUArchState *)cpu->env_ptr); } cpu_list_unlock(); return (0); }
true
qemu
c78d65e8a7d87badf46eda3a0b41330f5d239132
static int fill_note_info(struct elf_note_info *info, long signr, const CPUArchState *env) { #define NUMNOTES 3 CPUState *cpu = ENV_GET_CPU((CPUArchState *)env); TaskState *ts = (TaskState *)cpu->opaque; int i; info->notes = g_malloc0(NUMNOTES * sizeof (struct memelfnote)); if (info->notes == NULL) return (-ENOMEM); info->prstatus = g_malloc0(sizeof (*info->prstatus)); if (info->prstatus == NULL) return (-ENOMEM); info->psinfo = g_malloc0(sizeof (*info->psinfo)); if (info->prstatus == NULL) return (-ENOMEM); fill_prstatus(info->prstatus, ts, signr); elf_core_copy_regs(&info->prstatus->pr_reg, env); fill_note(&info->notes[0], "CORE", NT_PRSTATUS, sizeof (*info->prstatus), info->prstatus); fill_psinfo(info->psinfo, ts); fill_note(&info->notes[1], "CORE", NT_PRPSINFO, sizeof (*info->psinfo), info->psinfo); fill_auxv_note(&info->notes[2], ts); info->numnote = 3; info->notes_size = 0; for (i = 0; i < info->numnote; i++) info->notes_size += note_size(&info->notes[i]); cpu_list_lock(); CPU_FOREACH(cpu) { if (cpu == thread_cpu) { continue; } fill_thread_info(info, (CPUArchState *)cpu->env_ptr); } cpu_list_unlock(); return (0); }
{ "code": [ " info->notes = g_malloc0(NUMNOTES * sizeof (struct memelfnote));" ], "line_no": [ 17 ] }
static int FUNC_0(struct elf_note_info *VAR_0, long VAR_1, const CPUArchState *VAR_2) { #define NUMNOTES 3 CPUState *cpu = ENV_GET_CPU((CPUArchState *)VAR_2); TaskState *ts = (TaskState *)cpu->opaque; int VAR_3; VAR_0->notes = g_malloc0(NUMNOTES * sizeof (struct memelfnote)); if (VAR_0->notes == NULL) return (-ENOMEM); VAR_0->prstatus = g_malloc0(sizeof (*VAR_0->prstatus)); if (VAR_0->prstatus == NULL) return (-ENOMEM); VAR_0->psinfo = g_malloc0(sizeof (*VAR_0->psinfo)); if (VAR_0->prstatus == NULL) return (-ENOMEM); fill_prstatus(VAR_0->prstatus, ts, VAR_1); elf_core_copy_regs(&VAR_0->prstatus->pr_reg, VAR_2); fill_note(&VAR_0->notes[0], "CORE", NT_PRSTATUS, sizeof (*VAR_0->prstatus), VAR_0->prstatus); fill_psinfo(VAR_0->psinfo, ts); fill_note(&VAR_0->notes[1], "CORE", NT_PRPSINFO, sizeof (*VAR_0->psinfo), VAR_0->psinfo); fill_auxv_note(&VAR_0->notes[2], ts); VAR_0->numnote = 3; VAR_0->notes_size = 0; for (VAR_3 = 0; VAR_3 < VAR_0->numnote; VAR_3++) VAR_0->notes_size += note_size(&VAR_0->notes[VAR_3]); cpu_list_lock(); CPU_FOREACH(cpu) { if (cpu == thread_cpu) { continue; } fill_thread_info(VAR_0, (CPUArchState *)cpu->env_ptr); } cpu_list_unlock(); return (0); }
[ "static int FUNC_0(struct elf_note_info *VAR_0,\nlong VAR_1, const CPUArchState *VAR_2)\n{", "#define NUMNOTES 3\nCPUState *cpu = ENV_GET_CPU((CPUArchState *)VAR_2);", "TaskState *ts = (TaskState *)cpu->opaque;", "int VAR_3;", "VAR_0->notes = g_malloc0(NUMNOTES * sizeof (struct memelfnote));", "if (VAR_0->notes == NULL)\nreturn (-ENOMEM);", "VAR_0->prstatus = g_malloc0(sizeof (*VAR_0->prstatus));", "if (VAR_0->prstatus == NULL)\nreturn (-ENOMEM);", "VAR_0->psinfo = g_malloc0(sizeof (*VAR_0->psinfo));", "if (VAR_0->prstatus == NULL)\nreturn (-ENOMEM);", "fill_prstatus(VAR_0->prstatus, ts, VAR_1);", "elf_core_copy_regs(&VAR_0->prstatus->pr_reg, VAR_2);", "fill_note(&VAR_0->notes[0], \"CORE\", NT_PRSTATUS,\nsizeof (*VAR_0->prstatus), VAR_0->prstatus);", "fill_psinfo(VAR_0->psinfo, ts);", "fill_note(&VAR_0->notes[1], \"CORE\", NT_PRPSINFO,\nsizeof (*VAR_0->psinfo), VAR_0->psinfo);", "fill_auxv_note(&VAR_0->notes[2], ts);", "VAR_0->numnote = 3;", "VAR_0->notes_size = 0;", "for (VAR_3 = 0; VAR_3 < VAR_0->numnote; VAR_3++)", "VAR_0->notes_size += note_size(&VAR_0->notes[VAR_3]);", "cpu_list_lock();", "CPU_FOREACH(cpu) {", "if (cpu == thread_cpu) {", "continue;", "}", "fill_thread_info(VAR_0, (CPUArchState *)cpu->env_ptr);", "}", "cpu_list_unlock();", "return (0);", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ] ]
12,232
static uint16List **host_memory_append_node(uint16List **node, unsigned long value) { *node = g_malloc0(sizeof(**node)); (*node)->value = value; return &(*node)->next; }
true
qemu
658ae5a7b90139a6a296cd4cd83643d843964796
static uint16List **host_memory_append_node(uint16List **node, unsigned long value) { *node = g_malloc0(sizeof(**node)); (*node)->value = value; return &(*node)->next; }
{ "code": [ "static uint16List **host_memory_append_node(uint16List **node,", " unsigned long value)", " *node = g_malloc0(sizeof(**node));", " (*node)->value = value;", " return &(*node)->next;" ], "line_no": [ 1, 3, 7, 9, 11 ] }
static uint16List **FUNC_0(uint16List **node, unsigned long value) { *node = g_malloc0(sizeof(**node)); (*node)->value = value; return &(*node)->next; }
[ "static uint16List **FUNC_0(uint16List **node,\nunsigned long value)\n{", "*node = g_malloc0(sizeof(**node));", "(*node)->value = value;", "return &(*node)->next;", "}" ]
[ 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
12,233
static int e1000_post_load(void *opaque, int version_id) { E1000State *s = opaque; NetClientState *nc = qemu_get_queue(s->nic); /* nc.link_down can't be migrated, so infer link_down according * to link status bit in mac_reg[STATUS] */ nc->link_down = (s->mac_reg[STATUS] & E1000_STATUS_LU) == 0; return 0; }
true
qemu
ddcb73b7782cb6104479503faea04cc224f982b5
static int e1000_post_load(void *opaque, int version_id) { E1000State *s = opaque; NetClientState *nc = qemu_get_queue(s->nic); nc->link_down = (s->mac_reg[STATUS] & E1000_STATUS_LU) == 0; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, int VAR_1) { E1000State *s = VAR_0; NetClientState *nc = qemu_get_queue(s->nic); nc->link_down = (s->mac_reg[STATUS] & E1000_STATUS_LU) == 0; return 0; }
[ "static int FUNC_0(void *VAR_0, int VAR_1)\n{", "E1000State *s = VAR_0;", "NetClientState *nc = qemu_get_queue(s->nic);", "nc->link_down = (s->mac_reg[STATUS] & E1000_STATUS_LU) == 0;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 15 ], [ 19 ], [ 21 ] ]
12,234
bdrv_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie, int64_t bytes, enum BlockAcctType type) { assert(type < BDRV_MAX_IOTYPE); cookie->bytes = bytes; cookie->start_time_ns = get_clock(); cookie->type = type; }
true
qemu
5e5a94b60518002e8ecc7afa78a9e7565b23e38f
bdrv_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie, int64_t bytes, enum BlockAcctType type) { assert(type < BDRV_MAX_IOTYPE); cookie->bytes = bytes; cookie->start_time_ns = get_clock(); cookie->type = type; }
{ "code": [ "bdrv_acct_start(BlockDriverState *bs, BlockAcctCookie *cookie, int64_t bytes,", " enum BlockAcctType type)", " assert(type < BDRV_MAX_IOTYPE);", " cookie->bytes = bytes;", " cookie->start_time_ns = get_clock();", " cookie->type = type;" ], "line_no": [ 1, 3, 7, 11, 13, 15 ] }
FUNC_0(BlockDriverState *VAR_0, BlockAcctCookie *VAR_1, int64_t VAR_2, enum BlockAcctType VAR_3) { assert(VAR_3 < BDRV_MAX_IOTYPE); VAR_1->VAR_2 = VAR_2; VAR_1->start_time_ns = get_clock(); VAR_1->VAR_3 = VAR_3; }
[ "FUNC_0(BlockDriverState *VAR_0, BlockAcctCookie *VAR_1, int64_t VAR_2,\nenum BlockAcctType VAR_3)\n{", "assert(VAR_3 < BDRV_MAX_IOTYPE);", "VAR_1->VAR_2 = VAR_2;", "VAR_1->start_time_ns = get_clock();", "VAR_1->VAR_3 = VAR_3;", "}" ]
[ 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
12,235
static int tcp_open(URLContext *h, const char *uri, int flags) { struct sockaddr_in dest_addr; int port, fd = -1; TCPContext *s = NULL; fd_set wfds; int fd_max, ret; struct timeval tv; socklen_t optlen; char hostname[1024],proto[1024],path[1024],tmp[1024],*q; if(!ff_network_init()) return AVERROR(EIO); url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port, path, sizeof(path), uri); if (strcmp(proto,"tcp") || port <= 0 || port >= 65536) return AVERROR(EINVAL); if ((q = strchr(hostname,'@'))) { strcpy(tmp,q+1); strcpy(hostname,tmp); } dest_addr.sin_family = AF_INET; dest_addr.sin_port = htons(port); if (resolve_host(&dest_addr.sin_addr, hostname) < 0) return AVERROR(EIO); fd = socket(AF_INET, SOCK_STREAM, 0); if (fd < 0) return AVERROR(EIO); ff_socket_nonblock(fd, 1); redo: ret = connect(fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr)); if (ret < 0) { if (ff_neterrno() == FF_NETERROR(EINTR)) goto redo; if (ff_neterrno() != FF_NETERROR(EINPROGRESS) && ff_neterrno() != FF_NETERROR(EAGAIN)) goto fail; /* wait until we are connected or until abort */ for(;;) { if (url_interrupt_cb()) { ret = AVERROR(EINTR); goto fail1; } fd_max = fd; FD_ZERO(&wfds); FD_SET(fd, &wfds); tv.tv_sec = 0; tv.tv_usec = 100 * 1000; ret = select(fd_max + 1, NULL, &wfds, NULL, &tv); if (ret > 0 && FD_ISSET(fd, &wfds)) break; } /* test error */ optlen = sizeof(ret); getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen); if (ret != 0) goto fail; } s = av_malloc(sizeof(TCPContext)); if (!s) return AVERROR(ENOMEM); h->priv_data = s; h->is_streamed = 1; s->fd = fd; return 0; fail: ret = AVERROR(EIO); fail1: if (fd >= 0) closesocket(fd); return ret; }
true
FFmpeg
f23a9759cee8442b02195a4539f65d041104c9cb
static int tcp_open(URLContext *h, const char *uri, int flags) { struct sockaddr_in dest_addr; int port, fd = -1; TCPContext *s = NULL; fd_set wfds; int fd_max, ret; struct timeval tv; socklen_t optlen; char hostname[1024],proto[1024],path[1024],tmp[1024],*q; if(!ff_network_init()) return AVERROR(EIO); url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port, path, sizeof(path), uri); if (strcmp(proto,"tcp") || port <= 0 || port >= 65536) return AVERROR(EINVAL); if ((q = strchr(hostname,'@'))) { strcpy(tmp,q+1); strcpy(hostname,tmp); } dest_addr.sin_family = AF_INET; dest_addr.sin_port = htons(port); if (resolve_host(&dest_addr.sin_addr, hostname) < 0) return AVERROR(EIO); fd = socket(AF_INET, SOCK_STREAM, 0); if (fd < 0) return AVERROR(EIO); ff_socket_nonblock(fd, 1); redo: ret = connect(fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr)); if (ret < 0) { if (ff_neterrno() == FF_NETERROR(EINTR)) goto redo; if (ff_neterrno() != FF_NETERROR(EINPROGRESS) && ff_neterrno() != FF_NETERROR(EAGAIN)) goto fail; for(;;) { if (url_interrupt_cb()) { ret = AVERROR(EINTR); goto fail1; } fd_max = fd; FD_ZERO(&wfds); FD_SET(fd, &wfds); tv.tv_sec = 0; tv.tv_usec = 100 * 1000; ret = select(fd_max + 1, NULL, &wfds, NULL, &tv); if (ret > 0 && FD_ISSET(fd, &wfds)) break; } optlen = sizeof(ret); getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen); if (ret != 0) goto fail; } s = av_malloc(sizeof(TCPContext)); if (!s) return AVERROR(ENOMEM); h->priv_data = s; h->is_streamed = 1; s->fd = fd; return 0; fail: ret = AVERROR(EIO); fail1: if (fd >= 0) closesocket(fd); return ret; }
{ "code": [ " char hostname[1024],proto[1024],path[1024],tmp[1024],*q;", " if ((q = strchr(hostname,'@'))) { strcpy(tmp,q+1); strcpy(hostname,tmp); }" ], "line_no": [ 19, 37 ] }
static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2) { struct sockaddr_in VAR_3; int VAR_4, VAR_5 = -1; TCPContext *s = NULL; fd_set wfds; int VAR_6, VAR_7; struct timeval VAR_8; socklen_t optlen; char VAR_9[1024],VAR_10[1024],VAR_11[1024],VAR_12[1024],*VAR_13; if(!ff_network_init()) return AVERROR(EIO); url_split(VAR_10, sizeof(VAR_10), NULL, 0, VAR_9, sizeof(VAR_9), &VAR_4, VAR_11, sizeof(VAR_11), VAR_1); if (strcmp(VAR_10,"tcp") || VAR_4 <= 0 || VAR_4 >= 65536) return AVERROR(EINVAL); if ((VAR_13 = strchr(VAR_9,'@'))) { strcpy(VAR_12,VAR_13+1); strcpy(VAR_9,VAR_12); } VAR_3.sin_family = AF_INET; VAR_3.sin_port = htons(VAR_4); if (resolve_host(&VAR_3.sin_addr, VAR_9) < 0) return AVERROR(EIO); VAR_5 = socket(AF_INET, SOCK_STREAM, 0); if (VAR_5 < 0) return AVERROR(EIO); ff_socket_nonblock(VAR_5, 1); redo: VAR_7 = connect(VAR_5, (struct sockaddr *)&VAR_3, sizeof(VAR_3)); if (VAR_7 < 0) { if (ff_neterrno() == FF_NETERROR(EINTR)) goto redo; if (ff_neterrno() != FF_NETERROR(EINPROGRESS) && ff_neterrno() != FF_NETERROR(EAGAIN)) goto fail; for(;;) { if (url_interrupt_cb()) { VAR_7 = AVERROR(EINTR); goto fail1; } VAR_6 = VAR_5; FD_ZERO(&wfds); FD_SET(VAR_5, &wfds); VAR_8.tv_sec = 0; VAR_8.tv_usec = 100 * 1000; VAR_7 = select(VAR_6 + 1, NULL, &wfds, NULL, &VAR_8); if (VAR_7 > 0 && FD_ISSET(VAR_5, &wfds)) break; } optlen = sizeof(VAR_7); getsockopt (VAR_5, SOL_SOCKET, SO_ERROR, &VAR_7, &optlen); if (VAR_7 != 0) goto fail; } s = av_malloc(sizeof(TCPContext)); if (!s) return AVERROR(ENOMEM); VAR_0->priv_data = s; VAR_0->is_streamed = 1; s->VAR_5 = VAR_5; return 0; fail: VAR_7 = AVERROR(EIO); fail1: if (VAR_5 >= 0) closesocket(VAR_5); return VAR_7; }
[ "static int FUNC_0(URLContext *VAR_0, const char *VAR_1, int VAR_2)\n{", "struct sockaddr_in VAR_3;", "int VAR_4, VAR_5 = -1;", "TCPContext *s = NULL;", "fd_set wfds;", "int VAR_6, VAR_7;", "struct timeval VAR_8;", "socklen_t optlen;", "char VAR_9[1024],VAR_10[1024],VAR_11[1024],VAR_12[1024],*VAR_13;", "if(!ff_network_init())\nreturn AVERROR(EIO);", "url_split(VAR_10, sizeof(VAR_10), NULL, 0, VAR_9, sizeof(VAR_9),\n&VAR_4, VAR_11, sizeof(VAR_11), VAR_1);", "if (strcmp(VAR_10,\"tcp\") || VAR_4 <= 0 || VAR_4 >= 65536)\nreturn AVERROR(EINVAL);", "if ((VAR_13 = strchr(VAR_9,'@'))) { strcpy(VAR_12,VAR_13+1); strcpy(VAR_9,VAR_12); }", "VAR_3.sin_family = AF_INET;", "VAR_3.sin_port = htons(VAR_4);", "if (resolve_host(&VAR_3.sin_addr, VAR_9) < 0)\nreturn AVERROR(EIO);", "VAR_5 = socket(AF_INET, SOCK_STREAM, 0);", "if (VAR_5 < 0)\nreturn AVERROR(EIO);", "ff_socket_nonblock(VAR_5, 1);", "redo:\nVAR_7 = connect(VAR_5, (struct sockaddr *)&VAR_3,\nsizeof(VAR_3));", "if (VAR_7 < 0) {", "if (ff_neterrno() == FF_NETERROR(EINTR))\ngoto redo;", "if (ff_neterrno() != FF_NETERROR(EINPROGRESS) &&\nff_neterrno() != FF_NETERROR(EAGAIN))\ngoto fail;", "for(;;) {", "if (url_interrupt_cb()) {", "VAR_7 = AVERROR(EINTR);", "goto fail1;", "}", "VAR_6 = VAR_5;", "FD_ZERO(&wfds);", "FD_SET(VAR_5, &wfds);", "VAR_8.tv_sec = 0;", "VAR_8.tv_usec = 100 * 1000;", "VAR_7 = select(VAR_6 + 1, NULL, &wfds, NULL, &VAR_8);", "if (VAR_7 > 0 && FD_ISSET(VAR_5, &wfds))\nbreak;", "}", "optlen = sizeof(VAR_7);", "getsockopt (VAR_5, SOL_SOCKET, SO_ERROR, &VAR_7, &optlen);", "if (VAR_7 != 0)\ngoto fail;", "}", "s = av_malloc(sizeof(TCPContext));", "if (!s)\nreturn AVERROR(ENOMEM);", "VAR_0->priv_data = s;", "VAR_0->is_streamed = 1;", "s->VAR_5 = VAR_5;", "return 0;", "fail:\nVAR_7 = AVERROR(EIO);", "fail1:\nif (VAR_5 >= 0)\nclosesocket(VAR_5);", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25 ], [ 29, 31 ], [ 33, 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 61, 63, 65 ], [ 67 ], [ 69, 71 ], [ 73, 75, 77 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 115 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141, 143 ], [ 145, 147, 149 ], [ 151 ], [ 153 ] ]
12,236
static av_always_inline int even(uint64_t layout) { return (!layout || (layout & (layout - 1))); }
true
FFmpeg
963f76144897d3f7684d82ec21e51dd50ea1106e
static av_always_inline int even(uint64_t layout) { return (!layout || (layout & (layout - 1))); }
{ "code": [ " return (!layout || (layout & (layout - 1)));" ], "line_no": [ 5 ] }
static av_always_inline int FUNC_0(uint64_t layout) { return (!layout || (layout & (layout - 1))); }
[ "static av_always_inline int FUNC_0(uint64_t layout)\n{", "return (!layout || (layout & (layout - 1)));", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
12,237
static int xen_host_pci_get_value(XenHostPCIDevice *d, const char *name, unsigned int *pvalue, int base) { char path[PATH_MAX]; char buf[XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE]; int fd, rc; unsigned long value; char *endptr; rc = xen_host_pci_sysfs_path(d, name, path, sizeof (path)); if (rc) { return rc; } fd = open(path, O_RDONLY); if (fd == -1) { XEN_HOST_PCI_LOG("Error: Can't open %s: %s\n", path, strerror(errno)); return -errno; } do { rc = read(fd, &buf, sizeof (buf) - 1); if (rc < 0 && errno != EINTR) { rc = -errno; goto out; } } while (rc < 0); buf[rc] = 0; value = strtol(buf, &endptr, base); if (endptr == buf || *endptr != '\n') { rc = -1; } else if ((value == LONG_MIN || value == LONG_MAX) && errno == ERANGE) { rc = -errno; } else { rc = 0; *pvalue = value; } out: close(fd); return rc; }
true
qemu
599d0c45615b7d099d256738a586d0f63bc707e6
static int xen_host_pci_get_value(XenHostPCIDevice *d, const char *name, unsigned int *pvalue, int base) { char path[PATH_MAX]; char buf[XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE]; int fd, rc; unsigned long value; char *endptr; rc = xen_host_pci_sysfs_path(d, name, path, sizeof (path)); if (rc) { return rc; } fd = open(path, O_RDONLY); if (fd == -1) { XEN_HOST_PCI_LOG("Error: Can't open %s: %s\n", path, strerror(errno)); return -errno; } do { rc = read(fd, &buf, sizeof (buf) - 1); if (rc < 0 && errno != EINTR) { rc = -errno; goto out; } } while (rc < 0); buf[rc] = 0; value = strtol(buf, &endptr, base); if (endptr == buf || *endptr != '\n') { rc = -1; } else if ((value == LONG_MIN || value == LONG_MAX) && errno == ERANGE) { rc = -errno; } else { rc = 0; *pvalue = value; } out: close(fd); return rc; }
{ "code": [ " if (rc) {", " return rc;", " rc = xen_host_pci_sysfs_path(d, name, path, sizeof (path));", " if (rc) {", " return rc;", " if (rc) {", " return rc;" ], "line_no": [ 21, 23, 19, 21, 23, 21, 23 ] }
static int FUNC_0(XenHostPCIDevice *VAR_0, const char *VAR_1, unsigned int *VAR_2, int VAR_3) { char VAR_4[PATH_MAX]; char VAR_5[XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE]; int VAR_6, VAR_7; unsigned long VAR_8; char *VAR_9; VAR_7 = xen_host_pci_sysfs_path(VAR_0, VAR_1, VAR_4, sizeof (VAR_4)); if (VAR_7) { return VAR_7; } VAR_6 = open(VAR_4, O_RDONLY); if (VAR_6 == -1) { XEN_HOST_PCI_LOG("Error: Can't open %s: %s\n", VAR_4, strerror(errno)); return -errno; } do { VAR_7 = read(VAR_6, &VAR_5, sizeof (VAR_5) - 1); if (VAR_7 < 0 && errno != EINTR) { VAR_7 = -errno; goto out; } } while (VAR_7 < 0); VAR_5[VAR_7] = 0; VAR_8 = strtol(VAR_5, &VAR_9, VAR_3); if (VAR_9 == VAR_5 || *VAR_9 != '\n') { VAR_7 = -1; } else if ((VAR_8 == LONG_MIN || VAR_8 == LONG_MAX) && errno == ERANGE) { VAR_7 = -errno; } else { VAR_7 = 0; *VAR_2 = VAR_8; } out: close(VAR_6); return VAR_7; }
[ "static int FUNC_0(XenHostPCIDevice *VAR_0, const char *VAR_1,\nunsigned int *VAR_2, int VAR_3)\n{", "char VAR_4[PATH_MAX];", "char VAR_5[XEN_HOST_PCI_GET_VALUE_BUFFER_SIZE];", "int VAR_6, VAR_7;", "unsigned long VAR_8;", "char *VAR_9;", "VAR_7 = xen_host_pci_sysfs_path(VAR_0, VAR_1, VAR_4, sizeof (VAR_4));", "if (VAR_7) {", "return VAR_7;", "}", "VAR_6 = open(VAR_4, O_RDONLY);", "if (VAR_6 == -1) {", "XEN_HOST_PCI_LOG(\"Error: Can't open %s: %s\\n\", VAR_4, strerror(errno));", "return -errno;", "}", "do {", "VAR_7 = read(VAR_6, &VAR_5, sizeof (VAR_5) - 1);", "if (VAR_7 < 0 && errno != EINTR) {", "VAR_7 = -errno;", "goto out;", "}", "} while (VAR_7 < 0);", "VAR_5[VAR_7] = 0;", "VAR_8 = strtol(VAR_5, &VAR_9, VAR_3);", "if (VAR_9 == VAR_5 || *VAR_9 != '\\n') {", "VAR_7 = -1;", "} else if ((VAR_8 == LONG_MIN || VAR_8 == LONG_MAX) && errno == ERANGE) {", "VAR_7 = -errno;", "} else {", "VAR_7 = 0;", "*VAR_2 = VAR_8;", "}", "out:\nclose(VAR_6);", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ] ]
12,238
static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) { ebml_master metaseek, seekentry; int64_t currentpos; int i; currentpos = avio_tell(pb); if (seekhead->reserved_size > 0) if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0) return -1; metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size); for (i = 0; i < seekhead->num_entries; i++) { mkv_seekhead_entry *entry = &seekhead->entries[i]; seekentry = start_ebml_master(pb, MATROSKA_ID_SEEKENTRY, MAX_SEEKENTRY_SIZE); put_ebml_id(pb, MATROSKA_ID_SEEKID); put_ebml_num(pb, ebml_id_size(entry->elementid), 0); put_ebml_id(pb, entry->elementid); put_ebml_uint(pb, MATROSKA_ID_SEEKPOSITION, entry->segmentpos); end_ebml_master(pb, seekentry); } end_ebml_master(pb, metaseek); if (seekhead->reserved_size > 0) { uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb); put_ebml_void(pb, remaining); avio_seek(pb, currentpos, SEEK_SET); currentpos = seekhead->filepos; } av_free(seekhead->entries); av_free(seekhead); return currentpos; }
true
FFmpeg
44729bc0204fd8bdc29c234fc663229e44420b09
static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) { ebml_master metaseek, seekentry; int64_t currentpos; int i; currentpos = avio_tell(pb); if (seekhead->reserved_size > 0) if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0) return -1; metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size); for (i = 0; i < seekhead->num_entries; i++) { mkv_seekhead_entry *entry = &seekhead->entries[i]; seekentry = start_ebml_master(pb, MATROSKA_ID_SEEKENTRY, MAX_SEEKENTRY_SIZE); put_ebml_id(pb, MATROSKA_ID_SEEKID); put_ebml_num(pb, ebml_id_size(entry->elementid), 0); put_ebml_id(pb, entry->elementid); put_ebml_uint(pb, MATROSKA_ID_SEEKPOSITION, entry->segmentpos); end_ebml_master(pb, seekentry); } end_ebml_master(pb, metaseek); if (seekhead->reserved_size > 0) { uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb); put_ebml_void(pb, remaining); avio_seek(pb, currentpos, SEEK_SET); currentpos = seekhead->filepos; } av_free(seekhead->entries); av_free(seekhead); return currentpos; }
{ "code": [ " if (seekhead->reserved_size > 0)", " if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0)", " return -1;" ], "line_no": [ 17, 19, 21 ] }
static int64_t FUNC_0(AVIOContext *pb, mkv_seekhead *seekhead) { ebml_master metaseek, seekentry; int64_t currentpos; int VAR_0; currentpos = avio_tell(pb); if (seekhead->reserved_size > 0) if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0) return -1; metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size); for (VAR_0 = 0; VAR_0 < seekhead->num_entries; VAR_0++) { mkv_seekhead_entry *entry = &seekhead->entries[VAR_0]; seekentry = start_ebml_master(pb, MATROSKA_ID_SEEKENTRY, MAX_SEEKENTRY_SIZE); put_ebml_id(pb, MATROSKA_ID_SEEKID); put_ebml_num(pb, ebml_id_size(entry->elementid), 0); put_ebml_id(pb, entry->elementid); put_ebml_uint(pb, MATROSKA_ID_SEEKPOSITION, entry->segmentpos); end_ebml_master(pb, seekentry); } end_ebml_master(pb, metaseek); if (seekhead->reserved_size > 0) { uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb); put_ebml_void(pb, remaining); avio_seek(pb, currentpos, SEEK_SET); currentpos = seekhead->filepos; } av_free(seekhead->entries); av_free(seekhead); return currentpos; }
[ "static int64_t FUNC_0(AVIOContext *pb, mkv_seekhead *seekhead)\n{", "ebml_master metaseek, seekentry;", "int64_t currentpos;", "int VAR_0;", "currentpos = avio_tell(pb);", "if (seekhead->reserved_size > 0)\nif (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0)\nreturn -1;", "metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size);", "for (VAR_0 = 0; VAR_0 < seekhead->num_entries; VAR_0++) {", "mkv_seekhead_entry *entry = &seekhead->entries[VAR_0];", "seekentry = start_ebml_master(pb, MATROSKA_ID_SEEKENTRY, MAX_SEEKENTRY_SIZE);", "put_ebml_id(pb, MATROSKA_ID_SEEKID);", "put_ebml_num(pb, ebml_id_size(entry->elementid), 0);", "put_ebml_id(pb, entry->elementid);", "put_ebml_uint(pb, MATROSKA_ID_SEEKPOSITION, entry->segmentpos);", "end_ebml_master(pb, seekentry);", "}", "end_ebml_master(pb, metaseek);", "if (seekhead->reserved_size > 0) {", "uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb);", "put_ebml_void(pb, remaining);", "avio_seek(pb, currentpos, SEEK_SET);", "currentpos = seekhead->filepos;", "}", "av_free(seekhead->entries);", "av_free(seekhead);", "return currentpos;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17, 19, 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ] ]
12,239
static int wavpack_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { WavpackContext *s = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int frame_size; int samplecount = 0; s->block = 0; s->samples_left = 0; s->ch_offset = 0; if(s->mkv_mode){ s->samples = AV_RL32(buf); buf += 4; } while(buf_size > 0){ if(!s->multichannel){ frame_size = buf_size; }else{ if(!s->mkv_mode){ frame_size = AV_RL32(buf) - 12; buf += 4; buf_size -= 4; }else{ if(buf_size < 12) //MKV files can have zero flags after last block break; frame_size = AV_RL32(buf + 8) + 12; } } if(frame_size < 0 || frame_size > buf_size){ av_log(avctx, AV_LOG_ERROR, "Block %d has invalid size (size %d vs. %d bytes left)\n", s->block, frame_size, buf_size); return -1; } if((samplecount = wavpack_decode_block(avctx, s->block, data, data_size, buf, frame_size)) < 0) return -1; s->block++; buf += frame_size; buf_size -= frame_size; } *data_size = samplecount * avctx->channels; return s->samples_left > 0 ? 0 : avpkt->size; }
true
FFmpeg
c2a016ad4d9c29285813ba5806189e63e063e0fb
static int wavpack_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { WavpackContext *s = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int frame_size; int samplecount = 0; s->block = 0; s->samples_left = 0; s->ch_offset = 0; if(s->mkv_mode){ s->samples = AV_RL32(buf); buf += 4; } while(buf_size > 0){ if(!s->multichannel){ frame_size = buf_size; }else{ if(!s->mkv_mode){ frame_size = AV_RL32(buf) - 12; buf += 4; buf_size -= 4; }else{ if(buf_size < 12) break; frame_size = AV_RL32(buf + 8) + 12; } } if(frame_size < 0 || frame_size > buf_size){ av_log(avctx, AV_LOG_ERROR, "Block %d has invalid size (size %d vs. %d bytes left)\n", s->block, frame_size, buf_size); return -1; } if((samplecount = wavpack_decode_block(avctx, s->block, data, data_size, buf, frame_size)) < 0) return -1; s->block++; buf += frame_size; buf_size -= frame_size; } *data_size = samplecount * avctx->channels; return s->samples_left > 0 ? 0 : avpkt->size; }
{ "code": [ " data_size, buf, frame_size)) < 0)", " WavpackContext *s = avctx->priv_data;" ], "line_no": [ 71, 9 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { WavpackContext *s = VAR_0->priv_data; const uint8_t *VAR_4 = VAR_3->VAR_1; int VAR_5 = VAR_3->size; int VAR_6; int VAR_7 = 0; s->block = 0; s->samples_left = 0; s->ch_offset = 0; if(s->mkv_mode){ s->samples = AV_RL32(VAR_4); VAR_4 += 4; } while(VAR_5 > 0){ if(!s->multichannel){ VAR_6 = VAR_5; }else{ if(!s->mkv_mode){ VAR_6 = AV_RL32(VAR_4) - 12; VAR_4 += 4; VAR_5 -= 4; }else{ if(VAR_5 < 12) break; VAR_6 = AV_RL32(VAR_4 + 8) + 12; } } if(VAR_6 < 0 || VAR_6 > VAR_5){ av_log(VAR_0, AV_LOG_ERROR, "Block %d has invalid size (size %d vs. %d bytes left)\n", s->block, VAR_6, VAR_5); return -1; } if((VAR_7 = wavpack_decode_block(VAR_0, s->block, VAR_1, VAR_2, VAR_4, VAR_6)) < 0) return -1; s->block++; VAR_4 += VAR_6; VAR_5 -= VAR_6; } *VAR_2 = VAR_7 * VAR_0->channels; return s->samples_left > 0 ? 0 : VAR_3->size; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "WavpackContext *s = VAR_0->priv_data;", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "int VAR_6;", "int VAR_7 = 0;", "s->block = 0;", "s->samples_left = 0;", "s->ch_offset = 0;", "if(s->mkv_mode){", "s->samples = AV_RL32(VAR_4); VAR_4 += 4;", "}", "while(VAR_5 > 0){", "if(!s->multichannel){", "VAR_6 = VAR_5;", "}else{", "if(!s->mkv_mode){", "VAR_6 = AV_RL32(VAR_4) - 12; VAR_4 += 4; VAR_5 -= 4;", "}else{", "if(VAR_5 < 12)\nbreak;", "VAR_6 = AV_RL32(VAR_4 + 8) + 12;", "}", "}", "if(VAR_6 < 0 || VAR_6 > VAR_5){", "av_log(VAR_0, AV_LOG_ERROR, \"Block %d has invalid size (size %d vs. %d bytes left)\\n\",\ns->block, VAR_6, VAR_5);", "return -1;", "}", "if((VAR_7 = wavpack_decode_block(VAR_0, s->block, VAR_1,\nVAR_2, VAR_4, VAR_6)) < 0)\nreturn -1;", "s->block++;", "VAR_4 += VAR_6; VAR_5 -= VAR_6;", "}", "*VAR_2 = VAR_7 * VAR_0->channels;", "return s->samples_left > 0 ? 0 : VAR_3->size;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69, 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ] ]
12,240
static int get_bits(J2kDecoderContext *s, int n) { int res = 0; if (s->buf_end - s->buf < ((n - s->bit_index) >> 8)) return AVERROR(EINVAL); while (--n >= 0){ res <<= 1; if (s->bit_index == 0){ s->bit_index = 7 + (*s->buf != 0xff); s->buf++; } s->bit_index--; res |= (*s->buf >> s->bit_index) & 1; } return res; }
true
FFmpeg
ddfa3751c092feaf1e080f66587024689dfe603c
static int get_bits(J2kDecoderContext *s, int n) { int res = 0; if (s->buf_end - s->buf < ((n - s->bit_index) >> 8)) return AVERROR(EINVAL); while (--n >= 0){ res <<= 1; if (s->bit_index == 0){ s->bit_index = 7 + (*s->buf != 0xff); s->buf++; } s->bit_index--; res |= (*s->buf >> s->bit_index) & 1; } return res; }
{ "code": [ " if (s->buf_end - s->buf < ((n - s->bit_index) >> 8))", " return AVERROR(EINVAL);", " if (s->bit_index == 0){", " s->bit_index = 7 + (*s->buf != 0xff);", " s->buf++;", " res |= (*s->buf >> s->bit_index) & 1;" ], "line_no": [ 7, 9, 15, 17, 19, 25 ] }
static int FUNC_0(J2kDecoderContext *VAR_0, int VAR_1) { int VAR_2 = 0; if (VAR_0->buf_end - VAR_0->buf < ((VAR_1 - VAR_0->bit_index) >> 8)) return AVERROR(EINVAL); while (--VAR_1 >= 0){ VAR_2 <<= 1; if (VAR_0->bit_index == 0){ VAR_0->bit_index = 7 + (*VAR_0->buf != 0xff); VAR_0->buf++; } VAR_0->bit_index--; VAR_2 |= (*VAR_0->buf >> VAR_0->bit_index) & 1; } return VAR_2; }
[ "static int FUNC_0(J2kDecoderContext *VAR_0, int VAR_1)\n{", "int VAR_2 = 0;", "if (VAR_0->buf_end - VAR_0->buf < ((VAR_1 - VAR_0->bit_index) >> 8))\nreturn AVERROR(EINVAL);", "while (--VAR_1 >= 0){", "VAR_2 <<= 1;", "if (VAR_0->bit_index == 0){", "VAR_0->bit_index = 7 + (*VAR_0->buf != 0xff);", "VAR_0->buf++;", "}", "VAR_0->bit_index--;", "VAR_2 |= (*VAR_0->buf >> VAR_0->bit_index) & 1;", "}", "return VAR_2;", "}" ]
[ 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
12,241
static uint32_t drc_set_usable(sPAPRDRConnector *drc) { /* if there's no resource/device associated with the DRC, there's * no way for us to put it in an allocation state consistent with * being 'USABLE'. PAPR 2.7, 13.5.3.4 documents that this should * result in an RTAS return code of -3 / "no such indicator" */ if (!drc->dev) { return RTAS_OUT_NO_SUCH_INDICATOR; } if (drc->awaiting_release && drc->awaiting_allocation) { /* kernel is acknowledging a previous hotplug event * while we are already removing it. * it's safe to ignore awaiting_allocation here since we know the * situation is predicated on the guest either already having done * so (boot-time hotplug), or never being able to acquire in the * first place (hotplug followed by immediate unplug). */ return RTAS_OUT_NO_SUCH_INDICATOR; } drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_USABLE; drc->awaiting_allocation = false; return RTAS_OUT_SUCCESS; }
true
qemu
82a93a1d307064f35c363f79b04b0a0149ac53d9
static uint32_t drc_set_usable(sPAPRDRConnector *drc) { if (!drc->dev) { return RTAS_OUT_NO_SUCH_INDICATOR; } if (drc->awaiting_release && drc->awaiting_allocation) { return RTAS_OUT_NO_SUCH_INDICATOR; } drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_USABLE; drc->awaiting_allocation = false; return RTAS_OUT_SUCCESS; }
{ "code": [ " if (drc->awaiting_release && drc->awaiting_allocation) {", " drc->awaiting_allocation = false;", " drc->awaiting_allocation = false;" ], "line_no": [ 21, 45, 45 ] }
static uint32_t FUNC_0(sPAPRDRConnector *drc) { if (!drc->dev) { return RTAS_OUT_NO_SUCH_INDICATOR; } if (drc->awaiting_release && drc->awaiting_allocation) { return RTAS_OUT_NO_SUCH_INDICATOR; } drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_USABLE; drc->awaiting_allocation = false; return RTAS_OUT_SUCCESS; }
[ "static uint32_t FUNC_0(sPAPRDRConnector *drc)\n{", "if (!drc->dev) {", "return RTAS_OUT_NO_SUCH_INDICATOR;", "}", "if (drc->awaiting_release && drc->awaiting_allocation) {", "return RTAS_OUT_NO_SUCH_INDICATOR;", "}", "drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_USABLE;", "drc->awaiting_allocation = false;", "return RTAS_OUT_SUCCESS;", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ] ]
12,242
static ssize_t qcow2_crypto_hdr_init_func(QCryptoBlock *block, size_t headerlen, void *opaque, Error **errp) { BlockDriverState *bs = opaque; BDRVQcow2State *s = bs->opaque; int64_t ret; int64_t clusterlen; ret = qcow2_alloc_clusters(bs, headerlen); if (ret < 0) { error_setg_errno(errp, -ret, "Cannot allocate cluster for LUKS header size %zu", headerlen); return -1; } s->crypto_header.length = headerlen; s->crypto_header.offset = ret; /* Zero fill remaining space in cluster so it has predictable * content in case of future spec changes */ clusterlen = size_to_clusters(s, headerlen) * s->cluster_size; ret = bdrv_pwrite_zeroes(bs->file, ret + headerlen, clusterlen - headerlen, 0); if (ret < 0) { error_setg_errno(errp, -ret, "Could not zero fill encryption header"); return -1; } return ret; }
true
qemu
c9b83e9c23ecb094ddf987c7c37b8f454cb80615
static ssize_t qcow2_crypto_hdr_init_func(QCryptoBlock *block, size_t headerlen, void *opaque, Error **errp) { BlockDriverState *bs = opaque; BDRVQcow2State *s = bs->opaque; int64_t ret; int64_t clusterlen; ret = qcow2_alloc_clusters(bs, headerlen); if (ret < 0) { error_setg_errno(errp, -ret, "Cannot allocate cluster for LUKS header size %zu", headerlen); return -1; } s->crypto_header.length = headerlen; s->crypto_header.offset = ret; clusterlen = size_to_clusters(s, headerlen) * s->cluster_size; ret = bdrv_pwrite_zeroes(bs->file, ret + headerlen, clusterlen - headerlen, 0); if (ret < 0) { error_setg_errno(errp, -ret, "Could not zero fill encryption header"); return -1; } return ret; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(QCryptoBlock *block, size_t headerlen, void *opaque, Error **errp) { BlockDriverState *bs = opaque; BDRVQcow2State *s = bs->opaque; int64_t ret; int64_t clusterlen; ret = qcow2_alloc_clusters(bs, headerlen); if (ret < 0) { error_setg_errno(errp, -ret, "Cannot allocate cluster for LUKS header size %zu", headerlen); return -1; } s->crypto_header.length = headerlen; s->crypto_header.offset = ret; clusterlen = size_to_clusters(s, headerlen) * s->cluster_size; ret = bdrv_pwrite_zeroes(bs->file, ret + headerlen, clusterlen - headerlen, 0); if (ret < 0) { error_setg_errno(errp, -ret, "Could not zero fill encryption header"); return -1; } return ret; }
[ "static ssize_t FUNC_0(QCryptoBlock *block, size_t headerlen,\nvoid *opaque, Error **errp)\n{", "BlockDriverState *bs = opaque;", "BDRVQcow2State *s = bs->opaque;", "int64_t ret;", "int64_t clusterlen;", "ret = qcow2_alloc_clusters(bs, headerlen);", "if (ret < 0) {", "error_setg_errno(errp, -ret,\n\"Cannot allocate cluster for LUKS header size %zu\",\nheaderlen);", "return -1;", "}", "s->crypto_header.length = headerlen;", "s->crypto_header.offset = ret;", "clusterlen = size_to_clusters(s, headerlen) * s->cluster_size;", "ret = bdrv_pwrite_zeroes(bs->file,\nret + headerlen,\nclusterlen - headerlen, 0);", "if (ret < 0) {", "error_setg_errno(errp, -ret, \"Could not zero fill encryption header\");", "return -1;", "}", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21, 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 43 ], [ 46, 48, 50 ], [ 52 ], [ 54 ], [ 56 ], [ 58 ], [ 62 ], [ 64 ] ]
12,244
static int get_cookies(HTTPContext *s, char **cookies, const char *path, const char *domain) { // cookie strings will look like Set-Cookie header field values. Multiple // Set-Cookie fields will result in multiple values delimited by a newline int ret = 0; char *next, *cookie, *set_cookies = av_strdup(s->cookies), *cset_cookies = set_cookies; if (!set_cookies) return AVERROR(EINVAL); *cookies = NULL; while ((cookie = av_strtok(set_cookies, "\n", &next))) { int domain_offset = 0; char *param, *next_param, *cdomain = NULL, *cpath = NULL, *cvalue = NULL; set_cookies = NULL; while ((param = av_strtok(cookie, "; ", &next_param))) { cookie = NULL; if (!av_strncasecmp("path=", param, 5)) { cpath = av_strdup(&param[5]); } else if (!av_strncasecmp("domain=", param, 7)) { cdomain = av_strdup(&param[7]); } else if (!av_strncasecmp("secure", param, 6) || !av_strncasecmp("comment", param, 7) || !av_strncasecmp("max-age", param, 7) || !av_strncasecmp("version", param, 7)) { // ignore Comment, Max-Age, Secure and Version } else { av_free(cvalue); cvalue = av_strdup(param); } } // ensure all of the necessary values are valid if (!cdomain || !cpath || !cvalue) { av_log(s, AV_LOG_WARNING, "Invalid cookie found, no value, path or domain specified\n"); goto done_cookie; } // check if the request path matches the cookie path if (av_strncasecmp(path, cpath, strlen(cpath))) goto done_cookie; // the domain should be at least the size of our cookie domain domain_offset = strlen(domain) - strlen(cdomain); if (domain_offset < 0) goto done_cookie; // match the cookie domain if (av_strcasecmp(&domain[domain_offset], cdomain)) goto done_cookie; // cookie parameters match, so copy the value if (!*cookies) { if (!(*cookies = av_strdup(cvalue))) { ret = AVERROR(ENOMEM); goto done_cookie; } } else { char *tmp = *cookies; size_t str_size = strlen(cvalue) + strlen(*cookies) + 3; if (!(*cookies = av_malloc(str_size))) { ret = AVERROR(ENOMEM); goto done_cookie; } snprintf(*cookies, str_size, "%s; %s", tmp, cvalue); av_free(tmp); } done_cookie: av_free(cvalue); if (ret < 0) { if (*cookies) av_freep(cookies); av_free(cset_cookies); return ret; } } av_free(cset_cookies); return 0; }
true
FFmpeg
c8ea5ccd5db125e24d46c74339c64f9527d7a72e
static int get_cookies(HTTPContext *s, char **cookies, const char *path, const char *domain) { int ret = 0; char *next, *cookie, *set_cookies = av_strdup(s->cookies), *cset_cookies = set_cookies; if (!set_cookies) return AVERROR(EINVAL); *cookies = NULL; while ((cookie = av_strtok(set_cookies, "\n", &next))) { int domain_offset = 0; char *param, *next_param, *cdomain = NULL, *cpath = NULL, *cvalue = NULL; set_cookies = NULL; while ((param = av_strtok(cookie, "; ", &next_param))) { cookie = NULL; if (!av_strncasecmp("path=", param, 5)) { cpath = av_strdup(&param[5]); } else if (!av_strncasecmp("domain=", param, 7)) { cdomain = av_strdup(&param[7]); } else if (!av_strncasecmp("secure", param, 6) || !av_strncasecmp("comment", param, 7) || !av_strncasecmp("max-age", param, 7) || !av_strncasecmp("version", param, 7)) { } else { av_free(cvalue); cvalue = av_strdup(param); } } if (!cdomain || !cpath || !cvalue) { av_log(s, AV_LOG_WARNING, "Invalid cookie found, no value, path or domain specified\n"); goto done_cookie; } if (av_strncasecmp(path, cpath, strlen(cpath))) goto done_cookie; domain_offset = strlen(domain) - strlen(cdomain); if (domain_offset < 0) goto done_cookie; if (av_strcasecmp(&domain[domain_offset], cdomain)) goto done_cookie; if (!*cookies) { if (!(*cookies = av_strdup(cvalue))) { ret = AVERROR(ENOMEM); goto done_cookie; } } else { char *tmp = *cookies; size_t str_size = strlen(cvalue) + strlen(*cookies) + 3; if (!(*cookies = av_malloc(str_size))) { ret = AVERROR(ENOMEM); goto done_cookie; } snprintf(*cookies, str_size, "%s; %s", tmp, cvalue); av_free(tmp); } done_cookie: av_free(cvalue); if (ret < 0) { if (*cookies) av_freep(cookies); av_free(cset_cookies); return ret; } } av_free(cset_cookies); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(HTTPContext *VAR_0, char **VAR_1, const char *VAR_2, const char *VAR_3) { int VAR_4 = 0; char *VAR_5, *VAR_6, *VAR_7 = av_strdup(VAR_0->VAR_1), *VAR_8 = VAR_7; if (!VAR_7) return AVERROR(EINVAL); *VAR_1 = NULL; while ((VAR_6 = av_strtok(VAR_7, "\n", &VAR_5))) { int VAR_9 = 0; char *VAR_10, *VAR_11, *VAR_12 = NULL, *VAR_13 = NULL, *VAR_14 = NULL; VAR_7 = NULL; while ((VAR_10 = av_strtok(VAR_6, "; ", &VAR_11))) { VAR_6 = NULL; if (!av_strncasecmp("VAR_2=", VAR_10, 5)) { VAR_13 = av_strdup(&VAR_10[5]); } else if (!av_strncasecmp("VAR_3=", VAR_10, 7)) { VAR_12 = av_strdup(&VAR_10[7]); } else if (!av_strncasecmp("secure", VAR_10, 6) || !av_strncasecmp("comment", VAR_10, 7) || !av_strncasecmp("max-age", VAR_10, 7) || !av_strncasecmp("version", VAR_10, 7)) { } else { av_free(VAR_14); VAR_14 = av_strdup(VAR_10); } } if (!VAR_12 || !VAR_13 || !VAR_14) { av_log(VAR_0, AV_LOG_WARNING, "Invalid VAR_6 found, no value, VAR_2 or VAR_3 specified\n"); goto done_cookie; } if (av_strncasecmp(VAR_2, VAR_13, strlen(VAR_13))) goto done_cookie; VAR_9 = strlen(VAR_3) - strlen(VAR_12); if (VAR_9 < 0) goto done_cookie; if (av_strcasecmp(&VAR_3[VAR_9], VAR_12)) goto done_cookie; if (!*VAR_1) { if (!(*VAR_1 = av_strdup(VAR_14))) { VAR_4 = AVERROR(ENOMEM); goto done_cookie; } } else { char *VAR_15 = *VAR_1; size_t str_size = strlen(VAR_14) + strlen(*VAR_1) + 3; if (!(*VAR_1 = av_malloc(str_size))) { VAR_4 = AVERROR(ENOMEM); goto done_cookie; } snprintf(*VAR_1, str_size, "%VAR_0; %VAR_0", VAR_15, VAR_14); av_free(VAR_15); } done_cookie: av_free(VAR_14); if (VAR_4 < 0) { if (*VAR_1) av_freep(VAR_1); av_free(VAR_8); return VAR_4; } } av_free(VAR_8); return 0; }
[ "static int FUNC_0(HTTPContext *VAR_0, char **VAR_1, const char *VAR_2,\nconst char *VAR_3)\n{", "int VAR_4 = 0;", "char *VAR_5, *VAR_6, *VAR_7 = av_strdup(VAR_0->VAR_1), *VAR_8 = VAR_7;", "if (!VAR_7) return AVERROR(EINVAL);", "*VAR_1 = NULL;", "while ((VAR_6 = av_strtok(VAR_7, \"\\n\", &VAR_5))) {", "int VAR_9 = 0;", "char *VAR_10, *VAR_11, *VAR_12 = NULL, *VAR_13 = NULL, *VAR_14 = NULL;", "VAR_7 = NULL;", "while ((VAR_10 = av_strtok(VAR_6, \"; \", &VAR_11))) {", "VAR_6 = NULL;", "if (!av_strncasecmp(\"VAR_2=\", VAR_10, 5)) {", "VAR_13 = av_strdup(&VAR_10[5]);", "} else if (!av_strncasecmp(\"VAR_3=\", VAR_10, 7)) {", "VAR_12 = av_strdup(&VAR_10[7]);", "} else if (!av_strncasecmp(\"secure\", VAR_10, 6) ||", "!av_strncasecmp(\"comment\", VAR_10, 7) ||\n!av_strncasecmp(\"max-age\", VAR_10, 7) ||\n!av_strncasecmp(\"version\", VAR_10, 7)) {", "} else {", "av_free(VAR_14);", "VAR_14 = av_strdup(VAR_10);", "}", "}", "if (!VAR_12 || !VAR_13 || !VAR_14) {", "av_log(VAR_0, AV_LOG_WARNING,\n\"Invalid VAR_6 found, no value, VAR_2 or VAR_3 specified\\n\");", "goto done_cookie;", "}", "if (av_strncasecmp(VAR_2, VAR_13, strlen(VAR_13)))\ngoto done_cookie;", "VAR_9 = strlen(VAR_3) - strlen(VAR_12);", "if (VAR_9 < 0)\ngoto done_cookie;", "if (av_strcasecmp(&VAR_3[VAR_9], VAR_12))\ngoto done_cookie;", "if (!*VAR_1) {", "if (!(*VAR_1 = av_strdup(VAR_14))) {", "VAR_4 = AVERROR(ENOMEM);", "goto done_cookie;", "}", "} else {", "char *VAR_15 = *VAR_1;", "size_t str_size = strlen(VAR_14) + strlen(*VAR_1) + 3;", "if (!(*VAR_1 = av_malloc(str_size))) {", "VAR_4 = AVERROR(ENOMEM);", "goto done_cookie;", "}", "snprintf(*VAR_1, str_size, \"%VAR_0; %VAR_0\", VAR_15, VAR_14);", "av_free(VAR_15);", "}", "done_cookie:\nav_free(VAR_14);", "if (VAR_4 < 0) {", "if (*VAR_1) av_freep(VAR_1);", "av_free(VAR_8);", "return VAR_4;", "}", "}", "av_free(VAR_8);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 11 ], [ 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 40 ], [ 42 ], [ 45 ], [ 47 ], [ 49, 51, 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 85, 87 ], [ 93 ], [ 95, 97 ], [ 103, 105 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 167 ], [ 169 ] ]
12,246
static inline void xan_wc3_copy_pixel_run(XanContext *s, int x, int y, int pixel_count, int motion_x, int motion_y) { int stride; int line_inc; int curframe_index, prevframe_index; int curframe_x, prevframe_x; int width = s->avctx->width; unsigned char *palette_plane, *prev_palette_plane; palette_plane = s->current_frame.data[0]; prev_palette_plane = s->last_frame.data[0]; stride = s->current_frame.linesize[0]; line_inc = stride - width; curframe_index = y * stride + x; curframe_x = x; prevframe_index = (y + motion_y) * stride + x + motion_x; prevframe_x = x + motion_x; while(pixel_count && (curframe_index < s->frame_size)) { int count = FFMIN3(pixel_count, width - curframe_x, width - prevframe_x); memcpy(palette_plane + curframe_index, prev_palette_plane + prevframe_index, count); pixel_count -= count; curframe_index += count; prevframe_index += count; curframe_x += count; prevframe_x += count; if (curframe_x >= width) { curframe_index += line_inc; curframe_x = 0; } if (prevframe_x >= width) { prevframe_index += line_inc; prevframe_x = 0; } } }
true
FFmpeg
19e95b88459e879d3e67a66350d937c32ed762ca
static inline void xan_wc3_copy_pixel_run(XanContext *s, int x, int y, int pixel_count, int motion_x, int motion_y) { int stride; int line_inc; int curframe_index, prevframe_index; int curframe_x, prevframe_x; int width = s->avctx->width; unsigned char *palette_plane, *prev_palette_plane; palette_plane = s->current_frame.data[0]; prev_palette_plane = s->last_frame.data[0]; stride = s->current_frame.linesize[0]; line_inc = stride - width; curframe_index = y * stride + x; curframe_x = x; prevframe_index = (y + motion_y) * stride + x + motion_x; prevframe_x = x + motion_x; while(pixel_count && (curframe_index < s->frame_size)) { int count = FFMIN3(pixel_count, width - curframe_x, width - prevframe_x); memcpy(palette_plane + curframe_index, prev_palette_plane + prevframe_index, count); pixel_count -= count; curframe_index += count; prevframe_index += count; curframe_x += count; prevframe_x += count; if (curframe_x >= width) { curframe_index += line_inc; curframe_x = 0; } if (prevframe_x >= width) { prevframe_index += line_inc; prevframe_x = 0; } } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(XanContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5) { int VAR_6; int VAR_7; int VAR_8, VAR_9; int VAR_10, VAR_11; int VAR_12 = VAR_0->avctx->VAR_12; unsigned char *VAR_13, *VAR_14; VAR_13 = VAR_0->current_frame.data[0]; VAR_14 = VAR_0->last_frame.data[0]; VAR_6 = VAR_0->current_frame.linesize[0]; VAR_7 = VAR_6 - VAR_12; VAR_8 = VAR_2 * VAR_6 + VAR_1; VAR_10 = VAR_1; VAR_9 = (VAR_2 + VAR_5) * VAR_6 + VAR_1 + VAR_4; VAR_11 = VAR_1 + VAR_4; while(VAR_3 && (VAR_8 < VAR_0->frame_size)) { int VAR_15 = FFMIN3(VAR_3, VAR_12 - VAR_10, VAR_12 - VAR_11); memcpy(VAR_13 + VAR_8, VAR_14 + VAR_9, VAR_15); VAR_3 -= VAR_15; VAR_8 += VAR_15; VAR_9 += VAR_15; VAR_10 += VAR_15; VAR_11 += VAR_15; if (VAR_10 >= VAR_12) { VAR_8 += VAR_7; VAR_10 = 0; } if (VAR_11 >= VAR_12) { VAR_9 += VAR_7; VAR_11 = 0; } } }
[ "static inline void FUNC_0(XanContext *VAR_0,\nint VAR_1, int VAR_2, int VAR_3, int VAR_4, int VAR_5)\n{", "int VAR_6;", "int VAR_7;", "int VAR_8, VAR_9;", "int VAR_10, VAR_11;", "int VAR_12 = VAR_0->avctx->VAR_12;", "unsigned char *VAR_13, *VAR_14;", "VAR_13 = VAR_0->current_frame.data[0];", "VAR_14 = VAR_0->last_frame.data[0];", "VAR_6 = VAR_0->current_frame.linesize[0];", "VAR_7 = VAR_6 - VAR_12;", "VAR_8 = VAR_2 * VAR_6 + VAR_1;", "VAR_10 = VAR_1;", "VAR_9 = (VAR_2 + VAR_5) * VAR_6 + VAR_1 + VAR_4;", "VAR_11 = VAR_1 + VAR_4;", "while(VAR_3 && (VAR_8 < VAR_0->frame_size)) {", "int VAR_15 = FFMIN3(VAR_3, VAR_12 - VAR_10, VAR_12 - VAR_11);", "memcpy(VAR_13 + VAR_8, VAR_14 + VAR_9, VAR_15);", "VAR_3 -= VAR_15;", "VAR_8 += VAR_15;", "VAR_9 += VAR_15;", "VAR_10 += VAR_15;", "VAR_11 += VAR_15;", "if (VAR_10 >= VAR_12) {", "VAR_8 += VAR_7;", "VAR_10 = 0;", "}", "if (VAR_11 >= VAR_12) {", "VAR_9 += VAR_7;", "VAR_11 = 0;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ] ]
12,247
pixman_format_code_t qemu_default_pixman_format(int bpp, bool native_endian) { if (native_endian) { switch (bpp) { case 15: return PIXMAN_x1r5g5b5; case 16: return PIXMAN_r5g6b5; case 24: return PIXMAN_r8g8b8; case 32: return PIXMAN_x8r8g8b8; } } else { switch (bpp) { case 24: return PIXMAN_b8g8r8; case 32: return PIXMAN_b8g8r8x8; break; } } g_assert_not_reached(); }
true
qemu
aca7aaf6287b6a9f688c1b115a76fdc056565a7e
pixman_format_code_t qemu_default_pixman_format(int bpp, bool native_endian) { if (native_endian) { switch (bpp) { case 15: return PIXMAN_x1r5g5b5; case 16: return PIXMAN_r5g6b5; case 24: return PIXMAN_r8g8b8; case 32: return PIXMAN_x8r8g8b8; } } else { switch (bpp) { case 24: return PIXMAN_b8g8r8; case 32: return PIXMAN_b8g8r8x8; break; } } g_assert_not_reached(); }
{ "code": [ " g_assert_not_reached();" ], "line_no": [ 45 ] }
pixman_format_code_t FUNC_0(int bpp, bool native_endian) { if (native_endian) { switch (bpp) { case 15: return PIXMAN_x1r5g5b5; case 16: return PIXMAN_r5g6b5; case 24: return PIXMAN_r8g8b8; case 32: return PIXMAN_x8r8g8b8; } } else { switch (bpp) { case 24: return PIXMAN_b8g8r8; case 32: return PIXMAN_b8g8r8x8; break; } } g_assert_not_reached(); }
[ "pixman_format_code_t FUNC_0(int bpp, bool native_endian)\n{", "if (native_endian) {", "switch (bpp) {", "case 15:\nreturn PIXMAN_x1r5g5b5;", "case 16:\nreturn PIXMAN_r5g6b5;", "case 24:\nreturn PIXMAN_r8g8b8;", "case 32:\nreturn PIXMAN_x8r8g8b8;", "}", "} else {", "switch (bpp) {", "case 24:\nreturn PIXMAN_b8g8r8;", "case 32:\nreturn PIXMAN_b8g8r8x8;", "break;", "}", "}", "g_assert_not_reached();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13, 15 ], [ 17, 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
12,248
static ssize_t handle_aiocb_rw_linear(RawPosixAIOData *aiocb, char *buf) { ssize_t offset = 0; ssize_t len; while (offset < aiocb->aio_nbytes) { if (aiocb->aio_type & QEMU_AIO_WRITE) { len = pwrite(aiocb->aio_fildes, (const char *)buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); } else { len = pread(aiocb->aio_fildes, buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); } if (len == -1 && errno == EINTR) { continue; } else if (len == -1) { offset = -errno; } else if (len == 0) { } offset += len; } return offset; }
true
qemu
61ed73cff427206b3a959b18a4877952f566279b
static ssize_t handle_aiocb_rw_linear(RawPosixAIOData *aiocb, char *buf) { ssize_t offset = 0; ssize_t len; while (offset < aiocb->aio_nbytes) { if (aiocb->aio_type & QEMU_AIO_WRITE) { len = pwrite(aiocb->aio_fildes, (const char *)buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); } else { len = pread(aiocb->aio_fildes, buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); } if (len == -1 && errno == EINTR) { continue; } else if (len == -1) { offset = -errno; } else if (len == 0) { } offset += len; } return offset; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(RawPosixAIOData *aiocb, char *buf) { ssize_t offset = 0; ssize_t len; while (offset < aiocb->aio_nbytes) { if (aiocb->aio_type & QEMU_AIO_WRITE) { len = pwrite(aiocb->aio_fildes, (const char *)buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); } else { len = pread(aiocb->aio_fildes, buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); } if (len == -1 && errno == EINTR) { continue; } else if (len == -1) { offset = -errno; } else if (len == 0) { } offset += len; } return offset; }
[ "static ssize_t FUNC_0(RawPosixAIOData *aiocb, char *buf)\n{", "ssize_t offset = 0;", "ssize_t len;", "while (offset < aiocb->aio_nbytes) {", "if (aiocb->aio_type & QEMU_AIO_WRITE) {", "len = pwrite(aiocb->aio_fildes,\n(const char *)buf + offset,\naiocb->aio_nbytes - offset,\naiocb->aio_offset + offset);", "} else {", "len = pread(aiocb->aio_fildes,\nbuf + offset,\naiocb->aio_nbytes - offset,\naiocb->aio_offset + offset);", "}", "if (len == -1 && errno == EINTR) {", "continue;", "} else if (len == -1) {", "offset = -errno;", "} else if (len == 0) {", "}", "offset += len;", "}", "return offset;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17, 19, 21 ], [ 23 ], [ 25, 27, 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 48 ], [ 50 ], [ 53 ], [ 56 ], [ 58 ], [ 60 ], [ 64 ], [ 66 ] ]
12,249
static inline int get_block(GetBitContext *gb, DCTELEM *block, const uint8_t *scan, const uint32_t *quant) { int coeff, i, n; int8_t ac; uint8_t dc = get_bits(gb, 8); // block not coded if (dc == 255) // number of non-zero coefficients coeff = get_bits(gb, 6); // normally we would only need to clear the (63 - coeff) last values, // but since we do not know where they are we just clear the whole block memset(block, 0, 64 * sizeof(DCTELEM)); // 2 bits per coefficient while (coeff) { ac = get_sbits(gb, 2); if (ac == -2) break; // continue with more bits PUT_COEFF(ac); } // 4 bits per coefficient ALIGN(4); if (get_bits_count(gb) + (coeff << 2) >= gb->size_in_bits) while (coeff) { ac = get_sbits(gb, 4); if (ac == -8) break; // continue with more bits PUT_COEFF(ac); } // 8 bits per coefficient ALIGN(8); if (get_bits_count(gb) + (coeff << 3) >= gb->size_in_bits) while (coeff) { ac = get_sbits(gb, 8); PUT_COEFF(ac); } PUT_COEFF(dc); return 1; }
true
FFmpeg
8d857c543402911f46ad38b093ab9aaf5b9a9a18
static inline int get_block(GetBitContext *gb, DCTELEM *block, const uint8_t *scan, const uint32_t *quant) { int coeff, i, n; int8_t ac; uint8_t dc = get_bits(gb, 8); if (dc == 255) coeff = get_bits(gb, 6); memset(block, 0, 64 * sizeof(DCTELEM)); while (coeff) { ac = get_sbits(gb, 2); if (ac == -2) break; PUT_COEFF(ac); } ALIGN(4); if (get_bits_count(gb) + (coeff << 2) >= gb->size_in_bits) while (coeff) { ac = get_sbits(gb, 4); if (ac == -8) break; PUT_COEFF(ac); } ALIGN(8); if (get_bits_count(gb) + (coeff << 3) >= gb->size_in_bits) while (coeff) { ac = get_sbits(gb, 8); PUT_COEFF(ac); } PUT_COEFF(dc); return 1; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(GetBitContext *VAR_0, DCTELEM *VAR_1, const uint8_t *VAR_2, const uint32_t *VAR_3) { int VAR_4, VAR_5, VAR_6; int8_t ac; uint8_t dc = get_bits(VAR_0, 8); if (dc == 255) VAR_4 = get_bits(VAR_0, 6); memset(VAR_1, 0, 64 * sizeof(DCTELEM)); while (VAR_4) { ac = get_sbits(VAR_0, 2); if (ac == -2) break; PUT_COEFF(ac); } ALIGN(4); if (get_bits_count(VAR_0) + (VAR_4 << 2) >= VAR_0->size_in_bits) while (VAR_4) { ac = get_sbits(VAR_0, 4); if (ac == -8) break; PUT_COEFF(ac); } ALIGN(8); if (get_bits_count(VAR_0) + (VAR_4 << 3) >= VAR_0->size_in_bits) while (VAR_4) { ac = get_sbits(VAR_0, 8); PUT_COEFF(ac); } PUT_COEFF(dc); return 1; }
[ "static inline int FUNC_0(GetBitContext *VAR_0, DCTELEM *VAR_1, const uint8_t *VAR_2,\nconst uint32_t *VAR_3) {", "int VAR_4, VAR_5, VAR_6;", "int8_t ac;", "uint8_t dc = get_bits(VAR_0, 8);", "if (dc == 255)\nVAR_4 = get_bits(VAR_0, 6);", "memset(VAR_1, 0, 64 * sizeof(DCTELEM));", "while (VAR_4) {", "ac = get_sbits(VAR_0, 2);", "if (ac == -2)\nbreak;", "PUT_COEFF(ac);", "}", "ALIGN(4);", "if (get_bits_count(VAR_0) + (VAR_4 << 2) >= VAR_0->size_in_bits)\nwhile (VAR_4) {", "ac = get_sbits(VAR_0, 4);", "if (ac == -8)\nbreak;", "PUT_COEFF(ac);", "}", "ALIGN(8);", "if (get_bits_count(VAR_0) + (VAR_4 << 3) >= VAR_0->size_in_bits)\nwhile (VAR_4) {", "ac = get_sbits(VAR_0, 8);", "PUT_COEFF(ac);", "}", "PUT_COEFF(dc);", "return 1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 7, 9 ], [ 12 ], [ 14 ], [ 15 ], [ 16, 17 ], [ 18 ], [ 19 ], [ 21 ], [ 22, 23 ], [ 24 ], [ 25, 26 ], [ 27 ], [ 28 ], [ 30 ], [ 31, 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ] ]
12,250
vcard_emul_find_vreader_from_slot(PK11SlotInfo *slot) { VReaderList *reader_list = vreader_get_reader_list(); VReaderListEntry *current_entry = NULL; if (reader_list == NULL) { return NULL; } for (current_entry = vreader_list_get_first(reader_list); current_entry; current_entry = vreader_list_get_next(current_entry)) { VReader *reader = vreader_list_get_reader(current_entry); VReaderEmul *reader_emul = vreader_get_private(reader); if (reader_emul->slot == slot) { return reader; } vreader_free(reader); } return NULL; }
true
qemu
124fe7fb1b7a1db8cb2ebb9edae84716ffaf37ce
vcard_emul_find_vreader_from_slot(PK11SlotInfo *slot) { VReaderList *reader_list = vreader_get_reader_list(); VReaderListEntry *current_entry = NULL; if (reader_list == NULL) { return NULL; } for (current_entry = vreader_list_get_first(reader_list); current_entry; current_entry = vreader_list_get_next(current_entry)) { VReader *reader = vreader_list_get_reader(current_entry); VReaderEmul *reader_emul = vreader_get_private(reader); if (reader_emul->slot == slot) { return reader; } vreader_free(reader); } return NULL; }
{ "code": [], "line_no": [] }
FUNC_0(PK11SlotInfo *VAR_0) { VReaderList *reader_list = vreader_get_reader_list(); VReaderListEntry *current_entry = NULL; if (reader_list == NULL) { return NULL; } for (current_entry = vreader_list_get_first(reader_list); current_entry; current_entry = vreader_list_get_next(current_entry)) { VReader *reader = vreader_list_get_reader(current_entry); VReaderEmul *reader_emul = vreader_get_private(reader); if (reader_emul->VAR_0 == VAR_0) { return reader; } vreader_free(reader); } return NULL; }
[ "FUNC_0(PK11SlotInfo *VAR_0)\n{", "VReaderList *reader_list = vreader_get_reader_list();", "VReaderListEntry *current_entry = NULL;", "if (reader_list == NULL) {", "return NULL;", "}", "for (current_entry = vreader_list_get_first(reader_list); current_entry;", "current_entry = vreader_list_get_next(current_entry)) {", "VReader *reader = vreader_list_get_reader(current_entry);", "VReaderEmul *reader_emul = vreader_get_private(reader);", "if (reader_emul->VAR_0 == VAR_0) {", "return reader;", "}", "vreader_free(reader);", "}", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 39 ], [ 41 ] ]
12,251
static int can_merge_formats(AVFilterFormats *a_arg, AVFilterFormats *b_arg, enum AVMediaType type, int is_sample_rate) { AVFilterFormats *a, *b, *ret; if (a == b) return 1; a = clone_filter_formats(a_arg); b = clone_filter_formats(b_arg); if (is_sample_rate) { ret = ff_merge_samplerates(a, b); } else { ret = ff_merge_formats(a, b, type); } if (ret) { av_freep(&ret->formats); av_freep(&ret); return 1; } else { av_freep(&a->formats); av_freep(&b->formats); av_freep(&a); av_freep(&b); return 0; } }
false
FFmpeg
6bde1e9d14ff1e0ecff74b8ff59607f545c6f2ec
static int can_merge_formats(AVFilterFormats *a_arg, AVFilterFormats *b_arg, enum AVMediaType type, int is_sample_rate) { AVFilterFormats *a, *b, *ret; if (a == b) return 1; a = clone_filter_formats(a_arg); b = clone_filter_formats(b_arg); if (is_sample_rate) { ret = ff_merge_samplerates(a, b); } else { ret = ff_merge_formats(a, b, type); } if (ret) { av_freep(&ret->formats); av_freep(&ret); return 1; } else { av_freep(&a->formats); av_freep(&b->formats); av_freep(&a); av_freep(&b); return 0; } }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFilterFormats *VAR_0, AVFilterFormats *VAR_1, enum AVMediaType VAR_2, int VAR_3) { AVFilterFormats *a, *b, *ret; if (a == b) return 1; a = clone_filter_formats(VAR_0); b = clone_filter_formats(VAR_1); if (VAR_3) { ret = ff_merge_samplerates(a, b); } else { ret = ff_merge_formats(a, b, VAR_2); } if (ret) { av_freep(&ret->formats); av_freep(&ret); return 1; } else { av_freep(&a->formats); av_freep(&b->formats); av_freep(&a); av_freep(&b); return 0; } }
[ "static int FUNC_0(AVFilterFormats *VAR_0,\nAVFilterFormats *VAR_1,\nenum AVMediaType VAR_2,\nint VAR_3)\n{", "AVFilterFormats *a, *b, *ret;", "if (a == b)\nreturn 1;", "a = clone_filter_formats(VAR_0);", "b = clone_filter_formats(VAR_1);", "if (VAR_3) {", "ret = ff_merge_samplerates(a, b);", "} else {", "ret = ff_merge_formats(a, b, VAR_2);", "}", "if (ret) {", "av_freep(&ret->formats);", "av_freep(&ret);", "return 1;", "} else {", "av_freep(&a->formats);", "av_freep(&b->formats);", "av_freep(&a);", "av_freep(&b);", "return 0;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
12,252
static int mxf_write_partition(AVFormatContext *s, int bodysid, int indexsid, const uint8_t *key, int write_metadata) { MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; int64_t header_byte_count_offset; unsigned index_byte_count = 0; uint64_t partition_offset = avio_tell(pb); int err; if (!mxf->edit_unit_byte_count && mxf->edit_units_count) index_byte_count = 85 + 12+(s->nb_streams+1)*6 + 12+mxf->edit_units_count*(11+mxf->slice_count*4); else if (mxf->edit_unit_byte_count && indexsid) index_byte_count = 80; if (index_byte_count) { // add encoded ber length index_byte_count += 16 + klv_ber_length(index_byte_count); index_byte_count += klv_fill_size(index_byte_count); } if (!memcmp(key, body_partition_key, 16)) { if ((err = av_reallocp_array(&mxf->body_partition_offset, mxf->body_partitions_count + 1, sizeof(*mxf->body_partition_offset))) < 0) { mxf->body_partitions_count = 0; return err; } mxf->body_partition_offset[mxf->body_partitions_count++] = partition_offset; } // write klv avio_write(pb, key, 16); klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count); // write partition value avio_wb16(pb, 1); // majorVersion avio_wb16(pb, 2); // minorVersion avio_wb32(pb, KAG_SIZE); // KAGSize avio_wb64(pb, partition_offset); // ThisPartition if (!memcmp(key, body_partition_key, 16) && mxf->body_partitions_count > 1) avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); // PreviousPartition else if (!memcmp(key, footer_partition_key, 16) && mxf->body_partitions_count) avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); // PreviousPartition else avio_wb64(pb, 0); avio_wb64(pb, mxf->footer_partition_offset); // footerPartition // set offset header_byte_count_offset = avio_tell(pb); avio_wb64(pb, 0); // headerByteCount, update later // indexTable avio_wb64(pb, index_byte_count); // indexByteCount avio_wb32(pb, index_byte_count ? indexsid : 0); // indexSID // BodyOffset if (bodysid && mxf->edit_units_count && mxf->body_partitions_count) { avio_wb64(pb, mxf->body_offset); } else avio_wb64(pb, 0); avio_wb32(pb, bodysid); // bodySID // operational pattern avio_write(pb, op1a_ul, 16); // essence container mxf_write_essence_container_refs(s); if (write_metadata) { // mark the start of the headermetadata and calculate metadata size int64_t pos, start; unsigned header_byte_count; mxf_write_klv_fill(s); start = avio_tell(s->pb); mxf_write_primer_pack(s); mxf_write_header_metadata_sets(s); pos = avio_tell(s->pb); header_byte_count = pos - start + klv_fill_size(pos); // update header_byte_count avio_seek(pb, header_byte_count_offset, SEEK_SET); avio_wb64(pb, header_byte_count); avio_seek(pb, pos, SEEK_SET); } avio_flush(pb); return 0; }
true
FFmpeg
7df3b426bbfbd7efd9a0f56393e3cc78413b0869
static int mxf_write_partition(AVFormatContext *s, int bodysid, int indexsid, const uint8_t *key, int write_metadata) { MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; int64_t header_byte_count_offset; unsigned index_byte_count = 0; uint64_t partition_offset = avio_tell(pb); int err; if (!mxf->edit_unit_byte_count && mxf->edit_units_count) index_byte_count = 85 + 12+(s->nb_streams+1)*6 + 12+mxf->edit_units_count*(11+mxf->slice_count*4); else if (mxf->edit_unit_byte_count && indexsid) index_byte_count = 80; if (index_byte_count) { index_byte_count += 16 + klv_ber_length(index_byte_count); index_byte_count += klv_fill_size(index_byte_count); } if (!memcmp(key, body_partition_key, 16)) { if ((err = av_reallocp_array(&mxf->body_partition_offset, mxf->body_partitions_count + 1, sizeof(*mxf->body_partition_offset))) < 0) { mxf->body_partitions_count = 0; return err; } mxf->body_partition_offset[mxf->body_partitions_count++] = partition_offset; } avio_write(pb, key, 16); klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count); avio_wb16(pb, 1); avio_wb16(pb, 2); avio_wb32(pb, KAG_SIZE); avio_wb64(pb, partition_offset); if (!memcmp(key, body_partition_key, 16) && mxf->body_partitions_count > 1) avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); else if (!memcmp(key, footer_partition_key, 16) && mxf->body_partitions_count) avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); else avio_wb64(pb, 0); avio_wb64(pb, mxf->footer_partition_offset); header_byte_count_offset = avio_tell(pb); avio_wb64(pb, 0); avio_wb64(pb, index_byte_count); avio_wb32(pb, index_byte_count ? indexsid : 0); if (bodysid && mxf->edit_units_count && mxf->body_partitions_count) { avio_wb64(pb, mxf->body_offset); } else avio_wb64(pb, 0); avio_wb32(pb, bodysid); avio_write(pb, op1a_ul, 16); mxf_write_essence_container_refs(s); if (write_metadata) { int64_t pos, start; unsigned header_byte_count; mxf_write_klv_fill(s); start = avio_tell(s->pb); mxf_write_primer_pack(s); mxf_write_header_metadata_sets(s); pos = avio_tell(s->pb); header_byte_count = pos - start + klv_fill_size(pos); avio_seek(pb, header_byte_count_offset, SEEK_SET); avio_wb64(pb, header_byte_count); avio_seek(pb, pos, SEEK_SET); } avio_flush(pb); return 0; }
{ "code": [ " klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count);" ], "line_no": [ 69 ] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int VAR_2, const uint8_t *VAR_3, int VAR_4) { MXFContext *mxf = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int64_t header_byte_count_offset; unsigned VAR_5 = 0; uint64_t partition_offset = avio_tell(pb); int VAR_6; if (!mxf->edit_unit_byte_count && mxf->edit_units_count) VAR_5 = 85 + 12+(VAR_0->nb_streams+1)*6 + 12+mxf->edit_units_count*(11+mxf->slice_count*4); else if (mxf->edit_unit_byte_count && VAR_2) VAR_5 = 80; if (VAR_5) { VAR_5 += 16 + klv_ber_length(VAR_5); VAR_5 += klv_fill_size(VAR_5); } if (!memcmp(VAR_3, body_partition_key, 16)) { if ((VAR_6 = av_reallocp_array(&mxf->body_partition_offset, mxf->body_partitions_count + 1, sizeof(*mxf->body_partition_offset))) < 0) { mxf->body_partitions_count = 0; return VAR_6; } mxf->body_partition_offset[mxf->body_partitions_count++] = partition_offset; } avio_write(pb, VAR_3, 16); klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count); avio_wb16(pb, 1); avio_wb16(pb, 2); avio_wb32(pb, KAG_SIZE); avio_wb64(pb, partition_offset); if (!memcmp(VAR_3, body_partition_key, 16) && mxf->body_partitions_count > 1) avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); else if (!memcmp(VAR_3, footer_partition_key, 16) && mxf->body_partitions_count) avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); else avio_wb64(pb, 0); avio_wb64(pb, mxf->footer_partition_offset); header_byte_count_offset = avio_tell(pb); avio_wb64(pb, 0); avio_wb64(pb, VAR_5); avio_wb32(pb, VAR_5 ? VAR_2 : 0); if (VAR_1 && mxf->edit_units_count && mxf->body_partitions_count) { avio_wb64(pb, mxf->body_offset); } else avio_wb64(pb, 0); avio_wb32(pb, VAR_1); avio_write(pb, op1a_ul, 16); mxf_write_essence_container_refs(VAR_0); if (VAR_4) { int64_t pos, start; unsigned VAR_7; mxf_write_klv_fill(VAR_0); start = avio_tell(VAR_0->pb); mxf_write_primer_pack(VAR_0); mxf_write_header_metadata_sets(VAR_0); pos = avio_tell(VAR_0->pb); VAR_7 = pos - start + klv_fill_size(pos); avio_seek(pb, header_byte_count_offset, SEEK_SET); avio_wb64(pb, VAR_7); avio_seek(pb, pos, SEEK_SET); } avio_flush(pb); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1,\nint VAR_2,\nconst uint8_t *VAR_3, int VAR_4)\n{", "MXFContext *mxf = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int64_t header_byte_count_offset;", "unsigned VAR_5 = 0;", "uint64_t partition_offset = avio_tell(pb);", "int VAR_6;", "if (!mxf->edit_unit_byte_count && mxf->edit_units_count)\nVAR_5 = 85 + 12+(VAR_0->nb_streams+1)*6 +\n12+mxf->edit_units_count*(11+mxf->slice_count*4);", "else if (mxf->edit_unit_byte_count && VAR_2)\nVAR_5 = 80;", "if (VAR_5) {", "VAR_5 += 16 + klv_ber_length(VAR_5);", "VAR_5 += klv_fill_size(VAR_5);", "}", "if (!memcmp(VAR_3, body_partition_key, 16)) {", "if ((VAR_6 = av_reallocp_array(&mxf->body_partition_offset, mxf->body_partitions_count + 1,\nsizeof(*mxf->body_partition_offset))) < 0) {", "mxf->body_partitions_count = 0;", "return VAR_6;", "}", "mxf->body_partition_offset[mxf->body_partitions_count++] = partition_offset;", "}", "avio_write(pb, VAR_3, 16);", "klv_encode_ber_length(pb, 88 + 16 * mxf->essence_container_count);", "avio_wb16(pb, 1);", "avio_wb16(pb, 2);", "avio_wb32(pb, KAG_SIZE);", "avio_wb64(pb, partition_offset);", "if (!memcmp(VAR_3, body_partition_key, 16) && mxf->body_partitions_count > 1)\navio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]);", "else if (!memcmp(VAR_3, footer_partition_key, 16) && mxf->body_partitions_count)\navio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]);", "else\navio_wb64(pb, 0);", "avio_wb64(pb, mxf->footer_partition_offset);", "header_byte_count_offset = avio_tell(pb);", "avio_wb64(pb, 0);", "avio_wb64(pb, VAR_5);", "avio_wb32(pb, VAR_5 ? VAR_2 : 0);", "if (VAR_1 && mxf->edit_units_count && mxf->body_partitions_count) {", "avio_wb64(pb, mxf->body_offset);", "} else", "avio_wb64(pb, 0);", "avio_wb32(pb, VAR_1);", "avio_write(pb, op1a_ul, 16);", "mxf_write_essence_container_refs(VAR_0);", "if (VAR_4) {", "int64_t pos, start;", "unsigned VAR_7;", "mxf_write_klv_fill(VAR_0);", "start = avio_tell(VAR_0->pb);", "mxf_write_primer_pack(VAR_0);", "mxf_write_header_metadata_sets(VAR_0);", "pos = avio_tell(VAR_0->pb);", "VAR_7 = pos - start + klv_fill_size(pos);", "avio_seek(pb, header_byte_count_offset, SEEK_SET);", "avio_wb64(pb, VAR_7);", "avio_seek(pb, pos, SEEK_SET);", "}", "avio_flush(pb);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23, 25, 27 ], [ 29, 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 87, 89 ], [ 91, 93 ], [ 95, 97 ], [ 101 ], [ 107 ], [ 109 ], [ 115 ], [ 117 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 139 ], [ 145 ], [ 149 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 189 ], [ 191 ] ]
12,253
void virtio_config_writew(VirtIODevice *vdev, uint32_t addr, uint32_t data) { VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); uint16_t val = data; if (addr > (vdev->config_len - sizeof(val))) return; stw_p(vdev->config + addr, val); if (k->set_config) { k->set_config(vdev, vdev->config); } }
true
qemu
5f5a1318653c08e435cfa52f60b6a712815b659d
void virtio_config_writew(VirtIODevice *vdev, uint32_t addr, uint32_t data) { VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev); uint16_t val = data; if (addr > (vdev->config_len - sizeof(val))) return; stw_p(vdev->config + addr, val); if (k->set_config) { k->set_config(vdev, vdev->config); } }
{ "code": [ " if (addr > (vdev->config_len - sizeof(val)))", " if (addr > (vdev->config_len - sizeof(val)))", " if (addr > (vdev->config_len - sizeof(val)))", " if (addr > (vdev->config_len - sizeof(val)))", " if (addr > (vdev->config_len - sizeof(val)))", " if (addr > (vdev->config_len - sizeof(val)))" ], "line_no": [ 11, 11, 11, 11, 11, 11 ] }
void FUNC_0(VirtIODevice *VAR_0, uint32_t VAR_1, uint32_t VAR_2) { VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(VAR_0); uint16_t val = VAR_2; if (VAR_1 > (VAR_0->config_len - sizeof(val))) return; stw_p(VAR_0->config + VAR_1, val); if (k->set_config) { k->set_config(VAR_0, VAR_0->config); } }
[ "void FUNC_0(VirtIODevice *VAR_0, uint32_t VAR_1, uint32_t VAR_2)\n{", "VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(VAR_0);", "uint16_t val = VAR_2;", "if (VAR_1 > (VAR_0->config_len - sizeof(val)))\nreturn;", "stw_p(VAR_0->config + VAR_1, val);", "if (k->set_config) {", "k->set_config(VAR_0, VAR_0->config);", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
12,254
static uint8_t get_sot(J2kDecoderContext *s) { if (s->buf_end - s->buf < 4) return AVERROR(EINVAL); s->curtileno = bytestream_get_be16(&s->buf); ///< Isot if((unsigned)s->curtileno >= s->numXtiles * s->numYtiles){ s->curtileno=0; return AVERROR(EINVAL); } s->buf += 4; ///< Psot (ignored) if (!bytestream_get_byte(&s->buf)){ ///< TPsot J2kTile *tile = s->tile + s->curtileno; /* copy defaults */ memcpy(tile->codsty, s->codsty, s->ncomponents * sizeof(J2kCodingStyle)); memcpy(tile->qntsty, s->qntsty, s->ncomponents * sizeof(J2kQuantStyle)); } bytestream_get_byte(&s->buf); ///< TNsot return 0; }
true
FFmpeg
ddfa3751c092feaf1e080f66587024689dfe603c
static uint8_t get_sot(J2kDecoderContext *s) { if (s->buf_end - s->buf < 4) return AVERROR(EINVAL); s->curtileno = bytestream_get_be16(&s->buf); if((unsigned)s->curtileno >= s->numXtiles * s->numYtiles){ s->curtileno=0; return AVERROR(EINVAL); } s->buf += 4; if (!bytestream_get_byte(&s->buf)){ J2kTile *tile = s->tile + s->curtileno; memcpy(tile->codsty, s->codsty, s->ncomponents * sizeof(J2kCodingStyle)); memcpy(tile->qntsty, s->qntsty, s->ncomponents * sizeof(J2kQuantStyle)); } bytestream_get_byte(&s->buf); return 0; }
{ "code": [ " return AVERROR(EINVAL);", " if (s->buf_end - s->buf < 4)" ], "line_no": [ 7, 5 ] }
static uint8_t FUNC_0(J2kDecoderContext *s) { if (s->buf_end - s->buf < 4) return AVERROR(EINVAL); s->curtileno = bytestream_get_be16(&s->buf); if((unsigned)s->curtileno >= s->numXtiles * s->numYtiles){ s->curtileno=0; return AVERROR(EINVAL); } s->buf += 4; if (!bytestream_get_byte(&s->buf)){ J2kTile *tile = s->tile + s->curtileno; memcpy(tile->codsty, s->codsty, s->ncomponents * sizeof(J2kCodingStyle)); memcpy(tile->qntsty, s->qntsty, s->ncomponents * sizeof(J2kQuantStyle)); } bytestream_get_byte(&s->buf); return 0; }
[ "static uint8_t FUNC_0(J2kDecoderContext *s)\n{", "if (s->buf_end - s->buf < 4)\nreturn AVERROR(EINVAL);", "s->curtileno = bytestream_get_be16(&s->buf);", "if((unsigned)s->curtileno >= s->numXtiles * s->numYtiles){", "s->curtileno=0;", "return AVERROR(EINVAL);", "}", "s->buf += 4;", "if (!bytestream_get_byte(&s->buf)){", "J2kTile *tile = s->tile + s->curtileno;", "memcpy(tile->codsty, s->codsty, s->ncomponents * sizeof(J2kCodingStyle));", "memcpy(tile->qntsty, s->qntsty, s->ncomponents * sizeof(J2kQuantStyle));", "}", "bytestream_get_byte(&s->buf);", "return 0;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ] ]
12,256
static void i6300esb_pc_init(PCIBus *pci_bus) { I6300State *d; uint8_t *pci_conf; if (!pci_bus) { fprintf(stderr, "wdt_i6300esb: no PCI bus in this machine\n"); return; } d = (I6300State *) pci_register_device (pci_bus, "i6300esb_wdt", sizeof (I6300State), -1, i6300esb_config_read, i6300esb_config_write); d->reboot_enabled = 1; d->clock_scale = CLOCK_SCALE_1KHZ; d->int_type = INT_TYPE_IRQ; d->free_run = 0; d->locked = 0; d->enabled = 0; d->timer = qemu_new_timer(vm_clock, i6300esb_timer_expired, d); d->timer1_preload = 0xfffff; d->timer2_preload = 0xfffff; d->stage = 1; d->unlock_state = 0; d->previous_reboot_flag = 0; pci_conf = d->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_ESB_9); pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER); pci_conf[0x0e] = 0x00; pci_register_bar(&d->dev, 0, 0x10, PCI_ADDRESS_SPACE_MEM, i6300esb_map); register_savevm("i6300esb_wdt", -1, sizeof(I6300State), i6300esb_save, i6300esb_load, d); }
true
qemu
09aaa1602f9381c0e0fb539390b1793e51bdfc7b
static void i6300esb_pc_init(PCIBus *pci_bus) { I6300State *d; uint8_t *pci_conf; if (!pci_bus) { fprintf(stderr, "wdt_i6300esb: no PCI bus in this machine\n"); return; } d = (I6300State *) pci_register_device (pci_bus, "i6300esb_wdt", sizeof (I6300State), -1, i6300esb_config_read, i6300esb_config_write); d->reboot_enabled = 1; d->clock_scale = CLOCK_SCALE_1KHZ; d->int_type = INT_TYPE_IRQ; d->free_run = 0; d->locked = 0; d->enabled = 0; d->timer = qemu_new_timer(vm_clock, i6300esb_timer_expired, d); d->timer1_preload = 0xfffff; d->timer2_preload = 0xfffff; d->stage = 1; d->unlock_state = 0; d->previous_reboot_flag = 0; pci_conf = d->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_ESB_9); pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER); pci_conf[0x0e] = 0x00; pci_register_bar(&d->dev, 0, 0x10, PCI_ADDRESS_SPACE_MEM, i6300esb_map); register_savevm("i6300esb_wdt", -1, sizeof(I6300State), i6300esb_save, i6300esb_load, d); }
{ "code": [ "static void i6300esb_pc_init(PCIBus *pci_bus)", " I6300State *d;", " if (!pci_bus) {", " fprintf(stderr, \"wdt_i6300esb: no PCI bus in this machine\\n\");", " d = (I6300State *)", " pci_register_device (pci_bus, \"i6300esb_wdt\", sizeof (I6300State),", " -1,", " i6300esb_config_read, i6300esb_config_write);" ], "line_no": [ 1, 5, 11, 13, 21, 23, 25, 27 ] }
static void FUNC_0(PCIBus *VAR_0) { I6300State *d; uint8_t *pci_conf; if (!VAR_0) { fprintf(stderr, "wdt_i6300esb: no PCI bus in this machine\n"); return; } d = (I6300State *) pci_register_device (VAR_0, "i6300esb_wdt", sizeof (I6300State), -1, i6300esb_config_read, i6300esb_config_write); d->reboot_enabled = 1; d->clock_scale = CLOCK_SCALE_1KHZ; d->int_type = INT_TYPE_IRQ; d->free_run = 0; d->locked = 0; d->enabled = 0; d->timer = qemu_new_timer(vm_clock, i6300esb_timer_expired, d); d->timer1_preload = 0xfffff; d->timer2_preload = 0xfffff; d->stage = 1; d->unlock_state = 0; d->previous_reboot_flag = 0; pci_conf = d->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_ESB_9); pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER); pci_conf[0x0e] = 0x00; pci_register_bar(&d->dev, 0, 0x10, PCI_ADDRESS_SPACE_MEM, i6300esb_map); register_savevm("i6300esb_wdt", -1, sizeof(I6300State), i6300esb_save, i6300esb_load, d); }
[ "static void FUNC_0(PCIBus *VAR_0)\n{", "I6300State *d;", "uint8_t *pci_conf;", "if (!VAR_0) {", "fprintf(stderr, \"wdt_i6300esb: no PCI bus in this machine\\n\");", "return;", "}", "d = (I6300State *)\npci_register_device (VAR_0, \"i6300esb_wdt\", sizeof (I6300State),\n-1,\ni6300esb_config_read, i6300esb_config_write);", "d->reboot_enabled = 1;", "d->clock_scale = CLOCK_SCALE_1KHZ;", "d->int_type = INT_TYPE_IRQ;", "d->free_run = 0;", "d->locked = 0;", "d->enabled = 0;", "d->timer = qemu_new_timer(vm_clock, i6300esb_timer_expired, d);", "d->timer1_preload = 0xfffff;", "d->timer2_preload = 0xfffff;", "d->stage = 1;", "d->unlock_state = 0;", "d->previous_reboot_flag = 0;", "pci_conf = d->dev.config;", "pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);", "pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_ESB_9);", "pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER);", "pci_conf[0x0e] = 0x00;", "pci_register_bar(&d->dev, 0, 0x10,\nPCI_ADDRESS_SPACE_MEM, i6300esb_map);", "register_savevm(\"i6300esb_wdt\", -1, sizeof(I6300State),\ni6300esb_save, i6300esb_load, d);", "}" ]
[ 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23, 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 75, 77 ], [ 79 ] ]
12,258
static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, TranslationBlock **last_tb, int *tb_exit, SyncClocks *sc) { uintptr_t ret; if (unlikely(atomic_read(&cpu->exit_request))) { return; } trace_exec_tb(tb, tb->pc); ret = cpu_tb_exec(cpu, tb); *last_tb = (TranslationBlock *)(ret & ~TB_EXIT_MASK); *tb_exit = ret & TB_EXIT_MASK; switch (*tb_exit) { case TB_EXIT_REQUESTED: /* Something asked us to stop executing * chained TBs; just continue round the main * loop. Whatever requested the exit will also * have set something else (eg exit_request or * interrupt_request) which we will handle * next time around the loop. But we need to * ensure the tcg_exit_req read in generated code * comes before the next read of cpu->exit_request * or cpu->interrupt_request. */ smp_rmb(); *last_tb = NULL; break; case TB_EXIT_ICOUNT_EXPIRED: { /* Instruction counter expired. */ #ifdef CONFIG_USER_ONLY abort(); #else int insns_left = cpu->icount_decr.u32; if (cpu->icount_extra && insns_left >= 0) { /* Refill decrementer and continue execution. */ cpu->icount_extra += insns_left; insns_left = MIN(0xffff, cpu->icount_extra); cpu->icount_extra -= insns_left; cpu->icount_decr.u16.low = insns_left; } else { if (insns_left > 0) { /* Execute remaining instructions. */ cpu_exec_nocache(cpu, insns_left, *last_tb, false); align_clocks(sc, cpu); } cpu->exception_index = EXCP_INTERRUPT; *last_tb = NULL; cpu_loop_exit(cpu); } break; #endif } default: break; } }
true
qemu
43d70ddf9f96b3ad037abe4d5f9f2768196b8c92
static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, TranslationBlock **last_tb, int *tb_exit, SyncClocks *sc) { uintptr_t ret; if (unlikely(atomic_read(&cpu->exit_request))) { return; } trace_exec_tb(tb, tb->pc); ret = cpu_tb_exec(cpu, tb); *last_tb = (TranslationBlock *)(ret & ~TB_EXIT_MASK); *tb_exit = ret & TB_EXIT_MASK; switch (*tb_exit) { case TB_EXIT_REQUESTED: smp_rmb(); *last_tb = NULL; break; case TB_EXIT_ICOUNT_EXPIRED: { #ifdef CONFIG_USER_ONLY abort(); #else int insns_left = cpu->icount_decr.u32; if (cpu->icount_extra && insns_left >= 0) { cpu->icount_extra += insns_left; insns_left = MIN(0xffff, cpu->icount_extra); cpu->icount_extra -= insns_left; cpu->icount_decr.u16.low = insns_left; } else { if (insns_left > 0) { cpu_exec_nocache(cpu, insns_left, *last_tb, false); align_clocks(sc, cpu); } cpu->exception_index = EXCP_INTERRUPT; *last_tb = NULL; cpu_loop_exit(cpu); } break; #endif } default: break; } }
{ "code": [ " *last_tb = (TranslationBlock *)(ret & ~TB_EXIT_MASK);", " cpu_exec_nocache(cpu, insns_left, *last_tb, false);", " *last_tb = NULL;" ], "line_no": [ 25, 91, 99 ] }
static inline void FUNC_0(CPUState *VAR_0, TranslationBlock *VAR_1, TranslationBlock **VAR_2, int *VAR_3, SyncClocks *VAR_4) { uintptr_t ret; if (unlikely(atomic_read(&VAR_0->exit_request))) { return; } trace_exec_tb(VAR_1, VAR_1->pc); ret = cpu_tb_exec(VAR_0, VAR_1); *VAR_2 = (TranslationBlock *)(ret & ~TB_EXIT_MASK); *VAR_3 = ret & TB_EXIT_MASK; switch (*VAR_3) { case TB_EXIT_REQUESTED: smp_rmb(); *VAR_2 = NULL; break; case TB_EXIT_ICOUNT_EXPIRED: { #ifdef CONFIG_USER_ONLY abort(); #else int VAR_5 = VAR_0->icount_decr.u32; if (VAR_0->icount_extra && VAR_5 >= 0) { VAR_0->icount_extra += VAR_5; VAR_5 = MIN(0xffff, VAR_0->icount_extra); VAR_0->icount_extra -= VAR_5; VAR_0->icount_decr.u16.low = VAR_5; } else { if (VAR_5 > 0) { cpu_exec_nocache(VAR_0, VAR_5, *VAR_2, false); align_clocks(VAR_4, VAR_0); } VAR_0->exception_index = EXCP_INTERRUPT; *VAR_2 = NULL; cpu_loop_exit(VAR_0); } break; #endif } default: break; } }
[ "static inline void FUNC_0(CPUState *VAR_0, TranslationBlock *VAR_1,\nTranslationBlock **VAR_2, int *VAR_3,\nSyncClocks *VAR_4)\n{", "uintptr_t ret;", "if (unlikely(atomic_read(&VAR_0->exit_request))) {", "return;", "}", "trace_exec_tb(VAR_1, VAR_1->pc);", "ret = cpu_tb_exec(VAR_0, VAR_1);", "*VAR_2 = (TranslationBlock *)(ret & ~TB_EXIT_MASK);", "*VAR_3 = ret & TB_EXIT_MASK;", "switch (*VAR_3) {", "case TB_EXIT_REQUESTED:\nsmp_rmb();", "*VAR_2 = NULL;", "break;", "case TB_EXIT_ICOUNT_EXPIRED:\n{", "#ifdef CONFIG_USER_ONLY\nabort();", "#else\nint VAR_5 = VAR_0->icount_decr.u32;", "if (VAR_0->icount_extra && VAR_5 >= 0) {", "VAR_0->icount_extra += VAR_5;", "VAR_5 = MIN(0xffff, VAR_0->icount_extra);", "VAR_0->icount_extra -= VAR_5;", "VAR_0->icount_decr.u16.low = VAR_5;", "} else {", "if (VAR_5 > 0) {", "cpu_exec_nocache(VAR_0, VAR_5, *VAR_2, false);", "align_clocks(VAR_4, VAR_0);", "}", "VAR_0->exception_index = EXCP_INTERRUPT;", "*VAR_2 = NULL;", "cpu_loop_exit(VAR_0);", "}", "break;", "#endif\n}", "default:\nbreak;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 65, 67 ], [ 69, 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111, 113 ], [ 115 ], [ 117 ] ]
12,260
static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h) { VncState *vs = ds->opaque; int i; h += y; /* round x down to ensure the loop only spans one 16-pixel block per, iteration. otherwise, if (x % 16) != 0, the last iteration may span two 16-pixel blocks but we only mark the first as dirty */ w += (x % 16); x -= (x % 16); x = MIN(x, vs->width); y = MIN(y, vs->height); w = MIN(x + w, vs->width) - x; h = MIN(h, vs->height); for (; y < h; y++) for (i = 0; i < w; i += 16) vnc_set_bit(vs->dirty_row[y], (x + i) / 16); }
true
qemu
6cec5487990bf3f1f22b3fcb871978255e92ae0d
static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h) { VncState *vs = ds->opaque; int i; h += y; w += (x % 16); x -= (x % 16); x = MIN(x, vs->width); y = MIN(y, vs->height); w = MIN(x + w, vs->width) - x; h = MIN(h, vs->height); for (; y < h; y++) for (i = 0; i < w; i += 16) vnc_set_bit(vs->dirty_row[y], (x + i) / 16); }
{ "code": [ " x = MIN(x, vs->width);", " y = MIN(y, vs->height);", " w = MIN(x + w, vs->width) - x;", " h = MIN(h, vs->height);" ], "line_no": [ 29, 31, 33, 35 ] }
static void FUNC_0(DisplayState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4) { VncState *vs = VAR_0->opaque; int VAR_5; VAR_4 += VAR_2; VAR_3 += (VAR_1 % 16); VAR_1 -= (VAR_1 % 16); VAR_1 = MIN(VAR_1, vs->width); VAR_2 = MIN(VAR_2, vs->height); VAR_3 = MIN(VAR_1 + VAR_3, vs->width) - VAR_1; VAR_4 = MIN(VAR_4, vs->height); for (; VAR_2 < VAR_4; VAR_2++) for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += 16) vnc_set_bit(vs->dirty_row[VAR_2], (VAR_1 + VAR_5) / 16); }
[ "static void FUNC_0(DisplayState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4)\n{", "VncState *vs = VAR_0->opaque;", "int VAR_5;", "VAR_4 += VAR_2;", "VAR_3 += (VAR_1 % 16);", "VAR_1 -= (VAR_1 % 16);", "VAR_1 = MIN(VAR_1, vs->width);", "VAR_2 = MIN(VAR_2, vs->height);", "VAR_3 = MIN(VAR_1 + VAR_3, vs->width) - VAR_1;", "VAR_4 = MIN(VAR_4, vs->height);", "for (; VAR_2 < VAR_4; VAR_2++)", "for (VAR_5 = 0; VAR_5 < VAR_3; VAR_5 += 16)", "vnc_set_bit(vs->dirty_row[VAR_2], (VAR_1 + VAR_5) / 16);", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
12,261
static void musb_async_cancel_device(MUSBState *s, USBDevice *dev) { int ep, dir; for (ep = 0; ep < 16; ep++) { for (dir = 0; dir < 2; dir++) { if (s->ep[ep].packey[dir].p.owner == NULL || s->ep[ep].packey[dir].p.owner->dev != dev) { continue; } usb_cancel_packet(&s->ep[ep].packey[dir].p); /* status updates needed here? */ } } }
true
qemu
f53c398aa603cea135ee58fd15249aeff7b9c7ea
static void musb_async_cancel_device(MUSBState *s, USBDevice *dev) { int ep, dir; for (ep = 0; ep < 16; ep++) { for (dir = 0; dir < 2; dir++) { if (s->ep[ep].packey[dir].p.owner == NULL || s->ep[ep].packey[dir].p.owner->dev != dev) { continue; } usb_cancel_packet(&s->ep[ep].packey[dir].p); } } }
{ "code": [ " if (s->ep[ep].packey[dir].p.owner == NULL ||", " s->ep[ep].packey[dir].p.owner->dev != dev) {" ], "line_no": [ 13, 15 ] }
static void FUNC_0(MUSBState *VAR_0, USBDevice *VAR_1) { int VAR_2, VAR_3; for (VAR_2 = 0; VAR_2 < 16; VAR_2++) { for (VAR_3 = 0; VAR_3 < 2; VAR_3++) { if (VAR_0->VAR_2[VAR_2].packey[VAR_3].p.owner == NULL || VAR_0->VAR_2[VAR_2].packey[VAR_3].p.owner->VAR_1 != VAR_1) { continue; } usb_cancel_packet(&VAR_0->VAR_2[VAR_2].packey[VAR_3].p); } } }
[ "static void FUNC_0(MUSBState *VAR_0, USBDevice *VAR_1)\n{", "int VAR_2, VAR_3;", "for (VAR_2 = 0; VAR_2 < 16; VAR_2++) {", "for (VAR_3 = 0; VAR_3 < 2; VAR_3++) {", "if (VAR_0->VAR_2[VAR_2].packey[VAR_3].p.owner == NULL ||\nVAR_0->VAR_2[VAR_2].packey[VAR_3].p.owner->VAR_1 != VAR_1) {", "continue;", "}", "usb_cancel_packet(&VAR_0->VAR_2[VAR_2].packey[VAR_3].p);", "}", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ] ]
12,262
int qemu_reset_requested_get(void) { return reset_requested; }
true
qemu
aedbe19297907143f17b733a7ff0e0534377bed1
int qemu_reset_requested_get(void) { return reset_requested; }
{ "code": [ "int qemu_reset_requested_get(void)" ], "line_no": [ 1 ] }
int FUNC_0(void) { return reset_requested; }
[ "int FUNC_0(void)\n{", "return reset_requested;", "}" ]
[ 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
12,263
static void select_input_picture(MpegEncContext *s){ int i; for(i=1; i<MAX_PICTURE_COUNT; i++) s->reordered_input_picture[i-1]= s->reordered_input_picture[i]; s->reordered_input_picture[MAX_PICTURE_COUNT-1]= NULL; /* set next picture type & ordering */ if(s->reordered_input_picture[0]==NULL && s->input_picture[0]){ if(/*s->picture_in_gop_number >= s->gop_size ||*/ s->next_picture_ptr==NULL || s->intra_only){ s->reordered_input_picture[0]= s->input_picture[0]; s->reordered_input_picture[0]->pict_type= I_TYPE; s->reordered_input_picture[0]->coded_picture_number= s->coded_picture_number++; }else{ int b_frames; if(s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor){ if(s->picture_in_gop_number < s->gop_size && skip_check(s, s->input_picture[0], s->next_picture_ptr)){ //FIXME check that te gop check above is +-1 correct //av_log(NULL, AV_LOG_DEBUG, "skip %p %Ld\n", s->input_picture[0]->data[0], s->input_picture[0]->pts); if(s->input_picture[0]->type == FF_BUFFER_TYPE_SHARED){ for(i=0; i<4; i++) s->input_picture[0]->data[i]= NULL; s->input_picture[0]->type= 0; }else{ assert( s->input_picture[0]->type==FF_BUFFER_TYPE_USER || s->input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL); s->avctx->release_buffer(s->avctx, (AVFrame*)s->input_picture[0]); } emms_c(); ff_vbv_update(s, 0); goto no_output_pic; } } if(s->flags&CODEC_FLAG_PASS2){ for(i=0; i<s->max_b_frames+1; i++){ int pict_num= s->input_picture[0]->display_picture_number + i; if(pict_num >= s->rc_context.num_entries) break; if(!s->input_picture[i]){ s->rc_context.entry[pict_num-1].new_pict_type = P_TYPE; break; } s->input_picture[i]->pict_type= s->rc_context.entry[pict_num].new_pict_type; } } if(s->avctx->b_frame_strategy==0){ b_frames= s->max_b_frames; while(b_frames && !s->input_picture[b_frames]) b_frames--; }else if(s->avctx->b_frame_strategy==1){ for(i=1; i<s->max_b_frames+1; i++){ if(s->input_picture[i] && s->input_picture[i]->b_frame_score==0){ s->input_picture[i]->b_frame_score= get_intra_count(s, s->input_picture[i ]->data[0], s->input_picture[i-1]->data[0], s->linesize) + 1; } } for(i=0; i<s->max_b_frames+1; i++){ if(s->input_picture[i]==NULL || s->input_picture[i]->b_frame_score - 1 > s->mb_num/s->avctx->b_sensitivity) break; } b_frames= FFMAX(0, i-1); /* reset scores */ for(i=0; i<b_frames+1; i++){ s->input_picture[i]->b_frame_score=0; } }else if(s->avctx->b_frame_strategy==2){ b_frames= estimate_best_b_count(s); }else{ av_log(s->avctx, AV_LOG_ERROR, "illegal b frame strategy\n"); b_frames=0; } emms_c(); //static int b_count=0; //b_count+= b_frames; //av_log(s->avctx, AV_LOG_DEBUG, "b_frames: %d\n", b_count); for(i= b_frames - 1; i>=0; i--){ int type= s->input_picture[i]->pict_type; if(type && type != B_TYPE) b_frames= i; } if(s->input_picture[b_frames]->pict_type == B_TYPE && b_frames == s->max_b_frames){ av_log(s->avctx, AV_LOG_ERROR, "warning, too many b frames in a row\n"); } if(s->picture_in_gop_number + b_frames >= s->gop_size){ if((s->flags2 & CODEC_FLAG2_STRICT_GOP) && s->gop_size > s->picture_in_gop_number){ b_frames= s->gop_size - s->picture_in_gop_number - 1; }else{ if(s->flags & CODEC_FLAG_CLOSED_GOP) b_frames=0; s->input_picture[b_frames]->pict_type= I_TYPE; } } if( (s->flags & CODEC_FLAG_CLOSED_GOP) && b_frames && s->input_picture[b_frames]->pict_type== I_TYPE) b_frames--; s->reordered_input_picture[0]= s->input_picture[b_frames]; if(s->reordered_input_picture[0]->pict_type != I_TYPE) s->reordered_input_picture[0]->pict_type= P_TYPE; s->reordered_input_picture[0]->coded_picture_number= s->coded_picture_number++; for(i=0; i<b_frames; i++){ s->reordered_input_picture[i+1]= s->input_picture[i]; s->reordered_input_picture[i+1]->pict_type= B_TYPE; s->reordered_input_picture[i+1]->coded_picture_number= s->coded_picture_number++; } } } no_output_pic: if(s->reordered_input_picture[0]){ s->reordered_input_picture[0]->reference= s->reordered_input_picture[0]->pict_type!=B_TYPE ? 3 : 0; copy_picture(&s->new_picture, s->reordered_input_picture[0]); if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_SHARED){ // input is a shared pix, so we can't modifiy it -> alloc a new one & ensure that the shared one is reuseable int i= ff_find_unused_picture(s, 0); Picture *pic= &s->picture[i]; /* mark us unused / free shared pic */ for(i=0; i<4; i++) s->reordered_input_picture[0]->data[i]= NULL; s->reordered_input_picture[0]->type= 0; pic->reference = s->reordered_input_picture[0]->reference; alloc_picture(s, pic, 0); copy_picture_attributes(s, (AVFrame*)pic, (AVFrame*)s->reordered_input_picture[0]); s->current_picture_ptr= pic; }else{ // input is not a shared pix -> reuse buffer for current_pix assert( s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_USER || s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL); s->current_picture_ptr= s->reordered_input_picture[0]; for(i=0; i<4; i++){ s->new_picture.data[i]+= INPLACE_OFFSET; } } copy_picture(&s->current_picture, s->current_picture_ptr); s->picture_number= s->new_picture.display_picture_number; //printf("dpn:%d\n", s->picture_number); }else{ memset(&s->new_picture, 0, sizeof(Picture)); } }
true
FFmpeg
075060023d978975ed5328e269d6e20163e669d2
static void select_input_picture(MpegEncContext *s){ int i; for(i=1; i<MAX_PICTURE_COUNT; i++) s->reordered_input_picture[i-1]= s->reordered_input_picture[i]; s->reordered_input_picture[MAX_PICTURE_COUNT-1]= NULL; if(s->reordered_input_picture[0]==NULL && s->input_picture[0]){ if( s->next_picture_ptr==NULL || s->intra_only){ s->reordered_input_picture[0]= s->input_picture[0]; s->reordered_input_picture[0]->pict_type= I_TYPE; s->reordered_input_picture[0]->coded_picture_number= s->coded_picture_number++; }else{ int b_frames; if(s->avctx->frame_skip_threshold || s->avctx->frame_skip_factor){ if(s->picture_in_gop_number < s->gop_size && skip_check(s, s->input_picture[0], s->next_picture_ptr)){ if(s->input_picture[0]->type == FF_BUFFER_TYPE_SHARED){ for(i=0; i<4; i++) s->input_picture[0]->data[i]= NULL; s->input_picture[0]->type= 0; }else{ assert( s->input_picture[0]->type==FF_BUFFER_TYPE_USER || s->input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL); s->avctx->release_buffer(s->avctx, (AVFrame*)s->input_picture[0]); } emms_c(); ff_vbv_update(s, 0); goto no_output_pic; } } if(s->flags&CODEC_FLAG_PASS2){ for(i=0; i<s->max_b_frames+1; i++){ int pict_num= s->input_picture[0]->display_picture_number + i; if(pict_num >= s->rc_context.num_entries) break; if(!s->input_picture[i]){ s->rc_context.entry[pict_num-1].new_pict_type = P_TYPE; break; } s->input_picture[i]->pict_type= s->rc_context.entry[pict_num].new_pict_type; } } if(s->avctx->b_frame_strategy==0){ b_frames= s->max_b_frames; while(b_frames && !s->input_picture[b_frames]) b_frames--; }else if(s->avctx->b_frame_strategy==1){ for(i=1; i<s->max_b_frames+1; i++){ if(s->input_picture[i] && s->input_picture[i]->b_frame_score==0){ s->input_picture[i]->b_frame_score= get_intra_count(s, s->input_picture[i ]->data[0], s->input_picture[i-1]->data[0], s->linesize) + 1; } } for(i=0; i<s->max_b_frames+1; i++){ if(s->input_picture[i]==NULL || s->input_picture[i]->b_frame_score - 1 > s->mb_num/s->avctx->b_sensitivity) break; } b_frames= FFMAX(0, i-1); for(i=0; i<b_frames+1; i++){ s->input_picture[i]->b_frame_score=0; } }else if(s->avctx->b_frame_strategy==2){ b_frames= estimate_best_b_count(s); }else{ av_log(s->avctx, AV_LOG_ERROR, "illegal b frame strategy\n"); b_frames=0; } emms_c(); for(i= b_frames - 1; i>=0; i--){ int type= s->input_picture[i]->pict_type; if(type && type != B_TYPE) b_frames= i; } if(s->input_picture[b_frames]->pict_type == B_TYPE && b_frames == s->max_b_frames){ av_log(s->avctx, AV_LOG_ERROR, "warning, too many b frames in a row\n"); } if(s->picture_in_gop_number + b_frames >= s->gop_size){ if((s->flags2 & CODEC_FLAG2_STRICT_GOP) && s->gop_size > s->picture_in_gop_number){ b_frames= s->gop_size - s->picture_in_gop_number - 1; }else{ if(s->flags & CODEC_FLAG_CLOSED_GOP) b_frames=0; s->input_picture[b_frames]->pict_type= I_TYPE; } } if( (s->flags & CODEC_FLAG_CLOSED_GOP) && b_frames && s->input_picture[b_frames]->pict_type== I_TYPE) b_frames--; s->reordered_input_picture[0]= s->input_picture[b_frames]; if(s->reordered_input_picture[0]->pict_type != I_TYPE) s->reordered_input_picture[0]->pict_type= P_TYPE; s->reordered_input_picture[0]->coded_picture_number= s->coded_picture_number++; for(i=0; i<b_frames; i++){ s->reordered_input_picture[i+1]= s->input_picture[i]; s->reordered_input_picture[i+1]->pict_type= B_TYPE; s->reordered_input_picture[i+1]->coded_picture_number= s->coded_picture_number++; } } } no_output_pic: if(s->reordered_input_picture[0]){ s->reordered_input_picture[0]->reference= s->reordered_input_picture[0]->pict_type!=B_TYPE ? 3 : 0; copy_picture(&s->new_picture, s->reordered_input_picture[0]); if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_SHARED){ int i= ff_find_unused_picture(s, 0); Picture *pic= &s->picture[i]; for(i=0; i<4; i++) s->reordered_input_picture[0]->data[i]= NULL; s->reordered_input_picture[0]->type= 0; pic->reference = s->reordered_input_picture[0]->reference; alloc_picture(s, pic, 0); copy_picture_attributes(s, (AVFrame*)pic, (AVFrame*)s->reordered_input_picture[0]); s->current_picture_ptr= pic; }else{ assert( s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_USER || s->reordered_input_picture[0]->type==FF_BUFFER_TYPE_INTERNAL); s->current_picture_ptr= s->reordered_input_picture[0]; for(i=0; i<4; i++){ s->new_picture.data[i]+= INPLACE_OFFSET; } } copy_picture(&s->current_picture, s->current_picture_ptr); s->picture_number= s->new_picture.display_picture_number; }else{ memset(&s->new_picture, 0, sizeof(Picture)); } }
{ "code": [ " if(s->reordered_input_picture[0]->type == FF_BUFFER_TYPE_SHARED){", " pic->reference = s->reordered_input_picture[0]->reference;", " alloc_picture(s, pic, 0);" ], "line_no": [ 259, 281, 285 ] }
static void FUNC_0(MpegEncContext *VAR_0){ int VAR_4; for(VAR_4=1; VAR_4<MAX_PICTURE_COUNT; VAR_4++) VAR_0->reordered_input_picture[VAR_4-1]= VAR_0->reordered_input_picture[VAR_4]; VAR_0->reordered_input_picture[MAX_PICTURE_COUNT-1]= NULL; if(VAR_0->reordered_input_picture[0]==NULL && VAR_0->input_picture[0]){ if( VAR_0->next_picture_ptr==NULL || VAR_0->intra_only){ VAR_0->reordered_input_picture[0]= VAR_0->input_picture[0]; VAR_0->reordered_input_picture[0]->pict_type= I_TYPE; VAR_0->reordered_input_picture[0]->coded_picture_number= VAR_0->coded_picture_number++; }else{ int VAR_2; if(VAR_0->avctx->frame_skip_threshold || VAR_0->avctx->frame_skip_factor){ if(VAR_0->picture_in_gop_number < VAR_0->gop_size && skip_check(VAR_0, VAR_0->input_picture[0], VAR_0->next_picture_ptr)){ if(VAR_0->input_picture[0]->VAR_3 == FF_BUFFER_TYPE_SHARED){ for(VAR_4=0; VAR_4<4; VAR_4++) VAR_0->input_picture[0]->data[VAR_4]= NULL; VAR_0->input_picture[0]->VAR_3= 0; }else{ assert( VAR_0->input_picture[0]->VAR_3==FF_BUFFER_TYPE_USER || VAR_0->input_picture[0]->VAR_3==FF_BUFFER_TYPE_INTERNAL); VAR_0->avctx->release_buffer(VAR_0->avctx, (AVFrame*)VAR_0->input_picture[0]); } emms_c(); ff_vbv_update(VAR_0, 0); goto no_output_pic; } } if(VAR_0->flags&CODEC_FLAG_PASS2){ for(VAR_4=0; VAR_4<VAR_0->max_b_frames+1; VAR_4++){ int pict_num= VAR_0->input_picture[0]->display_picture_number + VAR_4; if(pict_num >= VAR_0->rc_context.num_entries) break; if(!VAR_0->input_picture[VAR_4]){ VAR_0->rc_context.entry[pict_num-1].new_pict_type = P_TYPE; break; } VAR_0->input_picture[VAR_4]->pict_type= VAR_0->rc_context.entry[pict_num].new_pict_type; } } if(VAR_0->avctx->b_frame_strategy==0){ VAR_2= VAR_0->max_b_frames; while(VAR_2 && !VAR_0->input_picture[VAR_2]) VAR_2--; }else if(VAR_0->avctx->b_frame_strategy==1){ for(VAR_4=1; VAR_4<VAR_0->max_b_frames+1; VAR_4++){ if(VAR_0->input_picture[VAR_4] && VAR_0->input_picture[VAR_4]->b_frame_score==0){ VAR_0->input_picture[VAR_4]->b_frame_score= get_intra_count(VAR_0, VAR_0->input_picture[VAR_4 ]->data[0], VAR_0->input_picture[VAR_4-1]->data[0], VAR_0->linesize) + 1; } } for(VAR_4=0; VAR_4<VAR_0->max_b_frames+1; VAR_4++){ if(VAR_0->input_picture[VAR_4]==NULL || VAR_0->input_picture[VAR_4]->b_frame_score - 1 > VAR_0->mb_num/VAR_0->avctx->b_sensitivity) break; } VAR_2= FFMAX(0, VAR_4-1); for(VAR_4=0; VAR_4<VAR_2+1; VAR_4++){ VAR_0->input_picture[VAR_4]->b_frame_score=0; } }else if(VAR_0->avctx->b_frame_strategy==2){ VAR_2= estimate_best_b_count(VAR_0); }else{ av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal b frame strategy\n"); VAR_2=0; } emms_c(); for(VAR_4= VAR_2 - 1; VAR_4>=0; VAR_4--){ int VAR_3= VAR_0->input_picture[VAR_4]->pict_type; if(VAR_3 && VAR_3 != B_TYPE) VAR_2= VAR_4; } if(VAR_0->input_picture[VAR_2]->pict_type == B_TYPE && VAR_2 == VAR_0->max_b_frames){ av_log(VAR_0->avctx, AV_LOG_ERROR, "warning, too many b frames in a row\n"); } if(VAR_0->picture_in_gop_number + VAR_2 >= VAR_0->gop_size){ if((VAR_0->flags2 & CODEC_FLAG2_STRICT_GOP) && VAR_0->gop_size > VAR_0->picture_in_gop_number){ VAR_2= VAR_0->gop_size - VAR_0->picture_in_gop_number - 1; }else{ if(VAR_0->flags & CODEC_FLAG_CLOSED_GOP) VAR_2=0; VAR_0->input_picture[VAR_2]->pict_type= I_TYPE; } } if( (VAR_0->flags & CODEC_FLAG_CLOSED_GOP) && VAR_2 && VAR_0->input_picture[VAR_2]->pict_type== I_TYPE) VAR_2--; VAR_0->reordered_input_picture[0]= VAR_0->input_picture[VAR_2]; if(VAR_0->reordered_input_picture[0]->pict_type != I_TYPE) VAR_0->reordered_input_picture[0]->pict_type= P_TYPE; VAR_0->reordered_input_picture[0]->coded_picture_number= VAR_0->coded_picture_number++; for(VAR_4=0; VAR_4<VAR_2; VAR_4++){ VAR_0->reordered_input_picture[VAR_4+1]= VAR_0->input_picture[VAR_4]; VAR_0->reordered_input_picture[VAR_4+1]->pict_type= B_TYPE; VAR_0->reordered_input_picture[VAR_4+1]->coded_picture_number= VAR_0->coded_picture_number++; } } } no_output_pic: if(VAR_0->reordered_input_picture[0]){ VAR_0->reordered_input_picture[0]->reference= VAR_0->reordered_input_picture[0]->pict_type!=B_TYPE ? 3 : 0; copy_picture(&VAR_0->new_picture, VAR_0->reordered_input_picture[0]); if(VAR_0->reordered_input_picture[0]->VAR_3 == FF_BUFFER_TYPE_SHARED){ int VAR_4= ff_find_unused_picture(VAR_0, 0); Picture *pic= &VAR_0->picture[VAR_4]; for(VAR_4=0; VAR_4<4; VAR_4++) VAR_0->reordered_input_picture[0]->data[VAR_4]= NULL; VAR_0->reordered_input_picture[0]->VAR_3= 0; pic->reference = VAR_0->reordered_input_picture[0]->reference; alloc_picture(VAR_0, pic, 0); copy_picture_attributes(VAR_0, (AVFrame*)pic, (AVFrame*)VAR_0->reordered_input_picture[0]); VAR_0->current_picture_ptr= pic; }else{ assert( VAR_0->reordered_input_picture[0]->VAR_3==FF_BUFFER_TYPE_USER || VAR_0->reordered_input_picture[0]->VAR_3==FF_BUFFER_TYPE_INTERNAL); VAR_0->current_picture_ptr= VAR_0->reordered_input_picture[0]; for(VAR_4=0; VAR_4<4; VAR_4++){ VAR_0->new_picture.data[VAR_4]+= INPLACE_OFFSET; } } copy_picture(&VAR_0->current_picture, VAR_0->current_picture_ptr); VAR_0->picture_number= VAR_0->new_picture.display_picture_number; }else{ memset(&VAR_0->new_picture, 0, sizeof(Picture)); } }
[ "static void FUNC_0(MpegEncContext *VAR_0){", "int VAR_4;", "for(VAR_4=1; VAR_4<MAX_PICTURE_COUNT; VAR_4++)", "VAR_0->reordered_input_picture[VAR_4-1]= VAR_0->reordered_input_picture[VAR_4];", "VAR_0->reordered_input_picture[MAX_PICTURE_COUNT-1]= NULL;", "if(VAR_0->reordered_input_picture[0]==NULL && VAR_0->input_picture[0]){", "if( VAR_0->next_picture_ptr==NULL || VAR_0->intra_only){", "VAR_0->reordered_input_picture[0]= VAR_0->input_picture[0];", "VAR_0->reordered_input_picture[0]->pict_type= I_TYPE;", "VAR_0->reordered_input_picture[0]->coded_picture_number= VAR_0->coded_picture_number++;", "}else{", "int VAR_2;", "if(VAR_0->avctx->frame_skip_threshold || VAR_0->avctx->frame_skip_factor){", "if(VAR_0->picture_in_gop_number < VAR_0->gop_size && skip_check(VAR_0, VAR_0->input_picture[0], VAR_0->next_picture_ptr)){", "if(VAR_0->input_picture[0]->VAR_3 == FF_BUFFER_TYPE_SHARED){", "for(VAR_4=0; VAR_4<4; VAR_4++)", "VAR_0->input_picture[0]->data[VAR_4]= NULL;", "VAR_0->input_picture[0]->VAR_3= 0;", "}else{", "assert( VAR_0->input_picture[0]->VAR_3==FF_BUFFER_TYPE_USER\n|| VAR_0->input_picture[0]->VAR_3==FF_BUFFER_TYPE_INTERNAL);", "VAR_0->avctx->release_buffer(VAR_0->avctx, (AVFrame*)VAR_0->input_picture[0]);", "}", "emms_c();", "ff_vbv_update(VAR_0, 0);", "goto no_output_pic;", "}", "}", "if(VAR_0->flags&CODEC_FLAG_PASS2){", "for(VAR_4=0; VAR_4<VAR_0->max_b_frames+1; VAR_4++){", "int pict_num= VAR_0->input_picture[0]->display_picture_number + VAR_4;", "if(pict_num >= VAR_0->rc_context.num_entries)\nbreak;", "if(!VAR_0->input_picture[VAR_4]){", "VAR_0->rc_context.entry[pict_num-1].new_pict_type = P_TYPE;", "break;", "}", "VAR_0->input_picture[VAR_4]->pict_type=\nVAR_0->rc_context.entry[pict_num].new_pict_type;", "}", "}", "if(VAR_0->avctx->b_frame_strategy==0){", "VAR_2= VAR_0->max_b_frames;", "while(VAR_2 && !VAR_0->input_picture[VAR_2]) VAR_2--;", "}else if(VAR_0->avctx->b_frame_strategy==1){", "for(VAR_4=1; VAR_4<VAR_0->max_b_frames+1; VAR_4++){", "if(VAR_0->input_picture[VAR_4] && VAR_0->input_picture[VAR_4]->b_frame_score==0){", "VAR_0->input_picture[VAR_4]->b_frame_score=\nget_intra_count(VAR_0, VAR_0->input_picture[VAR_4 ]->data[0],\nVAR_0->input_picture[VAR_4-1]->data[0], VAR_0->linesize) + 1;", "}", "}", "for(VAR_4=0; VAR_4<VAR_0->max_b_frames+1; VAR_4++){", "if(VAR_0->input_picture[VAR_4]==NULL || VAR_0->input_picture[VAR_4]->b_frame_score - 1 > VAR_0->mb_num/VAR_0->avctx->b_sensitivity) break;", "}", "VAR_2= FFMAX(0, VAR_4-1);", "for(VAR_4=0; VAR_4<VAR_2+1; VAR_4++){", "VAR_0->input_picture[VAR_4]->b_frame_score=0;", "}", "}else if(VAR_0->avctx->b_frame_strategy==2){", "VAR_2= estimate_best_b_count(VAR_0);", "}else{", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal b frame strategy\\n\");", "VAR_2=0;", "}", "emms_c();", "for(VAR_4= VAR_2 - 1; VAR_4>=0; VAR_4--){", "int VAR_3= VAR_0->input_picture[VAR_4]->pict_type;", "if(VAR_3 && VAR_3 != B_TYPE)\nVAR_2= VAR_4;", "}", "if(VAR_0->input_picture[VAR_2]->pict_type == B_TYPE && VAR_2 == VAR_0->max_b_frames){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"warning, too many b frames in a row\\n\");", "}", "if(VAR_0->picture_in_gop_number + VAR_2 >= VAR_0->gop_size){", "if((VAR_0->flags2 & CODEC_FLAG2_STRICT_GOP) && VAR_0->gop_size > VAR_0->picture_in_gop_number){", "VAR_2= VAR_0->gop_size - VAR_0->picture_in_gop_number - 1;", "}else{", "if(VAR_0->flags & CODEC_FLAG_CLOSED_GOP)\nVAR_2=0;", "VAR_0->input_picture[VAR_2]->pict_type= I_TYPE;", "}", "}", "if( (VAR_0->flags & CODEC_FLAG_CLOSED_GOP)\n&& VAR_2\n&& VAR_0->input_picture[VAR_2]->pict_type== I_TYPE)\nVAR_2--;", "VAR_0->reordered_input_picture[0]= VAR_0->input_picture[VAR_2];", "if(VAR_0->reordered_input_picture[0]->pict_type != I_TYPE)\nVAR_0->reordered_input_picture[0]->pict_type= P_TYPE;", "VAR_0->reordered_input_picture[0]->coded_picture_number= VAR_0->coded_picture_number++;", "for(VAR_4=0; VAR_4<VAR_2; VAR_4++){", "VAR_0->reordered_input_picture[VAR_4+1]= VAR_0->input_picture[VAR_4];", "VAR_0->reordered_input_picture[VAR_4+1]->pict_type= B_TYPE;", "VAR_0->reordered_input_picture[VAR_4+1]->coded_picture_number= VAR_0->coded_picture_number++;", "}", "}", "}", "no_output_pic:\nif(VAR_0->reordered_input_picture[0]){", "VAR_0->reordered_input_picture[0]->reference= VAR_0->reordered_input_picture[0]->pict_type!=B_TYPE ? 3 : 0;", "copy_picture(&VAR_0->new_picture, VAR_0->reordered_input_picture[0]);", "if(VAR_0->reordered_input_picture[0]->VAR_3 == FF_BUFFER_TYPE_SHARED){", "int VAR_4= ff_find_unused_picture(VAR_0, 0);", "Picture *pic= &VAR_0->picture[VAR_4];", "for(VAR_4=0; VAR_4<4; VAR_4++)", "VAR_0->reordered_input_picture[0]->data[VAR_4]= NULL;", "VAR_0->reordered_input_picture[0]->VAR_3= 0;", "pic->reference = VAR_0->reordered_input_picture[0]->reference;", "alloc_picture(VAR_0, pic, 0);", "copy_picture_attributes(VAR_0, (AVFrame*)pic, (AVFrame*)VAR_0->reordered_input_picture[0]);", "VAR_0->current_picture_ptr= pic;", "}else{", "assert( VAR_0->reordered_input_picture[0]->VAR_3==FF_BUFFER_TYPE_USER\n|| VAR_0->reordered_input_picture[0]->VAR_3==FF_BUFFER_TYPE_INTERNAL);", "VAR_0->current_picture_ptr= VAR_0->reordered_input_picture[0];", "for(VAR_4=0; VAR_4<4; VAR_4++){", "VAR_0->new_picture.data[VAR_4]+= INPLACE_OFFSET;", "}", "}", "copy_picture(&VAR_0->current_picture, VAR_0->current_picture_ptr);", "VAR_0->picture_number= VAR_0->new_picture.display_picture_number;", "}else{", "memset(&VAR_0->new_picture, 0, sizeof(Picture));", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 177 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215, 217, 219, 221 ], [ 225 ], [ 227, 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247, 249 ], [ 251 ], [ 255 ], [ 259 ], [ 265 ], [ 267 ], [ 273 ], [ 275 ], [ 277 ], [ 281 ], [ 285 ], [ 289 ], [ 293 ], [ 295 ], [ 301, 303 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 317 ], [ 321 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ] ]
12,264
static int local_chown(FsContext *fs_ctx, const char *path, FsCred *credp) { if ((credp->fc_uid == -1 && credp->fc_gid == -1) || (fs_ctx->fs_sm == SM_PASSTHROUGH)) { return lchown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid); } else if (fs_ctx->fs_sm == SM_MAPPED) { return local_set_xattr(rpath(fs_ctx, path), credp); } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) { return lchown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid); } return -1; }
true
qemu
12848bfc5d719bad536c5448205a3226be1fda47
static int local_chown(FsContext *fs_ctx, const char *path, FsCred *credp) { if ((credp->fc_uid == -1 && credp->fc_gid == -1) || (fs_ctx->fs_sm == SM_PASSTHROUGH)) { return lchown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid); } else if (fs_ctx->fs_sm == SM_MAPPED) { return local_set_xattr(rpath(fs_ctx, path), credp); } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) { return lchown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid); } return -1; }
{ "code": [ " } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {", " } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {", " } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {", " } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {", " } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {", " } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {", " } else if (fs_ctx->fs_sm == SM_PASSTHROUGH) {" ], "line_no": [ 15, 15, 15, 15, 15, 15, 15 ] }
static int FUNC_0(FsContext *VAR_0, const char *VAR_1, FsCred *VAR_2) { if ((VAR_2->fc_uid == -1 && VAR_2->fc_gid == -1) || (VAR_0->fs_sm == SM_PASSTHROUGH)) { return lchown(rpath(VAR_0, VAR_1), VAR_2->fc_uid, VAR_2->fc_gid); } else if (VAR_0->fs_sm == SM_MAPPED) { return local_set_xattr(rpath(VAR_0, VAR_1), VAR_2); } else if (VAR_0->fs_sm == SM_PASSTHROUGH) { return lchown(rpath(VAR_0, VAR_1), VAR_2->fc_uid, VAR_2->fc_gid); } return -1; }
[ "static int FUNC_0(FsContext *VAR_0, const char *VAR_1, FsCred *VAR_2)\n{", "if ((VAR_2->fc_uid == -1 && VAR_2->fc_gid == -1) ||\n(VAR_0->fs_sm == SM_PASSTHROUGH)) {", "return lchown(rpath(VAR_0, VAR_1), VAR_2->fc_uid, VAR_2->fc_gid);", "} else if (VAR_0->fs_sm == SM_MAPPED) {", "return local_set_xattr(rpath(VAR_0, VAR_1), VAR_2);", "} else if (VAR_0->fs_sm == SM_PASSTHROUGH) {", "return lchown(rpath(VAR_0, VAR_1), VAR_2->fc_uid, VAR_2->fc_gid);", "}", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
12,265
static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) { const int mb_x= s->mb_x; const int mb_y= s->mb_y; int i; #if 0 if (s->interlaced_dct) { dct_linesize = s->linesize * 2; dct_offset = s->linesize; } else { dct_linesize = s->linesize; dct_offset = s->linesize * 8; } #endif if (s->mb_intra) { UINT8 *ptr; int wrap; wrap = s->linesize; ptr = s->new_picture[0] + (mb_y * 16 * wrap) + mb_x * 16; get_pixels(s->block[0], ptr , wrap); get_pixels(s->block[1], ptr + 8, wrap); get_pixels(s->block[2], ptr + 8 * wrap , wrap); get_pixels(s->block[3], ptr + 8 * wrap + 8, wrap); wrap >>=1; ptr = s->new_picture[1] + (mb_y * 8 * wrap) + mb_x * 8; get_pixels(s->block[4], ptr, wrap); ptr = s->new_picture[2] + (mb_y * 8 * wrap) + mb_x * 8; get_pixels(s->block[5], ptr, wrap); }else{ op_pixels_func *op_pix; qpel_mc_func *op_qpix; UINT8 *dest_y, *dest_cb, *dest_cr; UINT8 *ptr; int wrap; dest_y = s->current_picture[0] + (mb_y * 16 * s->linesize ) + mb_x * 16; dest_cb = s->current_picture[1] + (mb_y * 8 * (s->linesize >> 1)) + mb_x * 8; dest_cr = s->current_picture[2] + (mb_y * 8 * (s->linesize >> 1)) + mb_x * 8; if ((!s->no_rounding) || s->pict_type==B_TYPE){ op_pix = put_pixels_tab; op_qpix= qpel_mc_rnd_tab; }else{ op_pix = put_no_rnd_pixels_tab; op_qpix= qpel_mc_no_rnd_tab; } if (s->mv_dir & MV_DIR_FORWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture, op_pix, op_qpix); if ((!s->no_rounding) || s->pict_type==B_TYPE) op_pix = avg_pixels_tab; else op_pix = avg_no_rnd_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture, op_pix, op_qpix); } wrap = s->linesize; ptr = s->new_picture[0] + (mb_y * 16 * wrap) + mb_x * 16; diff_pixels(s->block[0], ptr , dest_y , wrap); diff_pixels(s->block[1], ptr + 8, dest_y + 8, wrap); diff_pixels(s->block[2], ptr + 8 * wrap , dest_y + 8 * wrap , wrap); diff_pixels(s->block[3], ptr + 8 * wrap + 8, dest_y + 8 * wrap + 8, wrap); wrap >>=1; ptr = s->new_picture[1] + (mb_y * 8 * wrap) + mb_x * 8; diff_pixels(s->block[4], ptr, dest_cb, wrap); ptr = s->new_picture[2] + (mb_y * 8 * wrap) + mb_x * 8; diff_pixels(s->block[5], ptr, dest_cr, wrap); } #if 0 { float adap_parm; adap_parm = ((s->avg_mb_var << 1) + s->mb_var[s->mb_width*mb_y+mb_x] + 1.0) / ((s->mb_var[s->mb_width*mb_y+mb_x] << 1) + s->avg_mb_var + 1.0); printf("\ntype=%c qscale=%2d adap=%0.2f dquant=%4.2f var=%4d avgvar=%4d", (s->mb_type[s->mb_width*mb_y+mb_x] > 0) ? 'I' : 'P', s->qscale, adap_parm, s->qscale*adap_parm, s->mb_var[s->mb_width*mb_y+mb_x], s->avg_mb_var); } #endif /* DCT & quantize */ if (s->h263_msmpeg4) { msmpeg4_dc_scale(s); } else if (s->h263_pred) { h263_dc_scale(s); } else { /* default quantization values */ s->y_dc_scale = 8; s->c_dc_scale = 8; } for(i=0;i<6;i++) { s->block_last_index[i] = dct_quantize(s, s->block[i], i, s->qscale); } /* huffman encode */ switch(s->out_format) { case FMT_MPEG1: mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; case FMT_H263: if (s->h263_msmpeg4) msmpeg4_encode_mb(s, s->block, motion_x, motion_y); else if(s->h263_pred) mpeg4_encode_mb(s, s->block, motion_x, motion_y); else h263_encode_mb(s, s->block, motion_x, motion_y); break; case FMT_MJPEG: mjpeg_encode_mb(s, s->block); break; } }
true
FFmpeg
d7e9533aa06f4073a27812349b35ba5fede11ca1
static void encode_mb(MpegEncContext *s, int motion_x, int motion_y) { const int mb_x= s->mb_x; const int mb_y= s->mb_y; int i; #if 0 if (s->interlaced_dct) { dct_linesize = s->linesize * 2; dct_offset = s->linesize; } else { dct_linesize = s->linesize; dct_offset = s->linesize * 8; } #endif if (s->mb_intra) { UINT8 *ptr; int wrap; wrap = s->linesize; ptr = s->new_picture[0] + (mb_y * 16 * wrap) + mb_x * 16; get_pixels(s->block[0], ptr , wrap); get_pixels(s->block[1], ptr + 8, wrap); get_pixels(s->block[2], ptr + 8 * wrap , wrap); get_pixels(s->block[3], ptr + 8 * wrap + 8, wrap); wrap >>=1; ptr = s->new_picture[1] + (mb_y * 8 * wrap) + mb_x * 8; get_pixels(s->block[4], ptr, wrap); ptr = s->new_picture[2] + (mb_y * 8 * wrap) + mb_x * 8; get_pixels(s->block[5], ptr, wrap); }else{ op_pixels_func *op_pix; qpel_mc_func *op_qpix; UINT8 *dest_y, *dest_cb, *dest_cr; UINT8 *ptr; int wrap; dest_y = s->current_picture[0] + (mb_y * 16 * s->linesize ) + mb_x * 16; dest_cb = s->current_picture[1] + (mb_y * 8 * (s->linesize >> 1)) + mb_x * 8; dest_cr = s->current_picture[2] + (mb_y * 8 * (s->linesize >> 1)) + mb_x * 8; if ((!s->no_rounding) || s->pict_type==B_TYPE){ op_pix = put_pixels_tab; op_qpix= qpel_mc_rnd_tab; }else{ op_pix = put_no_rnd_pixels_tab; op_qpix= qpel_mc_no_rnd_tab; } if (s->mv_dir & MV_DIR_FORWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture, op_pix, op_qpix); if ((!s->no_rounding) || s->pict_type==B_TYPE) op_pix = avg_pixels_tab; else op_pix = avg_no_rnd_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture, op_pix, op_qpix); } wrap = s->linesize; ptr = s->new_picture[0] + (mb_y * 16 * wrap) + mb_x * 16; diff_pixels(s->block[0], ptr , dest_y , wrap); diff_pixels(s->block[1], ptr + 8, dest_y + 8, wrap); diff_pixels(s->block[2], ptr + 8 * wrap , dest_y + 8 * wrap , wrap); diff_pixels(s->block[3], ptr + 8 * wrap + 8, dest_y + 8 * wrap + 8, wrap); wrap >>=1; ptr = s->new_picture[1] + (mb_y * 8 * wrap) + mb_x * 8; diff_pixels(s->block[4], ptr, dest_cb, wrap); ptr = s->new_picture[2] + (mb_y * 8 * wrap) + mb_x * 8; diff_pixels(s->block[5], ptr, dest_cr, wrap); } #if 0 { float adap_parm; adap_parm = ((s->avg_mb_var << 1) + s->mb_var[s->mb_width*mb_y+mb_x] + 1.0) / ((s->mb_var[s->mb_width*mb_y+mb_x] << 1) + s->avg_mb_var + 1.0); printf("\ntype=%c qscale=%2d adap=%0.2f dquant=%4.2f var=%4d avgvar=%4d", (s->mb_type[s->mb_width*mb_y+mb_x] > 0) ? 'I' : 'P', s->qscale, adap_parm, s->qscale*adap_parm, s->mb_var[s->mb_width*mb_y+mb_x], s->avg_mb_var); } #endif if (s->h263_msmpeg4) { msmpeg4_dc_scale(s); } else if (s->h263_pred) { h263_dc_scale(s); } else { s->y_dc_scale = 8; s->c_dc_scale = 8; } for(i=0;i<6;i++) { s->block_last_index[i] = dct_quantize(s, s->block[i], i, s->qscale); } switch(s->out_format) { case FMT_MPEG1: mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; case FMT_H263: if (s->h263_msmpeg4) msmpeg4_encode_mb(s, s->block, motion_x, motion_y); else if(s->h263_pred) mpeg4_encode_mb(s, s->block, motion_x, motion_y); else h263_encode_mb(s, s->block, motion_x, motion_y); break; case FMT_MJPEG: mjpeg_encode_mb(s, s->block); break; } }
{ "code": [ " }else{", " } else {", "#endif", "#endif", "#endif", " int i;", " } else {", " for(i=0;i<6;i++) {", " s->block_last_index[i] = dct_quantize(s, s->block[i], i, s->qscale);", " } else {", " }else{", " } else {", "#endif", " } else {" ], "line_no": [ 65, 19, 27, 27, 27, 9, 189, 199, 201, 189, 65, 19, 27, 19 ] }
static void FUNC_0(MpegEncContext *VAR_0, int VAR_1, int VAR_2) { const int VAR_3= VAR_0->VAR_3; const int VAR_4= VAR_0->VAR_4; int VAR_5; #if 0 if (VAR_0->interlaced_dct) { dct_linesize = VAR_0->linesize * 2; dct_offset = VAR_0->linesize; } else { dct_linesize = VAR_0->linesize; dct_offset = VAR_0->linesize * 8; } #endif if (VAR_0->mb_intra) { UINT8 *ptr; int VAR_7; VAR_7 = VAR_0->linesize; ptr = VAR_0->new_picture[0] + (VAR_4 * 16 * VAR_7) + VAR_3 * 16; get_pixels(VAR_0->block[0], ptr , VAR_7); get_pixels(VAR_0->block[1], ptr + 8, VAR_7); get_pixels(VAR_0->block[2], ptr + 8 * VAR_7 , VAR_7); get_pixels(VAR_0->block[3], ptr + 8 * VAR_7 + 8, VAR_7); VAR_7 >>=1; ptr = VAR_0->new_picture[1] + (VAR_4 * 8 * VAR_7) + VAR_3 * 8; get_pixels(VAR_0->block[4], ptr, VAR_7); ptr = VAR_0->new_picture[2] + (VAR_4 * 8 * VAR_7) + VAR_3 * 8; get_pixels(VAR_0->block[5], ptr, VAR_7); }else{ op_pixels_func *op_pix; qpel_mc_func *op_qpix; UINT8 *dest_y, *dest_cb, *dest_cr; UINT8 *ptr; int VAR_7; dest_y = VAR_0->current_picture[0] + (VAR_4 * 16 * VAR_0->linesize ) + VAR_3 * 16; dest_cb = VAR_0->current_picture[1] + (VAR_4 * 8 * (VAR_0->linesize >> 1)) + VAR_3 * 8; dest_cr = VAR_0->current_picture[2] + (VAR_4 * 8 * (VAR_0->linesize >> 1)) + VAR_3 * 8; if ((!VAR_0->no_rounding) || VAR_0->pict_type==B_TYPE){ op_pix = put_pixels_tab; op_qpix= qpel_mc_rnd_tab; }else{ op_pix = put_no_rnd_pixels_tab; op_qpix= qpel_mc_no_rnd_tab; } if (VAR_0->mv_dir & MV_DIR_FORWARD) { MPV_motion(VAR_0, dest_y, dest_cb, dest_cr, 0, VAR_0->last_picture, op_pix, op_qpix); if ((!VAR_0->no_rounding) || VAR_0->pict_type==B_TYPE) op_pix = avg_pixels_tab; else op_pix = avg_no_rnd_pixels_tab; } if (VAR_0->mv_dir & MV_DIR_BACKWARD) { MPV_motion(VAR_0, dest_y, dest_cb, dest_cr, 1, VAR_0->next_picture, op_pix, op_qpix); } VAR_7 = VAR_0->linesize; ptr = VAR_0->new_picture[0] + (VAR_4 * 16 * VAR_7) + VAR_3 * 16; diff_pixels(VAR_0->block[0], ptr , dest_y , VAR_7); diff_pixels(VAR_0->block[1], ptr + 8, dest_y + 8, VAR_7); diff_pixels(VAR_0->block[2], ptr + 8 * VAR_7 , dest_y + 8 * VAR_7 , VAR_7); diff_pixels(VAR_0->block[3], ptr + 8 * VAR_7 + 8, dest_y + 8 * VAR_7 + 8, VAR_7); VAR_7 >>=1; ptr = VAR_0->new_picture[1] + (VAR_4 * 8 * VAR_7) + VAR_3 * 8; diff_pixels(VAR_0->block[4], ptr, dest_cb, VAR_7); ptr = VAR_0->new_picture[2] + (VAR_4 * 8 * VAR_7) + VAR_3 * 8; diff_pixels(VAR_0->block[5], ptr, dest_cr, VAR_7); } #if 0 { float adap_parm; adap_parm = ((VAR_0->avg_mb_var << 1) + VAR_0->mb_var[VAR_0->mb_width*VAR_4+VAR_3] + 1.0) / ((VAR_0->mb_var[VAR_0->mb_width*VAR_4+VAR_3] << 1) + VAR_0->avg_mb_var + 1.0); printf("\ntype=%c qscale=%2d adap=%0.2f dquant=%4.2f var=%4d avgvar=%4d", (VAR_0->mb_type[VAR_0->mb_width*VAR_4+VAR_3] > 0) ? 'I' : 'P', VAR_0->qscale, adap_parm, VAR_0->qscale*adap_parm, VAR_0->mb_var[VAR_0->mb_width*VAR_4+VAR_3], VAR_0->avg_mb_var); } #endif if (VAR_0->h263_msmpeg4) { msmpeg4_dc_scale(VAR_0); } else if (VAR_0->h263_pred) { h263_dc_scale(VAR_0); } else { VAR_0->y_dc_scale = 8; VAR_0->c_dc_scale = 8; } for(VAR_5=0;VAR_5<6;VAR_5++) { VAR_0->block_last_index[VAR_5] = dct_quantize(VAR_0, VAR_0->block[VAR_5], VAR_5, VAR_0->qscale); } switch(VAR_0->out_format) { case FMT_MPEG1: mpeg1_encode_mb(VAR_0, VAR_0->block, VAR_1, VAR_2); break; case FMT_H263: if (VAR_0->h263_msmpeg4) msmpeg4_encode_mb(VAR_0, VAR_0->block, VAR_1, VAR_2); else if(VAR_0->h263_pred) mpeg4_encode_mb(VAR_0, VAR_0->block, VAR_1, VAR_2); else h263_encode_mb(VAR_0, VAR_0->block, VAR_1, VAR_2); break; case FMT_MJPEG: mjpeg_encode_mb(VAR_0, VAR_0->block); break; } }
[ "static void FUNC_0(MpegEncContext *VAR_0, int VAR_1, int VAR_2)\n{", "const int VAR_3= VAR_0->VAR_3;", "const int VAR_4= VAR_0->VAR_4;", "int VAR_5;", "#if 0\nif (VAR_0->interlaced_dct) {", "dct_linesize = VAR_0->linesize * 2;", "dct_offset = VAR_0->linesize;", "} else {", "dct_linesize = VAR_0->linesize;", "dct_offset = VAR_0->linesize * 8;", "}", "#endif\nif (VAR_0->mb_intra) {", "UINT8 *ptr;", "int VAR_7;", "VAR_7 = VAR_0->linesize;", "ptr = VAR_0->new_picture[0] + (VAR_4 * 16 * VAR_7) + VAR_3 * 16;", "get_pixels(VAR_0->block[0], ptr , VAR_7);", "get_pixels(VAR_0->block[1], ptr + 8, VAR_7);", "get_pixels(VAR_0->block[2], ptr + 8 * VAR_7 , VAR_7);", "get_pixels(VAR_0->block[3], ptr + 8 * VAR_7 + 8, VAR_7);", "VAR_7 >>=1;", "ptr = VAR_0->new_picture[1] + (VAR_4 * 8 * VAR_7) + VAR_3 * 8;", "get_pixels(VAR_0->block[4], ptr, VAR_7);", "ptr = VAR_0->new_picture[2] + (VAR_4 * 8 * VAR_7) + VAR_3 * 8;", "get_pixels(VAR_0->block[5], ptr, VAR_7);", "}else{", "op_pixels_func *op_pix;", "qpel_mc_func *op_qpix;", "UINT8 *dest_y, *dest_cb, *dest_cr;", "UINT8 *ptr;", "int VAR_7;", "dest_y = VAR_0->current_picture[0] + (VAR_4 * 16 * VAR_0->linesize ) + VAR_3 * 16;", "dest_cb = VAR_0->current_picture[1] + (VAR_4 * 8 * (VAR_0->linesize >> 1)) + VAR_3 * 8;", "dest_cr = VAR_0->current_picture[2] + (VAR_4 * 8 * (VAR_0->linesize >> 1)) + VAR_3 * 8;", "if ((!VAR_0->no_rounding) || VAR_0->pict_type==B_TYPE){", "op_pix = put_pixels_tab;", "op_qpix= qpel_mc_rnd_tab;", "}else{", "op_pix = put_no_rnd_pixels_tab;", "op_qpix= qpel_mc_no_rnd_tab;", "}", "if (VAR_0->mv_dir & MV_DIR_FORWARD) {", "MPV_motion(VAR_0, dest_y, dest_cb, dest_cr, 0, VAR_0->last_picture, op_pix, op_qpix);", "if ((!VAR_0->no_rounding) || VAR_0->pict_type==B_TYPE)\nop_pix = avg_pixels_tab;", "else\nop_pix = avg_no_rnd_pixels_tab;", "}", "if (VAR_0->mv_dir & MV_DIR_BACKWARD) {", "MPV_motion(VAR_0, dest_y, dest_cb, dest_cr, 1, VAR_0->next_picture, op_pix, op_qpix);", "}", "VAR_7 = VAR_0->linesize;", "ptr = VAR_0->new_picture[0] + (VAR_4 * 16 * VAR_7) + VAR_3 * 16;", "diff_pixels(VAR_0->block[0], ptr , dest_y , VAR_7);", "diff_pixels(VAR_0->block[1], ptr + 8, dest_y + 8, VAR_7);", "diff_pixels(VAR_0->block[2], ptr + 8 * VAR_7 , dest_y + 8 * VAR_7 , VAR_7);", "diff_pixels(VAR_0->block[3], ptr + 8 * VAR_7 + 8, dest_y + 8 * VAR_7 + 8, VAR_7);", "VAR_7 >>=1;", "ptr = VAR_0->new_picture[1] + (VAR_4 * 8 * VAR_7) + VAR_3 * 8;", "diff_pixels(VAR_0->block[4], ptr, dest_cb, VAR_7);", "ptr = VAR_0->new_picture[2] + (VAR_4 * 8 * VAR_7) + VAR_3 * 8;", "diff_pixels(VAR_0->block[5], ptr, dest_cr, VAR_7);", "}", "#if 0\n{", "float adap_parm;", "adap_parm = ((VAR_0->avg_mb_var << 1) + VAR_0->mb_var[VAR_0->mb_width*VAR_4+VAR_3] + 1.0) /\n((VAR_0->mb_var[VAR_0->mb_width*VAR_4+VAR_3] << 1) + VAR_0->avg_mb_var + 1.0);", "printf(\"\\ntype=%c qscale=%2d adap=%0.2f dquant=%4.2f var=%4d avgvar=%4d\",\n(VAR_0->mb_type[VAR_0->mb_width*VAR_4+VAR_3] > 0) ? 'I' : 'P',\nVAR_0->qscale, adap_parm, VAR_0->qscale*adap_parm,\nVAR_0->mb_var[VAR_0->mb_width*VAR_4+VAR_3], VAR_0->avg_mb_var);", "}", "#endif\nif (VAR_0->h263_msmpeg4) {", "msmpeg4_dc_scale(VAR_0);", "} else if (VAR_0->h263_pred) {", "h263_dc_scale(VAR_0);", "} else {", "VAR_0->y_dc_scale = 8;", "VAR_0->c_dc_scale = 8;", "}", "for(VAR_5=0;VAR_5<6;VAR_5++) {", "VAR_0->block_last_index[VAR_5] = dct_quantize(VAR_0, VAR_0->block[VAR_5], VAR_5, VAR_0->qscale);", "}", "switch(VAR_0->out_format) {", "case FMT_MPEG1:\nmpeg1_encode_mb(VAR_0, VAR_0->block, VAR_1, VAR_2);", "break;", "case FMT_H263:\nif (VAR_0->h263_msmpeg4)\nmsmpeg4_encode_mb(VAR_0, VAR_0->block, VAR_1, VAR_2);", "else if(VAR_0->h263_pred)\nmpeg4_encode_mb(VAR_0, VAR_0->block, VAR_1, VAR_2);", "else\nh263_encode_mb(VAR_0, VAR_0->block, VAR_1, VAR_2);", "break;", "case FMT_MJPEG:\nmjpeg_encode_mb(VAR_0, VAR_0->block);", "break;", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 157 ], [ 161, 163 ], [ 167, 169, 171, 173 ], [ 175 ], [ 177, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 209 ], [ 211, 213 ], [ 215 ], [ 217, 219, 221 ], [ 223, 225 ], [ 227, 229 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ] ]
12,266
static int acpi_load_old(QEMUFile *f, void *opaque, int version_id) { PIIX4PMState *s = opaque; int ret, i; uint16_t temp; ret = pci_device_load(&s->dev, f); if (ret < 0) { return ret; } qemu_get_be16s(f, &s->ar.pm1.evt.sts); qemu_get_be16s(f, &s->ar.pm1.evt.en); qemu_get_be16s(f, &s->ar.pm1.cnt.cnt); ret = vmstate_load_state(f, &vmstate_apm, opaque, 1); if (ret) { return ret; } qemu_get_timer(f, s->ar.tmr.timer); qemu_get_sbe64s(f, &s->ar.tmr.overflow_time); qemu_get_be16s(f, (uint16_t *)s->ar.gpe.sts); for (i = 0; i < 3; i++) { qemu_get_be16s(f, &temp); } qemu_get_be16s(f, (uint16_t *)s->ar.gpe.en); for (i = 0; i < 3; i++) { qemu_get_be16s(f, &temp); } ret = vmstate_load_state(f, &vmstate_pci_status, opaque, 1); return ret; }
true
qemu
ded67782e6d06069873adce7f9074d273ae75760
static int acpi_load_old(QEMUFile *f, void *opaque, int version_id) { PIIX4PMState *s = opaque; int ret, i; uint16_t temp; ret = pci_device_load(&s->dev, f); if (ret < 0) { return ret; } qemu_get_be16s(f, &s->ar.pm1.evt.sts); qemu_get_be16s(f, &s->ar.pm1.evt.en); qemu_get_be16s(f, &s->ar.pm1.cnt.cnt); ret = vmstate_load_state(f, &vmstate_apm, opaque, 1); if (ret) { return ret; } qemu_get_timer(f, s->ar.tmr.timer); qemu_get_sbe64s(f, &s->ar.tmr.overflow_time); qemu_get_be16s(f, (uint16_t *)s->ar.gpe.sts); for (i = 0; i < 3; i++) { qemu_get_be16s(f, &temp); } qemu_get_be16s(f, (uint16_t *)s->ar.gpe.en); for (i = 0; i < 3; i++) { qemu_get_be16s(f, &temp); } ret = vmstate_load_state(f, &vmstate_pci_status, opaque, 1); return ret; }
{ "code": [ " ret = vmstate_load_state(f, &vmstate_apm, opaque, 1);", " ret = vmstate_load_state(f, &vmstate_pci_status, opaque, 1);" ], "line_no": [ 29, 65 ] }
static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2) { PIIX4PMState *s = VAR_1; int VAR_3, VAR_4; uint16_t temp; VAR_3 = pci_device_load(&s->dev, VAR_0); if (VAR_3 < 0) { return VAR_3; } qemu_get_be16s(VAR_0, &s->ar.pm1.evt.sts); qemu_get_be16s(VAR_0, &s->ar.pm1.evt.en); qemu_get_be16s(VAR_0, &s->ar.pm1.cnt.cnt); VAR_3 = vmstate_load_state(VAR_0, &vmstate_apm, VAR_1, 1); if (VAR_3) { return VAR_3; } qemu_get_timer(VAR_0, s->ar.tmr.timer); qemu_get_sbe64s(VAR_0, &s->ar.tmr.overflow_time); qemu_get_be16s(VAR_0, (uint16_t *)s->ar.gpe.sts); for (VAR_4 = 0; VAR_4 < 3; VAR_4++) { qemu_get_be16s(VAR_0, &temp); } qemu_get_be16s(VAR_0, (uint16_t *)s->ar.gpe.en); for (VAR_4 = 0; VAR_4 < 3; VAR_4++) { qemu_get_be16s(VAR_0, &temp); } VAR_3 = vmstate_load_state(VAR_0, &vmstate_pci_status, VAR_1, 1); return VAR_3; }
[ "static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2)\n{", "PIIX4PMState *s = VAR_1;", "int VAR_3, VAR_4;", "uint16_t temp;", "VAR_3 = pci_device_load(&s->dev, VAR_0);", "if (VAR_3 < 0) {", "return VAR_3;", "}", "qemu_get_be16s(VAR_0, &s->ar.pm1.evt.sts);", "qemu_get_be16s(VAR_0, &s->ar.pm1.evt.en);", "qemu_get_be16s(VAR_0, &s->ar.pm1.cnt.cnt);", "VAR_3 = vmstate_load_state(VAR_0, &vmstate_apm, VAR_1, 1);", "if (VAR_3) {", "return VAR_3;", "}", "qemu_get_timer(VAR_0, s->ar.tmr.timer);", "qemu_get_sbe64s(VAR_0, &s->ar.tmr.overflow_time);", "qemu_get_be16s(VAR_0, (uint16_t *)s->ar.gpe.sts);", "for (VAR_4 = 0; VAR_4 < 3; VAR_4++) {", "qemu_get_be16s(VAR_0, &temp);", "}", "qemu_get_be16s(VAR_0, (uint16_t *)s->ar.gpe.en);", "for (VAR_4 = 0; VAR_4 < 3; VAR_4++) {", "qemu_get_be16s(VAR_0, &temp);", "}", "VAR_3 = vmstate_load_state(VAR_0, &vmstate_pci_status, VAR_1, 1);", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ] ]
12,267
static int debugcon_parse(const char *devname) { QemuOpts *opts; if (!qemu_chr_new("debugcon", devname, NULL)) { exit(1); } opts = qemu_opts_create(qemu_find_opts("device"), "debugcon", 1); if (!opts) { fprintf(stderr, "qemu: already have a debugcon device\n"); exit(1); } qemu_opt_set(opts, "driver", "isa-debugcon"); qemu_opt_set(opts, "chardev", "debugcon"); return 0; }
true
qemu
8be7e7e4c72c048b90e3482557954a24bba43ba7
static int debugcon_parse(const char *devname) { QemuOpts *opts; if (!qemu_chr_new("debugcon", devname, NULL)) { exit(1); } opts = qemu_opts_create(qemu_find_opts("device"), "debugcon", 1); if (!opts) { fprintf(stderr, "qemu: already have a debugcon device\n"); exit(1); } qemu_opt_set(opts, "driver", "isa-debugcon"); qemu_opt_set(opts, "chardev", "debugcon"); return 0; }
{ "code": [ " opts = qemu_opts_create(qemu_find_opts(\"device\"), \"debugcon\", 1);" ], "line_no": [ 15 ] }
static int FUNC_0(const char *VAR_0) { QemuOpts *opts; if (!qemu_chr_new("debugcon", VAR_0, NULL)) { exit(1); } opts = qemu_opts_create(qemu_find_opts("device"), "debugcon", 1); if (!opts) { fprintf(stderr, "qemu: already have a debugcon device\n"); exit(1); } qemu_opt_set(opts, "driver", "isa-debugcon"); qemu_opt_set(opts, "chardev", "debugcon"); return 0; }
[ "static int FUNC_0(const char *VAR_0)\n{", "QemuOpts *opts;", "if (!qemu_chr_new(\"debugcon\", VAR_0, NULL)) {", "exit(1);", "}", "opts = qemu_opts_create(qemu_find_opts(\"device\"), \"debugcon\", 1);", "if (!opts) {", "fprintf(stderr, \"qemu: already have a debugcon device\\n\");", "exit(1);", "}", "qemu_opt_set(opts, \"driver\", \"isa-debugcon\");", "qemu_opt_set(opts, \"chardev\", \"debugcon\");", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
12,268
static CCIDBus *ccid_bus_new(DeviceState *dev) { CCIDBus *bus; bus = FROM_QBUS(CCIDBus, qbus_create(&ccid_bus_info, dev, NULL)); bus->qbus.allow_hotplug = 1; return bus; }
true
qemu
e13e973eedba0a52b4b8b079c4b85cdc68b7b4f0
static CCIDBus *ccid_bus_new(DeviceState *dev) { CCIDBus *bus; bus = FROM_QBUS(CCIDBus, qbus_create(&ccid_bus_info, dev, NULL)); bus->qbus.allow_hotplug = 1; return bus; }
{ "code": [ " CCIDBus *bus;", "static CCIDBus *ccid_bus_new(DeviceState *dev)", " CCIDBus *bus;", " bus = FROM_QBUS(CCIDBus, qbus_create(&ccid_bus_info, dev, NULL));", " bus->qbus.allow_hotplug = 1;", " return bus;" ], "line_no": [ 5, 1, 5, 9, 11, 15 ] }
static CCIDBus *FUNC_0(DeviceState *dev) { CCIDBus *bus; bus = FROM_QBUS(CCIDBus, qbus_create(&ccid_bus_info, dev, NULL)); bus->qbus.allow_hotplug = 1; return bus; }
[ "static CCIDBus *FUNC_0(DeviceState *dev)\n{", "CCIDBus *bus;", "bus = FROM_QBUS(CCIDBus, qbus_create(&ccid_bus_info, dev, NULL));", "bus->qbus.allow_hotplug = 1;", "return bus;", "}" ]
[ 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ] ]
12,269
bool bitmap_test_and_clear_atomic(unsigned long *map, long start, long nr) { unsigned long *p = map + BIT_WORD(start); const long size = start + nr; int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG); unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start); unsigned long dirty = 0; unsigned long old_bits; /* First word */ if (nr - bits_to_clear > 0) { old_bits = atomic_fetch_and(p, ~mask_to_clear); dirty |= old_bits & mask_to_clear; nr -= bits_to_clear; bits_to_clear = BITS_PER_LONG; mask_to_clear = ~0UL; p++; } /* Full words */ if (bits_to_clear == BITS_PER_LONG) { while (nr >= BITS_PER_LONG) { if (*p) { old_bits = atomic_xchg(p, 0); dirty |= old_bits; } nr -= BITS_PER_LONG; p++; } } /* Last word */ if (nr) { mask_to_clear &= BITMAP_LAST_WORD_MASK(size); old_bits = atomic_fetch_and(p, ~mask_to_clear); dirty |= old_bits & mask_to_clear; } else { if (!dirty) { smp_mb(); } } return dirty != 0; }
true
qemu
e12ed72e5c00dd3375b8bd107200e4d7e950276a
bool bitmap_test_and_clear_atomic(unsigned long *map, long start, long nr) { unsigned long *p = map + BIT_WORD(start); const long size = start + nr; int bits_to_clear = BITS_PER_LONG - (start % BITS_PER_LONG); unsigned long mask_to_clear = BITMAP_FIRST_WORD_MASK(start); unsigned long dirty = 0; unsigned long old_bits; if (nr - bits_to_clear > 0) { old_bits = atomic_fetch_and(p, ~mask_to_clear); dirty |= old_bits & mask_to_clear; nr -= bits_to_clear; bits_to_clear = BITS_PER_LONG; mask_to_clear = ~0UL; p++; } if (bits_to_clear == BITS_PER_LONG) { while (nr >= BITS_PER_LONG) { if (*p) { old_bits = atomic_xchg(p, 0); dirty |= old_bits; } nr -= BITS_PER_LONG; p++; } } if (nr) { mask_to_clear &= BITMAP_LAST_WORD_MASK(size); old_bits = atomic_fetch_and(p, ~mask_to_clear); dirty |= old_bits & mask_to_clear; } else { if (!dirty) { smp_mb(); } } return dirty != 0; }
{ "code": [], "line_no": [] }
bool FUNC_0(unsigned long *map, long start, long nr) { unsigned long *VAR_0 = map + BIT_WORD(start); const long VAR_1 = start + nr; int VAR_2 = BITS_PER_LONG - (start % BITS_PER_LONG); unsigned long VAR_3 = BITMAP_FIRST_WORD_MASK(start); unsigned long VAR_4 = 0; unsigned long VAR_5; if (nr - VAR_2 > 0) { VAR_5 = atomic_fetch_and(VAR_0, ~VAR_3); VAR_4 |= VAR_5 & VAR_3; nr -= VAR_2; VAR_2 = BITS_PER_LONG; VAR_3 = ~0UL; VAR_0++; } if (VAR_2 == BITS_PER_LONG) { while (nr >= BITS_PER_LONG) { if (*VAR_0) { VAR_5 = atomic_xchg(VAR_0, 0); VAR_4 |= VAR_5; } nr -= BITS_PER_LONG; VAR_0++; } } if (nr) { VAR_3 &= BITMAP_LAST_WORD_MASK(VAR_1); VAR_5 = atomic_fetch_and(VAR_0, ~VAR_3); VAR_4 |= VAR_5 & VAR_3; } else { if (!VAR_4) { smp_mb(); } } return VAR_4 != 0; }
[ "bool FUNC_0(unsigned long *map, long start, long nr)\n{", "unsigned long *VAR_0 = map + BIT_WORD(start);", "const long VAR_1 = start + nr;", "int VAR_2 = BITS_PER_LONG - (start % BITS_PER_LONG);", "unsigned long VAR_3 = BITMAP_FIRST_WORD_MASK(start);", "unsigned long VAR_4 = 0;", "unsigned long VAR_5;", "if (nr - VAR_2 > 0) {", "VAR_5 = atomic_fetch_and(VAR_0, ~VAR_3);", "VAR_4 |= VAR_5 & VAR_3;", "nr -= VAR_2;", "VAR_2 = BITS_PER_LONG;", "VAR_3 = ~0UL;", "VAR_0++;", "}", "if (VAR_2 == BITS_PER_LONG) {", "while (nr >= BITS_PER_LONG) {", "if (*VAR_0) {", "VAR_5 = atomic_xchg(VAR_0, 0);", "VAR_4 |= VAR_5;", "}", "nr -= BITS_PER_LONG;", "VAR_0++;", "}", "}", "if (nr) {", "VAR_3 &= BITMAP_LAST_WORD_MASK(VAR_1);", "VAR_5 = atomic_fetch_and(VAR_0, ~VAR_3);", "VAR_4 |= VAR_5 & VAR_3;", "} else {", "if (!VAR_4) {", "smp_mb();", "}", "}", "return VAR_4 != 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ] ]
12,270
int ff_dca_lbr_parse(DCALbrDecoder *s, uint8_t *data, DCAExssAsset *asset) { struct { LBRChunk lfe; LBRChunk tonal; LBRChunk tonal_grp[5]; LBRChunk grid1[DCA_LBR_CHANNELS / 2]; LBRChunk hr_grid[DCA_LBR_CHANNELS / 2]; LBRChunk ts1[DCA_LBR_CHANNELS / 2]; LBRChunk ts2[DCA_LBR_CHANNELS / 2]; } chunk = { 0 }; GetByteContext gb; int i, ch, sb, sf, ret, group, chunk_id, chunk_len; bytestream2_init(&gb, data + asset->lbr_offset, asset->lbr_size); // LBR sync word if (bytestream2_get_be32(&gb) != DCA_SYNCWORD_LBR) { av_log(s->avctx, AV_LOG_ERROR, "Invalid LBR sync word\n"); return AVERROR_INVALIDDATA; } // LBR header type switch (bytestream2_get_byte(&gb)) { case LBR_HEADER_SYNC_ONLY: if (!s->sample_rate) { av_log(s->avctx, AV_LOG_ERROR, "LBR decoder not initialized\n"); return AVERROR_INVALIDDATA; } break; case LBR_HEADER_DECODER_INIT: if ((ret = parse_decoder_init(s, &gb)) < 0) { s->sample_rate = 0; return ret; } break; default: av_log(s->avctx, AV_LOG_ERROR, "Invalid LBR header type\n"); return AVERROR_INVALIDDATA; } // LBR frame chunk header chunk_id = bytestream2_get_byte(&gb); chunk_len = (chunk_id & 0x80) ? bytestream2_get_be16(&gb) : bytestream2_get_byte(&gb); if (chunk_len > bytestream2_get_bytes_left(&gb)) { chunk_len = bytestream2_get_bytes_left(&gb); av_log(s->avctx, AV_LOG_WARNING, "LBR frame chunk was truncated\n"); if (s->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } bytestream2_init(&gb, gb.buffer, chunk_len); switch (chunk_id & 0x7f) { case LBR_CHUNK_FRAME: if (s->avctx->err_recognition & (AV_EF_CRCCHECK | AV_EF_CAREFUL)) { int checksum = bytestream2_get_be16(&gb); uint16_t res = chunk_id; res += (chunk_len >> 8) & 0xff; res += chunk_len & 0xff; for (i = 0; i < chunk_len - 2; i++) res += gb.buffer[i]; if (checksum != res) { av_log(s->avctx, AV_LOG_WARNING, "Invalid LBR checksum\n"); if (s->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } } else { bytestream2_skip(&gb, 2); } break; case LBR_CHUNK_FRAME_NO_CSUM: break; default: av_log(s->avctx, AV_LOG_ERROR, "Invalid LBR frame chunk ID\n"); return AVERROR_INVALIDDATA; } // Clear current frame memset(s->quant_levels, 0, sizeof(s->quant_levels)); memset(s->sb_indices, 0xff, sizeof(s->sb_indices)); memset(s->sec_ch_sbms, 0, sizeof(s->sec_ch_sbms)); memset(s->sec_ch_lrms, 0, sizeof(s->sec_ch_lrms)); memset(s->ch_pres, 0, sizeof(s->ch_pres)); memset(s->grid_1_scf, 0, sizeof(s->grid_1_scf)); memset(s->grid_2_scf, 0, sizeof(s->grid_2_scf)); memset(s->grid_3_avg, 0, sizeof(s->grid_3_avg)); memset(s->grid_3_scf, 0, sizeof(s->grid_3_scf)); memset(s->grid_3_pres, 0, sizeof(s->grid_3_pres)); memset(s->tonal_scf, 0, sizeof(s->tonal_scf)); memset(s->lfe_data, 0, sizeof(s->lfe_data)); s->part_stereo_pres = 0; s->framenum = (s->framenum + 1) & 31; for (ch = 0; ch < s->nchannels; ch++) { for (sb = 0; sb < s->nsubbands / 4; sb++) { s->part_stereo[ch][sb][0] = s->part_stereo[ch][sb][4]; s->part_stereo[ch][sb][4] = 16; } } memset(s->lpc_coeff[s->framenum & 1], 0, sizeof(s->lpc_coeff[0])); for (group = 0; group < 5; group++) { for (sf = 0; sf < 1 << group; sf++) { int sf_idx = ((s->framenum << group) + sf) & 31; s->tonal_bounds[group][sf_idx][0] = s->tonal_bounds[group][sf_idx][1] = s->ntones; } } // Parse chunk headers while (bytestream2_get_bytes_left(&gb) > 0) { chunk_id = bytestream2_get_byte(&gb); chunk_len = (chunk_id & 0x80) ? bytestream2_get_be16(&gb) : bytestream2_get_byte(&gb); chunk_id &= 0x7f; if (chunk_len > bytestream2_get_bytes_left(&gb)) { chunk_len = bytestream2_get_bytes_left(&gb); av_log(s->avctx, AV_LOG_WARNING, "LBR chunk %#x was truncated\n", chunk_id); if (s->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } switch (chunk_id) { case LBR_CHUNK_LFE: chunk.lfe.len = chunk_len; chunk.lfe.data = gb.buffer; break; case LBR_CHUNK_SCF: case LBR_CHUNK_TONAL: case LBR_CHUNK_TONAL_SCF: chunk.tonal.id = chunk_id; chunk.tonal.len = chunk_len; chunk.tonal.data = gb.buffer; break; case LBR_CHUNK_TONAL_GRP_1: case LBR_CHUNK_TONAL_GRP_2: case LBR_CHUNK_TONAL_GRP_3: case LBR_CHUNK_TONAL_GRP_4: case LBR_CHUNK_TONAL_GRP_5: i = LBR_CHUNK_TONAL_GRP_5 - chunk_id; chunk.tonal_grp[i].id = i; chunk.tonal_grp[i].len = chunk_len; chunk.tonal_grp[i].data = gb.buffer; break; case LBR_CHUNK_TONAL_SCF_GRP_1: case LBR_CHUNK_TONAL_SCF_GRP_2: case LBR_CHUNK_TONAL_SCF_GRP_3: case LBR_CHUNK_TONAL_SCF_GRP_4: case LBR_CHUNK_TONAL_SCF_GRP_5: i = LBR_CHUNK_TONAL_SCF_GRP_5 - chunk_id; chunk.tonal_grp[i].id = i; chunk.tonal_grp[i].len = chunk_len; chunk.tonal_grp[i].data = gb.buffer; break; case LBR_CHUNK_RES_GRID_LR: case LBR_CHUNK_RES_GRID_LR + 1: case LBR_CHUNK_RES_GRID_LR + 2: i = chunk_id - LBR_CHUNK_RES_GRID_LR; chunk.grid1[i].len = chunk_len; chunk.grid1[i].data = gb.buffer; break; case LBR_CHUNK_RES_GRID_HR: case LBR_CHUNK_RES_GRID_HR + 1: case LBR_CHUNK_RES_GRID_HR + 2: i = chunk_id - LBR_CHUNK_RES_GRID_HR; chunk.hr_grid[i].len = chunk_len; chunk.hr_grid[i].data = gb.buffer; break; case LBR_CHUNK_RES_TS_1: case LBR_CHUNK_RES_TS_1 + 1: case LBR_CHUNK_RES_TS_1 + 2: i = chunk_id - LBR_CHUNK_RES_TS_1; chunk.ts1[i].len = chunk_len; chunk.ts1[i].data = gb.buffer; break; case LBR_CHUNK_RES_TS_2: case LBR_CHUNK_RES_TS_2 + 1: case LBR_CHUNK_RES_TS_2 + 2: i = chunk_id - LBR_CHUNK_RES_TS_2; chunk.ts2[i].len = chunk_len; chunk.ts2[i].data = gb.buffer; break; } bytestream2_skip(&gb, chunk_len); } // Parse the chunks ret = parse_lfe_chunk(s, &chunk.lfe); ret |= parse_tonal_chunk(s, &chunk.tonal); for (i = 0; i < 5; i++) ret |= parse_tonal_group(s, &chunk.tonal_grp[i]); for (i = 0; i < (s->nchannels + 1) / 2; i++) { int ch1 = i * 2; int ch2 = FFMIN(ch1 + 1, s->nchannels - 1); if (parse_grid_1_chunk (s, &chunk.grid1 [i], ch1, ch2) < 0 || parse_high_res_grid(s, &chunk.hr_grid[i], ch1, ch2) < 0) { ret = -1; continue; } // TS chunks depend on both grids. TS_2 depends on TS_1. if (!chunk.grid1[i].len || !chunk.hr_grid[i].len || !chunk.ts1[i].len) continue; if (parse_ts1_chunk(s, &chunk.ts1[i], ch1, ch2) < 0 || parse_ts2_chunk(s, &chunk.ts2[i], ch1, ch2) < 0) { ret = -1; continue; } } if (ret < 0 && (s->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; return 0; }
true
FFmpeg
bf29794022db597f526a8575648244a7c6ee15ed
int ff_dca_lbr_parse(DCALbrDecoder *s, uint8_t *data, DCAExssAsset *asset) { struct { LBRChunk lfe; LBRChunk tonal; LBRChunk tonal_grp[5]; LBRChunk grid1[DCA_LBR_CHANNELS / 2]; LBRChunk hr_grid[DCA_LBR_CHANNELS / 2]; LBRChunk ts1[DCA_LBR_CHANNELS / 2]; LBRChunk ts2[DCA_LBR_CHANNELS / 2]; } chunk = { 0 }; GetByteContext gb; int i, ch, sb, sf, ret, group, chunk_id, chunk_len; bytestream2_init(&gb, data + asset->lbr_offset, asset->lbr_size); if (bytestream2_get_be32(&gb) != DCA_SYNCWORD_LBR) { av_log(s->avctx, AV_LOG_ERROR, "Invalid LBR sync word\n"); return AVERROR_INVALIDDATA; } switch (bytestream2_get_byte(&gb)) { case LBR_HEADER_SYNC_ONLY: if (!s->sample_rate) { av_log(s->avctx, AV_LOG_ERROR, "LBR decoder not initialized\n"); return AVERROR_INVALIDDATA; } break; case LBR_HEADER_DECODER_INIT: if ((ret = parse_decoder_init(s, &gb)) < 0) { s->sample_rate = 0; return ret; } break; default: av_log(s->avctx, AV_LOG_ERROR, "Invalid LBR header type\n"); return AVERROR_INVALIDDATA; } chunk_id = bytestream2_get_byte(&gb); chunk_len = (chunk_id & 0x80) ? bytestream2_get_be16(&gb) : bytestream2_get_byte(&gb); if (chunk_len > bytestream2_get_bytes_left(&gb)) { chunk_len = bytestream2_get_bytes_left(&gb); av_log(s->avctx, AV_LOG_WARNING, "LBR frame chunk was truncated\n"); if (s->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } bytestream2_init(&gb, gb.buffer, chunk_len); switch (chunk_id & 0x7f) { case LBR_CHUNK_FRAME: if (s->avctx->err_recognition & (AV_EF_CRCCHECK | AV_EF_CAREFUL)) { int checksum = bytestream2_get_be16(&gb); uint16_t res = chunk_id; res += (chunk_len >> 8) & 0xff; res += chunk_len & 0xff; for (i = 0; i < chunk_len - 2; i++) res += gb.buffer[i]; if (checksum != res) { av_log(s->avctx, AV_LOG_WARNING, "Invalid LBR checksum\n"); if (s->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } } else { bytestream2_skip(&gb, 2); } break; case LBR_CHUNK_FRAME_NO_CSUM: break; default: av_log(s->avctx, AV_LOG_ERROR, "Invalid LBR frame chunk ID\n"); return AVERROR_INVALIDDATA; } memset(s->quant_levels, 0, sizeof(s->quant_levels)); memset(s->sb_indices, 0xff, sizeof(s->sb_indices)); memset(s->sec_ch_sbms, 0, sizeof(s->sec_ch_sbms)); memset(s->sec_ch_lrms, 0, sizeof(s->sec_ch_lrms)); memset(s->ch_pres, 0, sizeof(s->ch_pres)); memset(s->grid_1_scf, 0, sizeof(s->grid_1_scf)); memset(s->grid_2_scf, 0, sizeof(s->grid_2_scf)); memset(s->grid_3_avg, 0, sizeof(s->grid_3_avg)); memset(s->grid_3_scf, 0, sizeof(s->grid_3_scf)); memset(s->grid_3_pres, 0, sizeof(s->grid_3_pres)); memset(s->tonal_scf, 0, sizeof(s->tonal_scf)); memset(s->lfe_data, 0, sizeof(s->lfe_data)); s->part_stereo_pres = 0; s->framenum = (s->framenum + 1) & 31; for (ch = 0; ch < s->nchannels; ch++) { for (sb = 0; sb < s->nsubbands / 4; sb++) { s->part_stereo[ch][sb][0] = s->part_stereo[ch][sb][4]; s->part_stereo[ch][sb][4] = 16; } } memset(s->lpc_coeff[s->framenum & 1], 0, sizeof(s->lpc_coeff[0])); for (group = 0; group < 5; group++) { for (sf = 0; sf < 1 << group; sf++) { int sf_idx = ((s->framenum << group) + sf) & 31; s->tonal_bounds[group][sf_idx][0] = s->tonal_bounds[group][sf_idx][1] = s->ntones; } } while (bytestream2_get_bytes_left(&gb) > 0) { chunk_id = bytestream2_get_byte(&gb); chunk_len = (chunk_id & 0x80) ? bytestream2_get_be16(&gb) : bytestream2_get_byte(&gb); chunk_id &= 0x7f; if (chunk_len > bytestream2_get_bytes_left(&gb)) { chunk_len = bytestream2_get_bytes_left(&gb); av_log(s->avctx, AV_LOG_WARNING, "LBR chunk %#x was truncated\n", chunk_id); if (s->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } switch (chunk_id) { case LBR_CHUNK_LFE: chunk.lfe.len = chunk_len; chunk.lfe.data = gb.buffer; break; case LBR_CHUNK_SCF: case LBR_CHUNK_TONAL: case LBR_CHUNK_TONAL_SCF: chunk.tonal.id = chunk_id; chunk.tonal.len = chunk_len; chunk.tonal.data = gb.buffer; break; case LBR_CHUNK_TONAL_GRP_1: case LBR_CHUNK_TONAL_GRP_2: case LBR_CHUNK_TONAL_GRP_3: case LBR_CHUNK_TONAL_GRP_4: case LBR_CHUNK_TONAL_GRP_5: i = LBR_CHUNK_TONAL_GRP_5 - chunk_id; chunk.tonal_grp[i].id = i; chunk.tonal_grp[i].len = chunk_len; chunk.tonal_grp[i].data = gb.buffer; break; case LBR_CHUNK_TONAL_SCF_GRP_1: case LBR_CHUNK_TONAL_SCF_GRP_2: case LBR_CHUNK_TONAL_SCF_GRP_3: case LBR_CHUNK_TONAL_SCF_GRP_4: case LBR_CHUNK_TONAL_SCF_GRP_5: i = LBR_CHUNK_TONAL_SCF_GRP_5 - chunk_id; chunk.tonal_grp[i].id = i; chunk.tonal_grp[i].len = chunk_len; chunk.tonal_grp[i].data = gb.buffer; break; case LBR_CHUNK_RES_GRID_LR: case LBR_CHUNK_RES_GRID_LR + 1: case LBR_CHUNK_RES_GRID_LR + 2: i = chunk_id - LBR_CHUNK_RES_GRID_LR; chunk.grid1[i].len = chunk_len; chunk.grid1[i].data = gb.buffer; break; case LBR_CHUNK_RES_GRID_HR: case LBR_CHUNK_RES_GRID_HR + 1: case LBR_CHUNK_RES_GRID_HR + 2: i = chunk_id - LBR_CHUNK_RES_GRID_HR; chunk.hr_grid[i].len = chunk_len; chunk.hr_grid[i].data = gb.buffer; break; case LBR_CHUNK_RES_TS_1: case LBR_CHUNK_RES_TS_1 + 1: case LBR_CHUNK_RES_TS_1 + 2: i = chunk_id - LBR_CHUNK_RES_TS_1; chunk.ts1[i].len = chunk_len; chunk.ts1[i].data = gb.buffer; break; case LBR_CHUNK_RES_TS_2: case LBR_CHUNK_RES_TS_2 + 1: case LBR_CHUNK_RES_TS_2 + 2: i = chunk_id - LBR_CHUNK_RES_TS_2; chunk.ts2[i].len = chunk_len; chunk.ts2[i].data = gb.buffer; break; } bytestream2_skip(&gb, chunk_len); } ret = parse_lfe_chunk(s, &chunk.lfe); ret |= parse_tonal_chunk(s, &chunk.tonal); for (i = 0; i < 5; i++) ret |= parse_tonal_group(s, &chunk.tonal_grp[i]); for (i = 0; i < (s->nchannels + 1) / 2; i++) { int ch1 = i * 2; int ch2 = FFMIN(ch1 + 1, s->nchannels - 1); if (parse_grid_1_chunk (s, &chunk.grid1 [i], ch1, ch2) < 0 || parse_high_res_grid(s, &chunk.hr_grid[i], ch1, ch2) < 0) { ret = -1; continue; } if (!chunk.grid1[i].len || !chunk.hr_grid[i].len || !chunk.ts1[i].len) continue; if (parse_ts1_chunk(s, &chunk.ts1[i], ch1, ch2) < 0 || parse_ts2_chunk(s, &chunk.ts2[i], ch1, ch2) < 0) { ret = -1; continue; } } if (ret < 0 && (s->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; return 0; }
{ "code": [ " } chunk = { 0 };" ], "line_no": [ 21 ] }
int FUNC_0(DCALbrDecoder *VAR_0, uint8_t *VAR_1, DCAExssAsset *VAR_2) { struct { LBRChunk lfe; LBRChunk tonal; LBRChunk tonal_grp[5]; LBRChunk grid1[DCA_LBR_CHANNELS / 2]; LBRChunk hr_grid[DCA_LBR_CHANNELS / 2]; LBRChunk ts1[DCA_LBR_CHANNELS / 2]; LBRChunk ts2[DCA_LBR_CHANNELS / 2]; } VAR_3 = { 0 }; GetByteContext gb; int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11; bytestream2_init(&gb, VAR_1 + VAR_2->lbr_offset, VAR_2->lbr_size); if (bytestream2_get_be32(&gb) != DCA_SYNCWORD_LBR) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid LBR sync word\n"); return AVERROR_INVALIDDATA; } switch (bytestream2_get_byte(&gb)) { case LBR_HEADER_SYNC_ONLY: if (!VAR_0->sample_rate) { av_log(VAR_0->avctx, AV_LOG_ERROR, "LBR decoder not initialized\n"); return AVERROR_INVALIDDATA; } break; case LBR_HEADER_DECODER_INIT: if ((VAR_8 = parse_decoder_init(VAR_0, &gb)) < 0) { VAR_0->sample_rate = 0; return VAR_8; } break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid LBR header type\n"); return AVERROR_INVALIDDATA; } VAR_10 = bytestream2_get_byte(&gb); VAR_11 = (VAR_10 & 0x80) ? bytestream2_get_be16(&gb) : bytestream2_get_byte(&gb); if (VAR_11 > bytestream2_get_bytes_left(&gb)) { VAR_11 = bytestream2_get_bytes_left(&gb); av_log(VAR_0->avctx, AV_LOG_WARNING, "LBR frame VAR_3 was truncated\n"); if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } bytestream2_init(&gb, gb.buffer, VAR_11); switch (VAR_10 & 0x7f) { case LBR_CHUNK_FRAME: if (VAR_0->avctx->err_recognition & (AV_EF_CRCCHECK | AV_EF_CAREFUL)) { int VAR_12 = bytestream2_get_be16(&gb); uint16_t res = VAR_10; res += (VAR_11 >> 8) & 0xff; res += VAR_11 & 0xff; for (VAR_4 = 0; VAR_4 < VAR_11 - 2; VAR_4++) res += gb.buffer[VAR_4]; if (VAR_12 != res) { av_log(VAR_0->avctx, AV_LOG_WARNING, "Invalid LBR VAR_12\n"); if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } } else { bytestream2_skip(&gb, 2); } break; case LBR_CHUNK_FRAME_NO_CSUM: break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "Invalid LBR frame VAR_3 ID\n"); return AVERROR_INVALIDDATA; } memset(VAR_0->quant_levels, 0, sizeof(VAR_0->quant_levels)); memset(VAR_0->sb_indices, 0xff, sizeof(VAR_0->sb_indices)); memset(VAR_0->sec_ch_sbms, 0, sizeof(VAR_0->sec_ch_sbms)); memset(VAR_0->sec_ch_lrms, 0, sizeof(VAR_0->sec_ch_lrms)); memset(VAR_0->ch_pres, 0, sizeof(VAR_0->ch_pres)); memset(VAR_0->grid_1_scf, 0, sizeof(VAR_0->grid_1_scf)); memset(VAR_0->grid_2_scf, 0, sizeof(VAR_0->grid_2_scf)); memset(VAR_0->grid_3_avg, 0, sizeof(VAR_0->grid_3_avg)); memset(VAR_0->grid_3_scf, 0, sizeof(VAR_0->grid_3_scf)); memset(VAR_0->grid_3_pres, 0, sizeof(VAR_0->grid_3_pres)); memset(VAR_0->tonal_scf, 0, sizeof(VAR_0->tonal_scf)); memset(VAR_0->lfe_data, 0, sizeof(VAR_0->lfe_data)); VAR_0->part_stereo_pres = 0; VAR_0->framenum = (VAR_0->framenum + 1) & 31; for (VAR_5 = 0; VAR_5 < VAR_0->nchannels; VAR_5++) { for (VAR_6 = 0; VAR_6 < VAR_0->nsubbands / 4; VAR_6++) { VAR_0->part_stereo[VAR_5][VAR_6][0] = VAR_0->part_stereo[VAR_5][VAR_6][4]; VAR_0->part_stereo[VAR_5][VAR_6][4] = 16; } } memset(VAR_0->lpc_coeff[VAR_0->framenum & 1], 0, sizeof(VAR_0->lpc_coeff[0])); for (VAR_9 = 0; VAR_9 < 5; VAR_9++) { for (VAR_7 = 0; VAR_7 < 1 << VAR_9; VAR_7++) { int VAR_13 = ((VAR_0->framenum << VAR_9) + VAR_7) & 31; VAR_0->tonal_bounds[VAR_9][VAR_13][0] = VAR_0->tonal_bounds[VAR_9][VAR_13][1] = VAR_0->ntones; } } while (bytestream2_get_bytes_left(&gb) > 0) { VAR_10 = bytestream2_get_byte(&gb); VAR_11 = (VAR_10 & 0x80) ? bytestream2_get_be16(&gb) : bytestream2_get_byte(&gb); VAR_10 &= 0x7f; if (VAR_11 > bytestream2_get_bytes_left(&gb)) { VAR_11 = bytestream2_get_bytes_left(&gb); av_log(VAR_0->avctx, AV_LOG_WARNING, "LBR VAR_3 %#x was truncated\n", VAR_10); if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } switch (VAR_10) { case LBR_CHUNK_LFE: VAR_3.lfe.len = VAR_11; VAR_3.lfe.VAR_1 = gb.buffer; break; case LBR_CHUNK_SCF: case LBR_CHUNK_TONAL: case LBR_CHUNK_TONAL_SCF: VAR_3.tonal.id = VAR_10; VAR_3.tonal.len = VAR_11; VAR_3.tonal.VAR_1 = gb.buffer; break; case LBR_CHUNK_TONAL_GRP_1: case LBR_CHUNK_TONAL_GRP_2: case LBR_CHUNK_TONAL_GRP_3: case LBR_CHUNK_TONAL_GRP_4: case LBR_CHUNK_TONAL_GRP_5: VAR_4 = LBR_CHUNK_TONAL_GRP_5 - VAR_10; VAR_3.tonal_grp[VAR_4].id = VAR_4; VAR_3.tonal_grp[VAR_4].len = VAR_11; VAR_3.tonal_grp[VAR_4].VAR_1 = gb.buffer; break; case LBR_CHUNK_TONAL_SCF_GRP_1: case LBR_CHUNK_TONAL_SCF_GRP_2: case LBR_CHUNK_TONAL_SCF_GRP_3: case LBR_CHUNK_TONAL_SCF_GRP_4: case LBR_CHUNK_TONAL_SCF_GRP_5: VAR_4 = LBR_CHUNK_TONAL_SCF_GRP_5 - VAR_10; VAR_3.tonal_grp[VAR_4].id = VAR_4; VAR_3.tonal_grp[VAR_4].len = VAR_11; VAR_3.tonal_grp[VAR_4].VAR_1 = gb.buffer; break; case LBR_CHUNK_RES_GRID_LR: case LBR_CHUNK_RES_GRID_LR + 1: case LBR_CHUNK_RES_GRID_LR + 2: VAR_4 = VAR_10 - LBR_CHUNK_RES_GRID_LR; VAR_3.grid1[VAR_4].len = VAR_11; VAR_3.grid1[VAR_4].VAR_1 = gb.buffer; break; case LBR_CHUNK_RES_GRID_HR: case LBR_CHUNK_RES_GRID_HR + 1: case LBR_CHUNK_RES_GRID_HR + 2: VAR_4 = VAR_10 - LBR_CHUNK_RES_GRID_HR; VAR_3.hr_grid[VAR_4].len = VAR_11; VAR_3.hr_grid[VAR_4].VAR_1 = gb.buffer; break; case LBR_CHUNK_RES_TS_1: case LBR_CHUNK_RES_TS_1 + 1: case LBR_CHUNK_RES_TS_1 + 2: VAR_4 = VAR_10 - LBR_CHUNK_RES_TS_1; VAR_3.ts1[VAR_4].len = VAR_11; VAR_3.ts1[VAR_4].VAR_1 = gb.buffer; break; case LBR_CHUNK_RES_TS_2: case LBR_CHUNK_RES_TS_2 + 1: case LBR_CHUNK_RES_TS_2 + 2: VAR_4 = VAR_10 - LBR_CHUNK_RES_TS_2; VAR_3.ts2[VAR_4].len = VAR_11; VAR_3.ts2[VAR_4].VAR_1 = gb.buffer; break; } bytestream2_skip(&gb, VAR_11); } VAR_8 = parse_lfe_chunk(VAR_0, &VAR_3.lfe); VAR_8 |= parse_tonal_chunk(VAR_0, &VAR_3.tonal); for (VAR_4 = 0; VAR_4 < 5; VAR_4++) VAR_8 |= parse_tonal_group(VAR_0, &VAR_3.tonal_grp[VAR_4]); for (VAR_4 = 0; VAR_4 < (VAR_0->nchannels + 1) / 2; VAR_4++) { int ch1 = VAR_4 * 2; int ch2 = FFMIN(ch1 + 1, VAR_0->nchannels - 1); if (parse_grid_1_chunk (VAR_0, &VAR_3.grid1 [VAR_4], ch1, ch2) < 0 || parse_high_res_grid(VAR_0, &VAR_3.hr_grid[VAR_4], ch1, ch2) < 0) { VAR_8 = -1; continue; } if (!VAR_3.grid1[VAR_4].len || !VAR_3.hr_grid[VAR_4].len || !VAR_3.ts1[VAR_4].len) continue; if (parse_ts1_chunk(VAR_0, &VAR_3.ts1[VAR_4], ch1, ch2) < 0 || parse_ts2_chunk(VAR_0, &VAR_3.ts2[VAR_4], ch1, ch2) < 0) { VAR_8 = -1; continue; } } if (VAR_8 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)) return AVERROR_INVALIDDATA; return 0; }
[ "int FUNC_0(DCALbrDecoder *VAR_0, uint8_t *VAR_1, DCAExssAsset *VAR_2)\n{", "struct {", "LBRChunk lfe;", "LBRChunk tonal;", "LBRChunk tonal_grp[5];", "LBRChunk grid1[DCA_LBR_CHANNELS / 2];", "LBRChunk hr_grid[DCA_LBR_CHANNELS / 2];", "LBRChunk ts1[DCA_LBR_CHANNELS / 2];", "LBRChunk ts2[DCA_LBR_CHANNELS / 2];", "} VAR_3 = { 0 };", "GetByteContext gb;", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10, VAR_11;", "bytestream2_init(&gb, VAR_1 + VAR_2->lbr_offset, VAR_2->lbr_size);", "if (bytestream2_get_be32(&gb) != DCA_SYNCWORD_LBR) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid LBR sync word\\n\");", "return AVERROR_INVALIDDATA;", "}", "switch (bytestream2_get_byte(&gb)) {", "case LBR_HEADER_SYNC_ONLY:\nif (!VAR_0->sample_rate) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"LBR decoder not initialized\\n\");", "return AVERROR_INVALIDDATA;", "}", "break;", "case LBR_HEADER_DECODER_INIT:\nif ((VAR_8 = parse_decoder_init(VAR_0, &gb)) < 0) {", "VAR_0->sample_rate = 0;", "return VAR_8;", "}", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid LBR header type\\n\");", "return AVERROR_INVALIDDATA;", "}", "VAR_10 = bytestream2_get_byte(&gb);", "VAR_11 = (VAR_10 & 0x80) ? bytestream2_get_be16(&gb) : bytestream2_get_byte(&gb);", "if (VAR_11 > bytestream2_get_bytes_left(&gb)) {", "VAR_11 = bytestream2_get_bytes_left(&gb);", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"LBR frame VAR_3 was truncated\\n\");", "if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)\nreturn AVERROR_INVALIDDATA;", "}", "bytestream2_init(&gb, gb.buffer, VAR_11);", "switch (VAR_10 & 0x7f) {", "case LBR_CHUNK_FRAME:\nif (VAR_0->avctx->err_recognition & (AV_EF_CRCCHECK | AV_EF_CAREFUL)) {", "int VAR_12 = bytestream2_get_be16(&gb);", "uint16_t res = VAR_10;", "res += (VAR_11 >> 8) & 0xff;", "res += VAR_11 & 0xff;", "for (VAR_4 = 0; VAR_4 < VAR_11 - 2; VAR_4++)", "res += gb.buffer[VAR_4];", "if (VAR_12 != res) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"Invalid LBR VAR_12\\n\");", "if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)\nreturn AVERROR_INVALIDDATA;", "}", "} else {", "bytestream2_skip(&gb, 2);", "}", "break;", "case LBR_CHUNK_FRAME_NO_CSUM:\nbreak;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"Invalid LBR frame VAR_3 ID\\n\");", "return AVERROR_INVALIDDATA;", "}", "memset(VAR_0->quant_levels, 0, sizeof(VAR_0->quant_levels));", "memset(VAR_0->sb_indices, 0xff, sizeof(VAR_0->sb_indices));", "memset(VAR_0->sec_ch_sbms, 0, sizeof(VAR_0->sec_ch_sbms));", "memset(VAR_0->sec_ch_lrms, 0, sizeof(VAR_0->sec_ch_lrms));", "memset(VAR_0->ch_pres, 0, sizeof(VAR_0->ch_pres));", "memset(VAR_0->grid_1_scf, 0, sizeof(VAR_0->grid_1_scf));", "memset(VAR_0->grid_2_scf, 0, sizeof(VAR_0->grid_2_scf));", "memset(VAR_0->grid_3_avg, 0, sizeof(VAR_0->grid_3_avg));", "memset(VAR_0->grid_3_scf, 0, sizeof(VAR_0->grid_3_scf));", "memset(VAR_0->grid_3_pres, 0, sizeof(VAR_0->grid_3_pres));", "memset(VAR_0->tonal_scf, 0, sizeof(VAR_0->tonal_scf));", "memset(VAR_0->lfe_data, 0, sizeof(VAR_0->lfe_data));", "VAR_0->part_stereo_pres = 0;", "VAR_0->framenum = (VAR_0->framenum + 1) & 31;", "for (VAR_5 = 0; VAR_5 < VAR_0->nchannels; VAR_5++) {", "for (VAR_6 = 0; VAR_6 < VAR_0->nsubbands / 4; VAR_6++) {", "VAR_0->part_stereo[VAR_5][VAR_6][0] = VAR_0->part_stereo[VAR_5][VAR_6][4];", "VAR_0->part_stereo[VAR_5][VAR_6][4] = 16;", "}", "}", "memset(VAR_0->lpc_coeff[VAR_0->framenum & 1], 0, sizeof(VAR_0->lpc_coeff[0]));", "for (VAR_9 = 0; VAR_9 < 5; VAR_9++) {", "for (VAR_7 = 0; VAR_7 < 1 << VAR_9; VAR_7++) {", "int VAR_13 = ((VAR_0->framenum << VAR_9) + VAR_7) & 31;", "VAR_0->tonal_bounds[VAR_9][VAR_13][0] =\nVAR_0->tonal_bounds[VAR_9][VAR_13][1] = VAR_0->ntones;", "}", "}", "while (bytestream2_get_bytes_left(&gb) > 0) {", "VAR_10 = bytestream2_get_byte(&gb);", "VAR_11 = (VAR_10 & 0x80) ? bytestream2_get_be16(&gb) : bytestream2_get_byte(&gb);", "VAR_10 &= 0x7f;", "if (VAR_11 > bytestream2_get_bytes_left(&gb)) {", "VAR_11 = bytestream2_get_bytes_left(&gb);", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"LBR VAR_3 %#x was truncated\\n\", VAR_10);", "if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)\nreturn AVERROR_INVALIDDATA;", "}", "switch (VAR_10) {", "case LBR_CHUNK_LFE:\nVAR_3.lfe.len = VAR_11;", "VAR_3.lfe.VAR_1 = gb.buffer;", "break;", "case LBR_CHUNK_SCF:\ncase LBR_CHUNK_TONAL:\ncase LBR_CHUNK_TONAL_SCF:\nVAR_3.tonal.id = VAR_10;", "VAR_3.tonal.len = VAR_11;", "VAR_3.tonal.VAR_1 = gb.buffer;", "break;", "case LBR_CHUNK_TONAL_GRP_1:\ncase LBR_CHUNK_TONAL_GRP_2:\ncase LBR_CHUNK_TONAL_GRP_3:\ncase LBR_CHUNK_TONAL_GRP_4:\ncase LBR_CHUNK_TONAL_GRP_5:\nVAR_4 = LBR_CHUNK_TONAL_GRP_5 - VAR_10;", "VAR_3.tonal_grp[VAR_4].id = VAR_4;", "VAR_3.tonal_grp[VAR_4].len = VAR_11;", "VAR_3.tonal_grp[VAR_4].VAR_1 = gb.buffer;", "break;", "case LBR_CHUNK_TONAL_SCF_GRP_1:\ncase LBR_CHUNK_TONAL_SCF_GRP_2:\ncase LBR_CHUNK_TONAL_SCF_GRP_3:\ncase LBR_CHUNK_TONAL_SCF_GRP_4:\ncase LBR_CHUNK_TONAL_SCF_GRP_5:\nVAR_4 = LBR_CHUNK_TONAL_SCF_GRP_5 - VAR_10;", "VAR_3.tonal_grp[VAR_4].id = VAR_4;", "VAR_3.tonal_grp[VAR_4].len = VAR_11;", "VAR_3.tonal_grp[VAR_4].VAR_1 = gb.buffer;", "break;", "case LBR_CHUNK_RES_GRID_LR:\ncase LBR_CHUNK_RES_GRID_LR + 1:\ncase LBR_CHUNK_RES_GRID_LR + 2:\nVAR_4 = VAR_10 - LBR_CHUNK_RES_GRID_LR;", "VAR_3.grid1[VAR_4].len = VAR_11;", "VAR_3.grid1[VAR_4].VAR_1 = gb.buffer;", "break;", "case LBR_CHUNK_RES_GRID_HR:\ncase LBR_CHUNK_RES_GRID_HR + 1:\ncase LBR_CHUNK_RES_GRID_HR + 2:\nVAR_4 = VAR_10 - LBR_CHUNK_RES_GRID_HR;", "VAR_3.hr_grid[VAR_4].len = VAR_11;", "VAR_3.hr_grid[VAR_4].VAR_1 = gb.buffer;", "break;", "case LBR_CHUNK_RES_TS_1:\ncase LBR_CHUNK_RES_TS_1 + 1:\ncase LBR_CHUNK_RES_TS_1 + 2:\nVAR_4 = VAR_10 - LBR_CHUNK_RES_TS_1;", "VAR_3.ts1[VAR_4].len = VAR_11;", "VAR_3.ts1[VAR_4].VAR_1 = gb.buffer;", "break;", "case LBR_CHUNK_RES_TS_2:\ncase LBR_CHUNK_RES_TS_2 + 1:\ncase LBR_CHUNK_RES_TS_2 + 2:\nVAR_4 = VAR_10 - LBR_CHUNK_RES_TS_2;", "VAR_3.ts2[VAR_4].len = VAR_11;", "VAR_3.ts2[VAR_4].VAR_1 = gb.buffer;", "break;", "}", "bytestream2_skip(&gb, VAR_11);", "}", "VAR_8 = parse_lfe_chunk(VAR_0, &VAR_3.lfe);", "VAR_8 |= parse_tonal_chunk(VAR_0, &VAR_3.tonal);", "for (VAR_4 = 0; VAR_4 < 5; VAR_4++)", "VAR_8 |= parse_tonal_group(VAR_0, &VAR_3.tonal_grp[VAR_4]);", "for (VAR_4 = 0; VAR_4 < (VAR_0->nchannels + 1) / 2; VAR_4++) {", "int ch1 = VAR_4 * 2;", "int ch2 = FFMIN(ch1 + 1, VAR_0->nchannels - 1);", "if (parse_grid_1_chunk (VAR_0, &VAR_3.grid1 [VAR_4], ch1, ch2) < 0 ||\nparse_high_res_grid(VAR_0, &VAR_3.hr_grid[VAR_4], ch1, ch2) < 0) {", "VAR_8 = -1;", "continue;", "}", "if (!VAR_3.grid1[VAR_4].len || !VAR_3.hr_grid[VAR_4].len || !VAR_3.ts1[VAR_4].len)\ncontinue;", "if (parse_ts1_chunk(VAR_0, &VAR_3.ts1[VAR_4], ch1, ch2) < 0 ||\nparse_ts2_chunk(VAR_0, &VAR_3.ts2[VAR_4], ch1, ch2) < 0) {", "VAR_8 = -1;", "continue;", "}", "}", "if (VAR_8 < 0 && (VAR_0->avctx->err_recognition & AV_EF_EXPLODE))\nreturn AVERROR_INVALIDDATA;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 33 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 109 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149, 151 ], [ 153, 155 ], [ 157 ], [ 159 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 213 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 241 ], [ 243 ], [ 245 ], [ 247, 249 ], [ 251 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263 ], [ 267, 269, 271, 273 ], [ 275 ], [ 277 ], [ 279 ], [ 283, 285, 287, 289, 291, 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 305, 307, 309, 311, 313, 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 327, 329, 331, 333 ], [ 335 ], [ 337 ], [ 339 ], [ 343, 345, 347, 349 ], [ 351 ], [ 353 ], [ 355 ], [ 359, 361, 363, 365 ], [ 367 ], [ 369 ], [ 371 ], [ 375, 377, 379, 381 ], [ 383 ], [ 385 ], [ 387 ], [ 389 ], [ 393 ], [ 395 ], [ 401 ], [ 405 ], [ 409 ], [ 411 ], [ 415 ], [ 417 ], [ 419 ], [ 423, 425 ], [ 427 ], [ 429 ], [ 431 ], [ 437, 439 ], [ 443, 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 457, 459 ], [ 463 ], [ 465 ] ]
12,271
static int blk_mig_save_bulked_block(Monitor *mon, QEMUFile *f) { int64_t completed_sector_sum = 0; BlkMigDevState *bmds; int progress; int ret = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { if (bmds->bulk_completed == 0) { if (mig_save_device_bulk(mon, f, bmds) == 1) { /* completed bulk section for this device */ bmds->bulk_completed = 1; } completed_sector_sum += bmds->completed_sectors; ret = 1; break; } else { completed_sector_sum += bmds->completed_sectors; } } progress = completed_sector_sum * 100 / block_mig_state.total_sector_sum; if (progress != block_mig_state.prev_progress) { block_mig_state.prev_progress = progress; qemu_put_be64(f, (progress << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); monitor_printf(mon, "Completed %d %%\r", progress); monitor_flush(mon); } return ret; }
true
qemu
8b6b2afcf85dd5ff33075e93a2e30fbea34c5a55
static int blk_mig_save_bulked_block(Monitor *mon, QEMUFile *f) { int64_t completed_sector_sum = 0; BlkMigDevState *bmds; int progress; int ret = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { if (bmds->bulk_completed == 0) { if (mig_save_device_bulk(mon, f, bmds) == 1) { bmds->bulk_completed = 1; } completed_sector_sum += bmds->completed_sectors; ret = 1; break; } else { completed_sector_sum += bmds->completed_sectors; } } progress = completed_sector_sum * 100 / block_mig_state.total_sector_sum; if (progress != block_mig_state.prev_progress) { block_mig_state.prev_progress = progress; qemu_put_be64(f, (progress << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); monitor_printf(mon, "Completed %d %%\r", progress); monitor_flush(mon); } return ret; }
{ "code": [ " progress = completed_sector_sum * 100 / block_mig_state.total_sector_sum;" ], "line_no": [ 43 ] }
static int FUNC_0(Monitor *VAR_0, QEMUFile *VAR_1) { int64_t completed_sector_sum = 0; BlkMigDevState *bmds; int VAR_2; int VAR_3 = 0; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { if (bmds->bulk_completed == 0) { if (mig_save_device_bulk(VAR_0, VAR_1, bmds) == 1) { bmds->bulk_completed = 1; } completed_sector_sum += bmds->completed_sectors; VAR_3 = 1; break; } else { completed_sector_sum += bmds->completed_sectors; } } VAR_2 = completed_sector_sum * 100 / block_mig_state.total_sector_sum; if (VAR_2 != block_mig_state.prev_progress) { block_mig_state.prev_progress = VAR_2; qemu_put_be64(VAR_1, (VAR_2 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); monitor_printf(VAR_0, "Completed %d %%\r", VAR_2); monitor_flush(VAR_0); } return VAR_3; }
[ "static int FUNC_0(Monitor *VAR_0, QEMUFile *VAR_1)\n{", "int64_t completed_sector_sum = 0;", "BlkMigDevState *bmds;", "int VAR_2;", "int VAR_3 = 0;", "QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {", "if (bmds->bulk_completed == 0) {", "if (mig_save_device_bulk(VAR_0, VAR_1, bmds) == 1) {", "bmds->bulk_completed = 1;", "}", "completed_sector_sum += bmds->completed_sectors;", "VAR_3 = 1;", "break;", "} else {", "completed_sector_sum += bmds->completed_sectors;", "}", "}", "VAR_2 = completed_sector_sum * 100 / block_mig_state.total_sector_sum;", "if (VAR_2 != block_mig_state.prev_progress) {", "block_mig_state.prev_progress = VAR_2;", "qemu_put_be64(VAR_1, (VAR_2 << BDRV_SECTOR_BITS)\n| BLK_MIG_FLAG_PROGRESS);", "monitor_printf(VAR_0, \"Completed %d %%\\r\", VAR_2);", "monitor_flush(VAR_0);", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ] ]
12,272
int net_init_tap(const NetClientOptions *opts, const char *name, NetClientState *peer) { const NetdevTapOptions *tap; int fd, vnet_hdr = 0, i = 0, queues; /* for the no-fd, no-helper case */ const char *script = NULL; /* suppress wrong "uninit'd use" gcc warning */ const char *downscript = NULL; const char *vhostfdname; char ifname[128]; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_TAP); tap = opts->tap; queues = tap->has_queues ? tap->queues : 1; vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL; if (tap->has_fd) { if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_helper || tap->has_queues || tap->has_fds) { error_report("ifname=, script=, downscript=, vnet_hdr=, " "helper=, queues=, and fds= are invalid with fd="); fd = monitor_handle_fd_param(cur_mon, tap->fd); if (fd == -1) { fcntl(fd, F_SETFL, O_NONBLOCK); vnet_hdr = tap_probe_vnet_hdr(fd); if (net_init_tap_one(tap, peer, "tap", name, NULL, script, downscript, vhostfdname, vnet_hdr, fd)) { } else if (tap->has_fds) { char *fds[MAX_TAP_QUEUES]; char *vhost_fds[MAX_TAP_QUEUES]; int nfds, nvhosts; if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_helper || tap->has_queues || tap->has_fd) { error_report("ifname=, script=, downscript=, vnet_hdr=, " "helper=, queues=, and fd= are invalid with fds="); nfds = get_fds(tap->fds, fds, MAX_TAP_QUEUES); if (tap->has_vhostfds) { nvhosts = get_fds(tap->vhostfds, vhost_fds, MAX_TAP_QUEUES); if (nfds != nvhosts) { error_report("The number of fds passed does not match the " "number of vhostfds passed"); for (i = 0; i < nfds; i++) { fd = monitor_handle_fd_param(cur_mon, fds[i]); if (fd == -1) { fcntl(fd, F_SETFL, O_NONBLOCK); if (i == 0) { vnet_hdr = tap_probe_vnet_hdr(fd); } else if (vnet_hdr != tap_probe_vnet_hdr(fd)) { error_report("vnet_hdr not consistent across given tap fds"); if (net_init_tap_one(tap, peer, "tap", name, ifname, script, downscript, tap->has_vhostfds ? vhost_fds[i] : NULL, vnet_hdr, fd)) { } else if (tap->has_helper) { if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_queues || tap->has_fds) { error_report("ifname=, script=, downscript=, and vnet_hdr= " "queues=, and fds= are invalid with helper="); fd = net_bridge_run_helper(tap->helper, DEFAULT_BRIDGE_INTERFACE); if (fd == -1) { fcntl(fd, F_SETFL, O_NONBLOCK); vnet_hdr = tap_probe_vnet_hdr(fd); if (net_init_tap_one(tap, peer, "bridge", name, ifname, script, downscript, vhostfdname, vnet_hdr, fd)) { } else { script = tap->has_script ? tap->script : DEFAULT_NETWORK_SCRIPT; downscript = tap->has_downscript ? tap->downscript : DEFAULT_NETWORK_DOWN_SCRIPT; if (tap->has_ifname) { pstrcpy(ifname, sizeof ifname, tap->ifname); } else { ifname[0] = '\0'; for (i = 0; i < queues; i++) { fd = net_tap_init(tap, &vnet_hdr, i >= 1 ? "no" : script, ifname, sizeof ifname, queues > 1); if (fd == -1) { if (queues > 1 && i == 0 && !tap->has_ifname) { if (tap_fd_get_ifname(fd, ifname)) { error_report("Fail to get ifname"); if (net_init_tap_one(tap, peer, "tap", name, ifname, i >= 1 ? "no" : script, i >= 1 ? "no" : downscript, vhostfdname, vnet_hdr, fd)) { return 0;
true
qemu
ce675a7579fea498397c5d2da3c5367671e9f02a
int net_init_tap(const NetClientOptions *opts, const char *name, NetClientState *peer) { const NetdevTapOptions *tap; int fd, vnet_hdr = 0, i = 0, queues; const char *script = NULL; const char *downscript = NULL; const char *vhostfdname; char ifname[128]; assert(opts->kind == NET_CLIENT_OPTIONS_KIND_TAP); tap = opts->tap; queues = tap->has_queues ? tap->queues : 1; vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL; if (tap->has_fd) { if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_helper || tap->has_queues || tap->has_fds) { error_report("ifname=, script=, downscript=, vnet_hdr=, " "helper=, queues=, and fds= are invalid with fd="); fd = monitor_handle_fd_param(cur_mon, tap->fd); if (fd == -1) { fcntl(fd, F_SETFL, O_NONBLOCK); vnet_hdr = tap_probe_vnet_hdr(fd); if (net_init_tap_one(tap, peer, "tap", name, NULL, script, downscript, vhostfdname, vnet_hdr, fd)) { } else if (tap->has_fds) { char *fds[MAX_TAP_QUEUES]; char *vhost_fds[MAX_TAP_QUEUES]; int nfds, nvhosts; if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_helper || tap->has_queues || tap->has_fd) { error_report("ifname=, script=, downscript=, vnet_hdr=, " "helper=, queues=, and fd= are invalid with fds="); nfds = get_fds(tap->fds, fds, MAX_TAP_QUEUES); if (tap->has_vhostfds) { nvhosts = get_fds(tap->vhostfds, vhost_fds, MAX_TAP_QUEUES); if (nfds != nvhosts) { error_report("The number of fds passed does not match the " "number of vhostfds passed"); for (i = 0; i < nfds; i++) { fd = monitor_handle_fd_param(cur_mon, fds[i]); if (fd == -1) { fcntl(fd, F_SETFL, O_NONBLOCK); if (i == 0) { vnet_hdr = tap_probe_vnet_hdr(fd); } else if (vnet_hdr != tap_probe_vnet_hdr(fd)) { error_report("vnet_hdr not consistent across given tap fds"); if (net_init_tap_one(tap, peer, "tap", name, ifname, script, downscript, tap->has_vhostfds ? vhost_fds[i] : NULL, vnet_hdr, fd)) { } else if (tap->has_helper) { if (tap->has_ifname || tap->has_script || tap->has_downscript || tap->has_vnet_hdr || tap->has_queues || tap->has_fds) { error_report("ifname=, script=, downscript=, and vnet_hdr= " "queues=, and fds= are invalid with helper="); fd = net_bridge_run_helper(tap->helper, DEFAULT_BRIDGE_INTERFACE); if (fd == -1) { fcntl(fd, F_SETFL, O_NONBLOCK); vnet_hdr = tap_probe_vnet_hdr(fd); if (net_init_tap_one(tap, peer, "bridge", name, ifname, script, downscript, vhostfdname, vnet_hdr, fd)) { } else { script = tap->has_script ? tap->script : DEFAULT_NETWORK_SCRIPT; downscript = tap->has_downscript ? tap->downscript : DEFAULT_NETWORK_DOWN_SCRIPT; if (tap->has_ifname) { pstrcpy(ifname, sizeof ifname, tap->ifname); } else { ifname[0] = '\0'; for (i = 0; i < queues; i++) { fd = net_tap_init(tap, &vnet_hdr, i >= 1 ? "no" : script, ifname, sizeof ifname, queues > 1); if (fd == -1) { if (queues > 1 && i == 0 && !tap->has_ifname) { if (tap_fd_get_ifname(fd, ifname)) { error_report("Fail to get ifname"); if (net_init_tap_one(tap, peer, "tap", name, ifname, i >= 1 ? "no" : script, i >= 1 ? "no" : downscript, vhostfdname, vnet_hdr, fd)) { return 0;
{ "code": [], "line_no": [] }
int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1, NetClientState *VAR_2) { const NetdevTapOptions *VAR_3; int VAR_4, VAR_5 = 0, VAR_6 = 0, VAR_7; const char *VAR_8 = NULL; const char *VAR_9 = NULL; const char *VAR_10; char VAR_11[128]; assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_TAP); VAR_3 = VAR_0->VAR_3; VAR_7 = VAR_3->has_queues ? VAR_3->VAR_7 : 1; VAR_10 = VAR_3->has_vhostfd ? VAR_3->vhostfd : NULL; if (VAR_3->has_fd) { if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript || VAR_3->has_vnet_hdr || VAR_3->has_helper || VAR_3->has_queues || VAR_3->has_fds) { error_report("VAR_11=, VAR_8=, VAR_9=, VAR_5=, " "helper=, VAR_7=, and VAR_12= are invalid with VAR_4="); VAR_4 = monitor_handle_fd_param(cur_mon, VAR_3->VAR_4); if (VAR_4 == -1) { fcntl(VAR_4, F_SETFL, O_NONBLOCK); VAR_5 = tap_probe_vnet_hdr(VAR_4); if (net_init_tap_one(VAR_3, VAR_2, "VAR_3", VAR_1, NULL, VAR_8, VAR_9, VAR_10, VAR_5, VAR_4)) { } else if (VAR_3->has_fds) { char *VAR_12[MAX_TAP_QUEUES]; char *VAR_13[MAX_TAP_QUEUES]; int VAR_14, VAR_15; if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript || VAR_3->has_vnet_hdr || VAR_3->has_helper || VAR_3->has_queues || VAR_3->has_fd) { error_report("VAR_11=, VAR_8=, VAR_9=, VAR_5=, " "helper=, VAR_7=, and VAR_4= are invalid with VAR_12="); VAR_14 = get_fds(VAR_3->VAR_12, VAR_12, MAX_TAP_QUEUES); if (VAR_3->has_vhostfds) { VAR_15 = get_fds(VAR_3->vhostfds, VAR_13, MAX_TAP_QUEUES); if (VAR_14 != VAR_15) { error_report("The number of VAR_12 passed does not match the " "number of vhostfds passed"); for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) { VAR_4 = monitor_handle_fd_param(cur_mon, VAR_12[VAR_6]); if (VAR_4 == -1) { fcntl(VAR_4, F_SETFL, O_NONBLOCK); if (VAR_6 == 0) { VAR_5 = tap_probe_vnet_hdr(VAR_4); } else if (VAR_5 != tap_probe_vnet_hdr(VAR_4)) { error_report("VAR_5 not consistent across given VAR_3 VAR_12"); if (net_init_tap_one(VAR_3, VAR_2, "VAR_3", VAR_1, VAR_11, VAR_8, VAR_9, VAR_3->has_vhostfds ? VAR_13[VAR_6] : NULL, VAR_5, VAR_4)) { } else if (VAR_3->has_helper) { if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript || VAR_3->has_vnet_hdr || VAR_3->has_queues || VAR_3->has_fds) { error_report("VAR_11=, VAR_8=, VAR_9=, and VAR_5= " "VAR_7=, and VAR_12= are invalid with helper="); VAR_4 = net_bridge_run_helper(VAR_3->helper, DEFAULT_BRIDGE_INTERFACE); if (VAR_4 == -1) { fcntl(VAR_4, F_SETFL, O_NONBLOCK); VAR_5 = tap_probe_vnet_hdr(VAR_4); if (net_init_tap_one(VAR_3, VAR_2, "bridge", VAR_1, VAR_11, VAR_8, VAR_9, VAR_10, VAR_5, VAR_4)) { } else { VAR_8 = VAR_3->has_script ? VAR_3->VAR_8 : DEFAULT_NETWORK_SCRIPT; VAR_9 = VAR_3->has_downscript ? VAR_3->VAR_9 : DEFAULT_NETWORK_DOWN_SCRIPT; if (VAR_3->has_ifname) { pstrcpy(VAR_11, sizeof VAR_11, VAR_3->VAR_11); } else { VAR_11[0] = '\0'; for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) { VAR_4 = net_tap_init(VAR_3, &VAR_5, VAR_6 >= 1 ? "no" : VAR_8, VAR_11, sizeof VAR_11, VAR_7 > 1); if (VAR_4 == -1) { if (VAR_7 > 1 && VAR_6 == 0 && !VAR_3->has_ifname) { if (tap_fd_get_ifname(VAR_4, VAR_11)) { error_report("Fail to get VAR_11"); if (net_init_tap_one(VAR_3, VAR_2, "VAR_3", VAR_1, VAR_11, VAR_6 >= 1 ? "no" : VAR_8, VAR_6 >= 1 ? "no" : VAR_9, VAR_10, VAR_5, VAR_4)) { return 0;
[ "int FUNC_0(const NetClientOptions *VAR_0, const char *VAR_1,\nNetClientState *VAR_2)\n{", "const NetdevTapOptions *VAR_3;", "int VAR_4, VAR_5 = 0, VAR_6 = 0, VAR_7;", "const char *VAR_8 = NULL;", "const char *VAR_9 = NULL;", "const char *VAR_10;", "char VAR_11[128];", "assert(VAR_0->kind == NET_CLIENT_OPTIONS_KIND_TAP);", "VAR_3 = VAR_0->VAR_3;", "VAR_7 = VAR_3->has_queues ? VAR_3->VAR_7 : 1;", "VAR_10 = VAR_3->has_vhostfd ? VAR_3->vhostfd : NULL;", "if (VAR_3->has_fd) {", "if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript ||\nVAR_3->has_vnet_hdr || VAR_3->has_helper || VAR_3->has_queues ||\nVAR_3->has_fds) {", "error_report(\"VAR_11=, VAR_8=, VAR_9=, VAR_5=, \"\n\"helper=, VAR_7=, and VAR_12= are invalid with VAR_4=\");", "VAR_4 = monitor_handle_fd_param(cur_mon, VAR_3->VAR_4);", "if (VAR_4 == -1) {", "fcntl(VAR_4, F_SETFL, O_NONBLOCK);", "VAR_5 = tap_probe_vnet_hdr(VAR_4);", "if (net_init_tap_one(VAR_3, VAR_2, \"VAR_3\", VAR_1, NULL,\nVAR_8, VAR_9,\nVAR_10, VAR_5, VAR_4)) {", "} else if (VAR_3->has_fds) {", "char *VAR_12[MAX_TAP_QUEUES];", "char *VAR_13[MAX_TAP_QUEUES];", "int VAR_14, VAR_15;", "if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript ||\nVAR_3->has_vnet_hdr || VAR_3->has_helper || VAR_3->has_queues ||\nVAR_3->has_fd) {", "error_report(\"VAR_11=, VAR_8=, VAR_9=, VAR_5=, \"\n\"helper=, VAR_7=, and VAR_4= are invalid with VAR_12=\");", "VAR_14 = get_fds(VAR_3->VAR_12, VAR_12, MAX_TAP_QUEUES);", "if (VAR_3->has_vhostfds) {", "VAR_15 = get_fds(VAR_3->vhostfds, VAR_13, MAX_TAP_QUEUES);", "if (VAR_14 != VAR_15) {", "error_report(\"The number of VAR_12 passed does not match the \"\n\"number of vhostfds passed\");", "for (VAR_6 = 0; VAR_6 < VAR_14; VAR_6++) {", "VAR_4 = monitor_handle_fd_param(cur_mon, VAR_12[VAR_6]);", "if (VAR_4 == -1) {", "fcntl(VAR_4, F_SETFL, O_NONBLOCK);", "if (VAR_6 == 0) {", "VAR_5 = tap_probe_vnet_hdr(VAR_4);", "} else if (VAR_5 != tap_probe_vnet_hdr(VAR_4)) {", "error_report(\"VAR_5 not consistent across given VAR_3 VAR_12\");", "if (net_init_tap_one(VAR_3, VAR_2, \"VAR_3\", VAR_1, VAR_11,\nVAR_8, VAR_9,\nVAR_3->has_vhostfds ? VAR_13[VAR_6] : NULL,\nVAR_5, VAR_4)) {", "} else if (VAR_3->has_helper) {", "if (VAR_3->has_ifname || VAR_3->has_script || VAR_3->has_downscript ||\nVAR_3->has_vnet_hdr || VAR_3->has_queues || VAR_3->has_fds) {", "error_report(\"VAR_11=, VAR_8=, VAR_9=, and VAR_5= \"\n\"VAR_7=, and VAR_12= are invalid with helper=\");", "VAR_4 = net_bridge_run_helper(VAR_3->helper, DEFAULT_BRIDGE_INTERFACE);", "if (VAR_4 == -1) {", "fcntl(VAR_4, F_SETFL, O_NONBLOCK);", "VAR_5 = tap_probe_vnet_hdr(VAR_4);", "if (net_init_tap_one(VAR_3, VAR_2, \"bridge\", VAR_1, VAR_11,\nVAR_8, VAR_9, VAR_10,\nVAR_5, VAR_4)) {", "} else {", "VAR_8 = VAR_3->has_script ? VAR_3->VAR_8 : DEFAULT_NETWORK_SCRIPT;", "VAR_9 = VAR_3->has_downscript ? VAR_3->VAR_9 :\nDEFAULT_NETWORK_DOWN_SCRIPT;", "if (VAR_3->has_ifname) {", "pstrcpy(VAR_11, sizeof VAR_11, VAR_3->VAR_11);", "} else {", "VAR_11[0] = '\\0';", "for (VAR_6 = 0; VAR_6 < VAR_7; VAR_6++) {", "VAR_4 = net_tap_init(VAR_3, &VAR_5, VAR_6 >= 1 ? \"no\" : VAR_8,\nVAR_11, sizeof VAR_11, VAR_7 > 1);", "if (VAR_4 == -1) {", "if (VAR_7 > 1 && VAR_6 == 0 && !VAR_3->has_ifname) {", "if (tap_fd_get_ifname(VAR_4, VAR_11)) {", "error_report(\"Fail to get VAR_11\");", "if (net_init_tap_one(VAR_3, VAR_2, \"VAR_3\", VAR_1, VAR_11,\nVAR_6 >= 1 ? \"no\" : VAR_8,\nVAR_6 >= 1 ? \"no\" : VAR_9,\nVAR_10, VAR_5, VAR_4)) {", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16, 17, 18 ], [ 19, 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24 ], [ 25, 26, 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32, 33, 34 ], [ 35, 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41, 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51, 52, 53, 54 ], [ 55 ], [ 56, 57 ], [ 58, 59 ], [ 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64, 65, 66 ], [ 67 ], [ 68 ], [ 69, 70 ], [ 71 ], [ 72 ], [ 73 ], [ 74 ], [ 75 ], [ 76, 77 ], [ 78 ], [ 79 ], [ 80 ], [ 81 ], [ 82, 83, 84, 85 ], [ 86 ] ]
12,274
static int get_qcc(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q, uint8_t *properties) { int compno; if (bytestream2_get_bytes_left(&s->g) < 1) return AVERROR_INVALIDDATA; compno = bytestream2_get_byteu(&s->g); properties[compno] |= HAD_QCC; return get_qcx(s, n - 1, q + compno); }
true
FFmpeg
eae63e3c156f784ee0612422f0c95131ea913c14
static int get_qcc(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q, uint8_t *properties) { int compno; if (bytestream2_get_bytes_left(&s->g) < 1) return AVERROR_INVALIDDATA; compno = bytestream2_get_byteu(&s->g); properties[compno] |= HAD_QCC; return get_qcx(s, n - 1, q + compno); }
{ "code": [ " compno = bytestream2_get_byteu(&s->g);" ], "line_no": [ 17 ] }
static int FUNC_0(Jpeg2000DecoderContext *VAR_0, int VAR_1, Jpeg2000QuantStyle *VAR_2, uint8_t *VAR_3) { int VAR_4; if (bytestream2_get_bytes_left(&VAR_0->g) < 1) return AVERROR_INVALIDDATA; VAR_4 = bytestream2_get_byteu(&VAR_0->g); VAR_3[VAR_4] |= HAD_QCC; return get_qcx(VAR_0, VAR_1 - 1, VAR_2 + VAR_4); }
[ "static int FUNC_0(Jpeg2000DecoderContext *VAR_0, int VAR_1, Jpeg2000QuantStyle *VAR_2,\nuint8_t *VAR_3)\n{", "int VAR_4;", "if (bytestream2_get_bytes_left(&VAR_0->g) < 1)\nreturn AVERROR_INVALIDDATA;", "VAR_4 = bytestream2_get_byteu(&VAR_0->g);", "VAR_3[VAR_4] |= HAD_QCC;", "return get_qcx(VAR_0, VAR_1 - 1, VAR_2 + VAR_4);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
12,275
static void vfio_pci_load_rom(VFIODevice *vdev) { struct vfio_region_info reg_info = { .argsz = sizeof(reg_info), .index = VFIO_PCI_ROM_REGION_INDEX }; uint64_t size; off_t off = 0; size_t bytes; if (ioctl(vdev->fd, VFIO_DEVICE_GET_REGION_INFO, &reg_info)) { error_report("vfio: Error getting ROM info: %m"); return; } DPRINTF("Device %04x:%02x:%02x.%x ROM:\n", vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function); DPRINTF(" size: 0x%lx, offset: 0x%lx, flags: 0x%lx\n", (unsigned long)reg_info.size, (unsigned long)reg_info.offset, (unsigned long)reg_info.flags); vdev->rom_size = size = reg_info.size; vdev->rom_offset = reg_info.offset; if (!vdev->rom_size) { error_report("vfio-pci: Cannot read device rom at " "%04x:%02x:%02x.%x\n", vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function); error_printf("Device option ROM contents are probably invalid " "(check dmesg).\nSkip option ROM probe with rombar=0, " "or load from file with romfile=\n"); return; } vdev->rom = g_malloc(size); memset(vdev->rom, 0xff, size); while (size) { bytes = pread(vdev->fd, vdev->rom + off, size, vdev->rom_offset + off); if (bytes == 0) { break; } else if (bytes > 0) { off += bytes; size -= bytes; } else { if (errno == EINTR || errno == EAGAIN) { continue; } error_report("vfio: Error reading device ROM: %m"); break; } } }
true
qemu
e638073c569e801ce9def2016a84f955cbbca779
static void vfio_pci_load_rom(VFIODevice *vdev) { struct vfio_region_info reg_info = { .argsz = sizeof(reg_info), .index = VFIO_PCI_ROM_REGION_INDEX }; uint64_t size; off_t off = 0; size_t bytes; if (ioctl(vdev->fd, VFIO_DEVICE_GET_REGION_INFO, &reg_info)) { error_report("vfio: Error getting ROM info: %m"); return; } DPRINTF("Device %04x:%02x:%02x.%x ROM:\n", vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function); DPRINTF(" size: 0x%lx, offset: 0x%lx, flags: 0x%lx\n", (unsigned long)reg_info.size, (unsigned long)reg_info.offset, (unsigned long)reg_info.flags); vdev->rom_size = size = reg_info.size; vdev->rom_offset = reg_info.offset; if (!vdev->rom_size) { error_report("vfio-pci: Cannot read device rom at " "%04x:%02x:%02x.%x\n", vdev->host.domain, vdev->host.bus, vdev->host.slot, vdev->host.function); error_printf("Device option ROM contents are probably invalid " "(check dmesg).\nSkip option ROM probe with rombar=0, " "or load from file with romfile=\n"); return; } vdev->rom = g_malloc(size); memset(vdev->rom, 0xff, size); while (size) { bytes = pread(vdev->fd, vdev->rom + off, size, vdev->rom_offset + off); if (bytes == 0) { break; } else if (bytes > 0) { off += bytes; size -= bytes; } else { if (errno == EINTR || errno == EAGAIN) { continue; } error_report("vfio: Error reading device ROM: %m"); break; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(VFIODevice *VAR_0) { struct vfio_region_info VAR_1 = { .argsz = sizeof(VAR_1), .index = VFIO_PCI_ROM_REGION_INDEX }; uint64_t size; off_t off = 0; size_t bytes; if (ioctl(VAR_0->fd, VFIO_DEVICE_GET_REGION_INFO, &VAR_1)) { error_report("vfio: Error getting ROM info: %m"); return; } DPRINTF("Device %04x:%02x:%02x.%x ROM:\n", VAR_0->host.domain, VAR_0->host.bus, VAR_0->host.slot, VAR_0->host.function); DPRINTF(" size: 0x%lx, offset: 0x%lx, flags: 0x%lx\n", (unsigned long)VAR_1.size, (unsigned long)VAR_1.offset, (unsigned long)VAR_1.flags); VAR_0->rom_size = size = VAR_1.size; VAR_0->rom_offset = VAR_1.offset; if (!VAR_0->rom_size) { error_report("vfio-pci: Cannot read device rom at " "%04x:%02x:%02x.%x\n", VAR_0->host.domain, VAR_0->host.bus, VAR_0->host.slot, VAR_0->host.function); error_printf("Device option ROM contents are probably invalid " "(check dmesg).\nSkip option ROM probe with rombar=0, " "or load from file with romfile=\n"); return; } VAR_0->rom = g_malloc(size); memset(VAR_0->rom, 0xff, size); while (size) { bytes = pread(VAR_0->fd, VAR_0->rom + off, size, VAR_0->rom_offset + off); if (bytes == 0) { break; } else if (bytes > 0) { off += bytes; size -= bytes; } else { if (errno == EINTR || errno == EAGAIN) { continue; } error_report("vfio: Error reading device ROM: %m"); break; } } }
[ "static void FUNC_0(VFIODevice *VAR_0)\n{", "struct vfio_region_info VAR_1 = {", ".argsz = sizeof(VAR_1),\n.index = VFIO_PCI_ROM_REGION_INDEX\n};", "uint64_t size;", "off_t off = 0;", "size_t bytes;", "if (ioctl(VAR_0->fd, VFIO_DEVICE_GET_REGION_INFO, &VAR_1)) {", "error_report(\"vfio: Error getting ROM info: %m\");", "return;", "}", "DPRINTF(\"Device %04x:%02x:%02x.%x ROM:\\n\", VAR_0->host.domain,\nVAR_0->host.bus, VAR_0->host.slot, VAR_0->host.function);", "DPRINTF(\" size: 0x%lx, offset: 0x%lx, flags: 0x%lx\\n\",\n(unsigned long)VAR_1.size, (unsigned long)VAR_1.offset,\n(unsigned long)VAR_1.flags);", "VAR_0->rom_size = size = VAR_1.size;", "VAR_0->rom_offset = VAR_1.offset;", "if (!VAR_0->rom_size) {", "error_report(\"vfio-pci: Cannot read device rom at \"\n\"%04x:%02x:%02x.%x\\n\",\nVAR_0->host.domain, VAR_0->host.bus, VAR_0->host.slot,\nVAR_0->host.function);", "error_printf(\"Device option ROM contents are probably invalid \"\n\"(check dmesg).\\nSkip option ROM probe with rombar=0, \"\n\"or load from file with romfile=\\n\");", "return;", "}", "VAR_0->rom = g_malloc(size);", "memset(VAR_0->rom, 0xff, size);", "while (size) {", "bytes = pread(VAR_0->fd, VAR_0->rom + off, size, VAR_0->rom_offset + off);", "if (bytes == 0) {", "break;", "} else if (bytes > 0) {", "off += bytes;", "size -= bytes;", "} else {", "if (errno == EINTR || errno == EAGAIN) {", "continue;", "}", "error_report(\"vfio: Error reading device ROM: %m\");", "break;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33 ], [ 35, 37, 39 ], [ 43 ], [ 45 ], [ 49 ], [ 52, 54, 56, 58 ], [ 60, 62, 64 ], [ 66 ], [ 68 ], [ 72 ], [ 74 ], [ 78 ], [ 80 ], [ 82 ], [ 84 ], [ 86 ], [ 88 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ], [ 98 ], [ 100 ], [ 102 ], [ 104 ], [ 106 ], [ 108 ] ]
12,276
static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args, const int *const_args) { int c; switch (opc) { case INDEX_op_exit_tb: tcg_out_movi (s, TCG_TYPE_I64, TCG_REG_R3, args[0]); tcg_out_b (s, 0, (tcg_target_long) tb_ret_addr); break; case INDEX_op_goto_tb: if (s->tb_jmp_offset) { /* direct jump method */ s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf; s->code_ptr += 28; } else { tcg_abort (); } s->tb_next_offset[args[0]] = s->code_ptr - s->code_buf; break; case INDEX_op_br: { TCGLabel *l = &s->labels[args[0]]; if (l->has_value) { tcg_out_b (s, 0, l->u.value); } else { uint32_t val = *(uint32_t *) s->code_ptr; /* Thanks to Andrzej Zaborowski */ tcg_out32 (s, B | (val & 0x3fffffc)); tcg_out_reloc (s, s->code_ptr - 4, R_PPC_REL24, args[0], 0); } } break; case INDEX_op_call: tcg_out_call (s, args[0], const_args[0]); break; case INDEX_op_jmp: if (const_args[0]) { tcg_out_b (s, 0, args[0]); } else { tcg_out32 (s, MTSPR | RS (args[0]) | CTR); tcg_out32 (s, BCCTR | BO_ALWAYS); } break; case INDEX_op_movi_i32: tcg_out_movi (s, TCG_TYPE_I32, args[0], args[1]); break; case INDEX_op_movi_i64: tcg_out_movi (s, TCG_TYPE_I64, args[0], args[1]); break; case INDEX_op_ld8u_i32: case INDEX_op_ld8u_i64: tcg_out_ldst (s, args[0], args[1], args[2], LBZ, LBZX); break; case INDEX_op_ld8s_i32: case INDEX_op_ld8s_i64: tcg_out_ldst (s, args[0], args[1], args[2], LBZ, LBZX); tcg_out32 (s, EXTSB | RS (args[0]) | RA (args[0])); break; case INDEX_op_ld16u_i32: case INDEX_op_ld16u_i64: tcg_out_ldst (s, args[0], args[1], args[2], LHZ, LHZX); break; case INDEX_op_ld16s_i32: case INDEX_op_ld16s_i64: tcg_out_ldst (s, args[0], args[1], args[2], LHA, LHAX); break; case INDEX_op_ld_i32: case INDEX_op_ld32u_i64: tcg_out_ldst (s, args[0], args[1], args[2], LWZ, LWZX); break; case INDEX_op_ld32s_i64: tcg_out_ldsta (s, args[0], args[1], args[2], LWA, LWAX); break; case INDEX_op_ld_i64: tcg_out_ldsta (s, args[0], args[1], args[2], LD, LDX); break; case INDEX_op_st8_i32: case INDEX_op_st8_i64: tcg_out_ldst (s, args[0], args[1], args[2], STB, STBX); break; case INDEX_op_st16_i32: case INDEX_op_st16_i64: tcg_out_ldst (s, args[0], args[1], args[2], STH, STHX); break; case INDEX_op_st_i32: case INDEX_op_st32_i64: tcg_out_ldst (s, args[0], args[1], args[2], STW, STWX); break; case INDEX_op_st_i64: tcg_out_ldsta (s, args[0], args[1], args[2], STD, STDX); break; case INDEX_op_add_i32: if (const_args[2]) ppc_addi32 (s, args[0], args[1], args[2]); else tcg_out32 (s, ADD | TAB (args[0], args[1], args[2])); break; case INDEX_op_sub_i32: if (const_args[2]) ppc_addi32 (s, args[0], args[1], -args[2]); else tcg_out32 (s, SUBF | TAB (args[0], args[2], args[1])); break; case INDEX_op_and_i64: case INDEX_op_and_i32: if (const_args[2]) { if ((args[2] & 0xffff) == args[2]) tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]); else if ((args[2] & 0xffff0000) == args[2]) tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0]) | ((args[2] >> 16) & 0xffff)); else { tcg_out_movi (s, (opc == INDEX_op_and_i32 ? TCG_TYPE_I32 : TCG_TYPE_I64), 0, args[2]); tcg_out32 (s, AND | SAB (args[1], args[0], 0)); } } else tcg_out32 (s, AND | SAB (args[1], args[0], args[2])); break; case INDEX_op_or_i64: case INDEX_op_or_i32: if (const_args[2]) { if (args[2] & 0xffff) { tcg_out32 (s, ORI | RS (args[1]) | RA (args[0]) | (args[2] & 0xffff)); if (args[2] >> 16) tcg_out32 (s, ORIS | RS (args[0]) | RA (args[0]) | ((args[2] >> 16) & 0xffff)); } else { tcg_out32 (s, ORIS | RS (args[1]) | RA (args[0]) | ((args[2] >> 16) & 0xffff)); } } else tcg_out32 (s, OR | SAB (args[1], args[0], args[2])); break; case INDEX_op_xor_i64: case INDEX_op_xor_i32: if (const_args[2]) { if ((args[2] & 0xffff) == args[2]) tcg_out32 (s, XORI | RS (args[1]) | RA (args[0]) | (args[2] & 0xffff)); else if ((args[2] & 0xffff0000) == args[2]) tcg_out32 (s, XORIS | RS (args[1]) | RA (args[0]) | ((args[2] >> 16) & 0xffff)); else { tcg_out_movi (s, (opc == INDEX_op_and_i32 ? TCG_TYPE_I32 : TCG_TYPE_I64), 0, args[2]); tcg_out32 (s, XOR | SAB (args[1], args[0], 0)); } } else tcg_out32 (s, XOR | SAB (args[1], args[0], args[2])); break; case INDEX_op_mul_i32: if (const_args[2]) { if (args[2] == (int16_t) args[2]) tcg_out32 (s, MULLI | RT (args[0]) | RA (args[1]) | (args[2] & 0xffff)); else { tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]); tcg_out32 (s, MULLW | TAB (args[0], args[1], 0)); } } else tcg_out32 (s, MULLW | TAB (args[0], args[1], args[2])); break; case INDEX_op_div_i32: tcg_out32 (s, DIVW | TAB (args[0], args[1], args[2])); break; case INDEX_op_divu_i32: tcg_out32 (s, DIVWU | TAB (args[0], args[1], args[2])); break; case INDEX_op_rem_i32: tcg_out32 (s, DIVW | TAB (0, args[1], args[2])); tcg_out32 (s, MULLW | TAB (0, 0, args[2])); tcg_out32 (s, SUBF | TAB (args[0], 0, args[1])); break; case INDEX_op_remu_i32: tcg_out32 (s, DIVWU | TAB (0, args[1], args[2])); tcg_out32 (s, MULLW | TAB (0, 0, args[2])); tcg_out32 (s, SUBF | TAB (args[0], 0, args[1])); break; case INDEX_op_shl_i32: if (const_args[2]) { tcg_out32 (s, (RLWINM | RA (args[0]) | RS (args[1]) | SH (args[2]) | MB (0) | ME (31 - args[2]) ) ); } else tcg_out32 (s, SLW | SAB (args[1], args[0], args[2])); break; case INDEX_op_shr_i32: if (const_args[2]) { tcg_out32 (s, (RLWINM | RA (args[0]) | RS (args[1]) | SH (32 - args[2]) | MB (args[2]) | ME (31) ) ); } else tcg_out32 (s, SRW | SAB (args[1], args[0], args[2])); break; case INDEX_op_sar_i32: if (const_args[2]) tcg_out32 (s, SRAWI | RS (args[1]) | RA (args[0]) | SH (args[2])); else tcg_out32 (s, SRAW | SAB (args[1], args[0], args[2])); break; case INDEX_op_brcond_i32: tcg_out_brcond (s, args[2], args[0], args[1], const_args[1], args[3], 0); break; case INDEX_op_brcond_i64: tcg_out_brcond (s, args[2], args[0], args[1], const_args[1], args[3], 1); break; case INDEX_op_neg_i32: case INDEX_op_neg_i64: tcg_out32 (s, NEG | RT (args[0]) | RA (args[1])); break; case INDEX_op_not_i32: case INDEX_op_not_i64: tcg_out32 (s, NOR | SAB (args[1], args[0], args[1])); break; case INDEX_op_add_i64: if (const_args[2]) ppc_addi64 (s, args[0], args[1], args[2]); else tcg_out32 (s, ADD | TAB (args[0], args[1], args[2])); break; case INDEX_op_sub_i64: if (const_args[2]) ppc_addi64 (s, args[0], args[1], -args[2]); else tcg_out32 (s, SUBF | TAB (args[0], args[2], args[1])); break; case INDEX_op_shl_i64: if (const_args[2]) tcg_out_rld (s, RLDICR, args[0], args[1], args[2], 63 - args[2]); else tcg_out32 (s, SLD | SAB (args[1], args[0], args[2])); break; case INDEX_op_shr_i64: if (const_args[2]) tcg_out_rld (s, RLDICL, args[0], args[1], 64 - args[2], args[2]); else tcg_out32 (s, SRD | SAB (args[1], args[0], args[2])); break; case INDEX_op_sar_i64: if (const_args[2]) { int sh = SH (args[2] & 0x1f) | (((args[2] >> 5) & 1) << 1); tcg_out32 (s, SRADI | RA (args[0]) | RS (args[1]) | sh); } else tcg_out32 (s, SRAD | SAB (args[1], args[0], args[2])); break; case INDEX_op_mul_i64: tcg_out32 (s, MULLD | TAB (args[0], args[1], args[2])); break; case INDEX_op_div_i64: tcg_out32 (s, DIVD | TAB (args[0], args[1], args[2])); break; case INDEX_op_divu_i64: tcg_out32 (s, DIVDU | TAB (args[0], args[1], args[2])); break; case INDEX_op_rem_i64: tcg_out32 (s, DIVD | TAB (0, args[1], args[2])); tcg_out32 (s, MULLD | TAB (0, 0, args[2])); tcg_out32 (s, SUBF | TAB (args[0], 0, args[1])); break; case INDEX_op_remu_i64: tcg_out32 (s, DIVDU | TAB (0, args[1], args[2])); tcg_out32 (s, MULLD | TAB (0, 0, args[2])); tcg_out32 (s, SUBF | TAB (args[0], 0, args[1])); break; case INDEX_op_qemu_ld8u: tcg_out_qemu_ld (s, args, 0); break; case INDEX_op_qemu_ld8s: tcg_out_qemu_ld (s, args, 0 | 4); break; case INDEX_op_qemu_ld16u: tcg_out_qemu_ld (s, args, 1); break; case INDEX_op_qemu_ld16s: tcg_out_qemu_ld (s, args, 1 | 4); break; case INDEX_op_qemu_ld32: case INDEX_op_qemu_ld32u: tcg_out_qemu_ld (s, args, 2); break; case INDEX_op_qemu_ld32s: tcg_out_qemu_ld (s, args, 2 | 4); break; case INDEX_op_qemu_ld64: tcg_out_qemu_ld (s, args, 3); break; case INDEX_op_qemu_st8: tcg_out_qemu_st (s, args, 0); break; case INDEX_op_qemu_st16: tcg_out_qemu_st (s, args, 1); break; case INDEX_op_qemu_st32: tcg_out_qemu_st (s, args, 2); break; case INDEX_op_qemu_st64: tcg_out_qemu_st (s, args, 3); break; case INDEX_op_ext8s_i32: case INDEX_op_ext8s_i64: c = EXTSB; goto gen_ext; case INDEX_op_ext16s_i32: case INDEX_op_ext16s_i64: c = EXTSH; goto gen_ext; case INDEX_op_ext32s_i64: c = EXTSW; goto gen_ext; gen_ext: tcg_out32 (s, c | RS (args[1]) | RA (args[0])); break; case INDEX_op_ext32u_i64: tcg_out_rld (s, RLDICR, args[0], args[1], 0, 32); break; case INDEX_op_setcond_i32: tcg_out_setcond (s, TCG_TYPE_I32, args[3], args[0], args[1], args[2], const_args[2]); break; case INDEX_op_setcond_i64: tcg_out_setcond (s, TCG_TYPE_I64, args[3], args[0], args[1], args[2], const_args[2]); break; default: tcg_dump_ops (s, stderr); tcg_abort (); } }
true
qemu
e89720b116131938fe3d4931302f69a28249c934
static void tcg_out_op (TCGContext *s, TCGOpcode opc, const TCGArg *args, const int *const_args) { int c; switch (opc) { case INDEX_op_exit_tb: tcg_out_movi (s, TCG_TYPE_I64, TCG_REG_R3, args[0]); tcg_out_b (s, 0, (tcg_target_long) tb_ret_addr); break; case INDEX_op_goto_tb: if (s->tb_jmp_offset) { s->tb_jmp_offset[args[0]] = s->code_ptr - s->code_buf; s->code_ptr += 28; } else { tcg_abort (); } s->tb_next_offset[args[0]] = s->code_ptr - s->code_buf; break; case INDEX_op_br: { TCGLabel *l = &s->labels[args[0]]; if (l->has_value) { tcg_out_b (s, 0, l->u.value); } else { uint32_t val = *(uint32_t *) s->code_ptr; tcg_out32 (s, B | (val & 0x3fffffc)); tcg_out_reloc (s, s->code_ptr - 4, R_PPC_REL24, args[0], 0); } } break; case INDEX_op_call: tcg_out_call (s, args[0], const_args[0]); break; case INDEX_op_jmp: if (const_args[0]) { tcg_out_b (s, 0, args[0]); } else { tcg_out32 (s, MTSPR | RS (args[0]) | CTR); tcg_out32 (s, BCCTR | BO_ALWAYS); } break; case INDEX_op_movi_i32: tcg_out_movi (s, TCG_TYPE_I32, args[0], args[1]); break; case INDEX_op_movi_i64: tcg_out_movi (s, TCG_TYPE_I64, args[0], args[1]); break; case INDEX_op_ld8u_i32: case INDEX_op_ld8u_i64: tcg_out_ldst (s, args[0], args[1], args[2], LBZ, LBZX); break; case INDEX_op_ld8s_i32: case INDEX_op_ld8s_i64: tcg_out_ldst (s, args[0], args[1], args[2], LBZ, LBZX); tcg_out32 (s, EXTSB | RS (args[0]) | RA (args[0])); break; case INDEX_op_ld16u_i32: case INDEX_op_ld16u_i64: tcg_out_ldst (s, args[0], args[1], args[2], LHZ, LHZX); break; case INDEX_op_ld16s_i32: case INDEX_op_ld16s_i64: tcg_out_ldst (s, args[0], args[1], args[2], LHA, LHAX); break; case INDEX_op_ld_i32: case INDEX_op_ld32u_i64: tcg_out_ldst (s, args[0], args[1], args[2], LWZ, LWZX); break; case INDEX_op_ld32s_i64: tcg_out_ldsta (s, args[0], args[1], args[2], LWA, LWAX); break; case INDEX_op_ld_i64: tcg_out_ldsta (s, args[0], args[1], args[2], LD, LDX); break; case INDEX_op_st8_i32: case INDEX_op_st8_i64: tcg_out_ldst (s, args[0], args[1], args[2], STB, STBX); break; case INDEX_op_st16_i32: case INDEX_op_st16_i64: tcg_out_ldst (s, args[0], args[1], args[2], STH, STHX); break; case INDEX_op_st_i32: case INDEX_op_st32_i64: tcg_out_ldst (s, args[0], args[1], args[2], STW, STWX); break; case INDEX_op_st_i64: tcg_out_ldsta (s, args[0], args[1], args[2], STD, STDX); break; case INDEX_op_add_i32: if (const_args[2]) ppc_addi32 (s, args[0], args[1], args[2]); else tcg_out32 (s, ADD | TAB (args[0], args[1], args[2])); break; case INDEX_op_sub_i32: if (const_args[2]) ppc_addi32 (s, args[0], args[1], -args[2]); else tcg_out32 (s, SUBF | TAB (args[0], args[2], args[1])); break; case INDEX_op_and_i64: case INDEX_op_and_i32: if (const_args[2]) { if ((args[2] & 0xffff) == args[2]) tcg_out32 (s, ANDI | RS (args[1]) | RA (args[0]) | args[2]); else if ((args[2] & 0xffff0000) == args[2]) tcg_out32 (s, ANDIS | RS (args[1]) | RA (args[0]) | ((args[2] >> 16) & 0xffff)); else { tcg_out_movi (s, (opc == INDEX_op_and_i32 ? TCG_TYPE_I32 : TCG_TYPE_I64), 0, args[2]); tcg_out32 (s, AND | SAB (args[1], args[0], 0)); } } else tcg_out32 (s, AND | SAB (args[1], args[0], args[2])); break; case INDEX_op_or_i64: case INDEX_op_or_i32: if (const_args[2]) { if (args[2] & 0xffff) { tcg_out32 (s, ORI | RS (args[1]) | RA (args[0]) | (args[2] & 0xffff)); if (args[2] >> 16) tcg_out32 (s, ORIS | RS (args[0]) | RA (args[0]) | ((args[2] >> 16) & 0xffff)); } else { tcg_out32 (s, ORIS | RS (args[1]) | RA (args[0]) | ((args[2] >> 16) & 0xffff)); } } else tcg_out32 (s, OR | SAB (args[1], args[0], args[2])); break; case INDEX_op_xor_i64: case INDEX_op_xor_i32: if (const_args[2]) { if ((args[2] & 0xffff) == args[2]) tcg_out32 (s, XORI | RS (args[1]) | RA (args[0]) | (args[2] & 0xffff)); else if ((args[2] & 0xffff0000) == args[2]) tcg_out32 (s, XORIS | RS (args[1]) | RA (args[0]) | ((args[2] >> 16) & 0xffff)); else { tcg_out_movi (s, (opc == INDEX_op_and_i32 ? TCG_TYPE_I32 : TCG_TYPE_I64), 0, args[2]); tcg_out32 (s, XOR | SAB (args[1], args[0], 0)); } } else tcg_out32 (s, XOR | SAB (args[1], args[0], args[2])); break; case INDEX_op_mul_i32: if (const_args[2]) { if (args[2] == (int16_t) args[2]) tcg_out32 (s, MULLI | RT (args[0]) | RA (args[1]) | (args[2] & 0xffff)); else { tcg_out_movi (s, TCG_TYPE_I32, 0, args[2]); tcg_out32 (s, MULLW | TAB (args[0], args[1], 0)); } } else tcg_out32 (s, MULLW | TAB (args[0], args[1], args[2])); break; case INDEX_op_div_i32: tcg_out32 (s, DIVW | TAB (args[0], args[1], args[2])); break; case INDEX_op_divu_i32: tcg_out32 (s, DIVWU | TAB (args[0], args[1], args[2])); break; case INDEX_op_rem_i32: tcg_out32 (s, DIVW | TAB (0, args[1], args[2])); tcg_out32 (s, MULLW | TAB (0, 0, args[2])); tcg_out32 (s, SUBF | TAB (args[0], 0, args[1])); break; case INDEX_op_remu_i32: tcg_out32 (s, DIVWU | TAB (0, args[1], args[2])); tcg_out32 (s, MULLW | TAB (0, 0, args[2])); tcg_out32 (s, SUBF | TAB (args[0], 0, args[1])); break; case INDEX_op_shl_i32: if (const_args[2]) { tcg_out32 (s, (RLWINM | RA (args[0]) | RS (args[1]) | SH (args[2]) | MB (0) | ME (31 - args[2]) ) ); } else tcg_out32 (s, SLW | SAB (args[1], args[0], args[2])); break; case INDEX_op_shr_i32: if (const_args[2]) { tcg_out32 (s, (RLWINM | RA (args[0]) | RS (args[1]) | SH (32 - args[2]) | MB (args[2]) | ME (31) ) ); } else tcg_out32 (s, SRW | SAB (args[1], args[0], args[2])); break; case INDEX_op_sar_i32: if (const_args[2]) tcg_out32 (s, SRAWI | RS (args[1]) | RA (args[0]) | SH (args[2])); else tcg_out32 (s, SRAW | SAB (args[1], args[0], args[2])); break; case INDEX_op_brcond_i32: tcg_out_brcond (s, args[2], args[0], args[1], const_args[1], args[3], 0); break; case INDEX_op_brcond_i64: tcg_out_brcond (s, args[2], args[0], args[1], const_args[1], args[3], 1); break; case INDEX_op_neg_i32: case INDEX_op_neg_i64: tcg_out32 (s, NEG | RT (args[0]) | RA (args[1])); break; case INDEX_op_not_i32: case INDEX_op_not_i64: tcg_out32 (s, NOR | SAB (args[1], args[0], args[1])); break; case INDEX_op_add_i64: if (const_args[2]) ppc_addi64 (s, args[0], args[1], args[2]); else tcg_out32 (s, ADD | TAB (args[0], args[1], args[2])); break; case INDEX_op_sub_i64: if (const_args[2]) ppc_addi64 (s, args[0], args[1], -args[2]); else tcg_out32 (s, SUBF | TAB (args[0], args[2], args[1])); break; case INDEX_op_shl_i64: if (const_args[2]) tcg_out_rld (s, RLDICR, args[0], args[1], args[2], 63 - args[2]); else tcg_out32 (s, SLD | SAB (args[1], args[0], args[2])); break; case INDEX_op_shr_i64: if (const_args[2]) tcg_out_rld (s, RLDICL, args[0], args[1], 64 - args[2], args[2]); else tcg_out32 (s, SRD | SAB (args[1], args[0], args[2])); break; case INDEX_op_sar_i64: if (const_args[2]) { int sh = SH (args[2] & 0x1f) | (((args[2] >> 5) & 1) << 1); tcg_out32 (s, SRADI | RA (args[0]) | RS (args[1]) | sh); } else tcg_out32 (s, SRAD | SAB (args[1], args[0], args[2])); break; case INDEX_op_mul_i64: tcg_out32 (s, MULLD | TAB (args[0], args[1], args[2])); break; case INDEX_op_div_i64: tcg_out32 (s, DIVD | TAB (args[0], args[1], args[2])); break; case INDEX_op_divu_i64: tcg_out32 (s, DIVDU | TAB (args[0], args[1], args[2])); break; case INDEX_op_rem_i64: tcg_out32 (s, DIVD | TAB (0, args[1], args[2])); tcg_out32 (s, MULLD | TAB (0, 0, args[2])); tcg_out32 (s, SUBF | TAB (args[0], 0, args[1])); break; case INDEX_op_remu_i64: tcg_out32 (s, DIVDU | TAB (0, args[1], args[2])); tcg_out32 (s, MULLD | TAB (0, 0, args[2])); tcg_out32 (s, SUBF | TAB (args[0], 0, args[1])); break; case INDEX_op_qemu_ld8u: tcg_out_qemu_ld (s, args, 0); break; case INDEX_op_qemu_ld8s: tcg_out_qemu_ld (s, args, 0 | 4); break; case INDEX_op_qemu_ld16u: tcg_out_qemu_ld (s, args, 1); break; case INDEX_op_qemu_ld16s: tcg_out_qemu_ld (s, args, 1 | 4); break; case INDEX_op_qemu_ld32: case INDEX_op_qemu_ld32u: tcg_out_qemu_ld (s, args, 2); break; case INDEX_op_qemu_ld32s: tcg_out_qemu_ld (s, args, 2 | 4); break; case INDEX_op_qemu_ld64: tcg_out_qemu_ld (s, args, 3); break; case INDEX_op_qemu_st8: tcg_out_qemu_st (s, args, 0); break; case INDEX_op_qemu_st16: tcg_out_qemu_st (s, args, 1); break; case INDEX_op_qemu_st32: tcg_out_qemu_st (s, args, 2); break; case INDEX_op_qemu_st64: tcg_out_qemu_st (s, args, 3); break; case INDEX_op_ext8s_i32: case INDEX_op_ext8s_i64: c = EXTSB; goto gen_ext; case INDEX_op_ext16s_i32: case INDEX_op_ext16s_i64: c = EXTSH; goto gen_ext; case INDEX_op_ext32s_i64: c = EXTSW; goto gen_ext; gen_ext: tcg_out32 (s, c | RS (args[1]) | RA (args[0])); break; case INDEX_op_ext32u_i64: tcg_out_rld (s, RLDICR, args[0], args[1], 0, 32); break; case INDEX_op_setcond_i32: tcg_out_setcond (s, TCG_TYPE_I32, args[3], args[0], args[1], args[2], const_args[2]); break; case INDEX_op_setcond_i64: tcg_out_setcond (s, TCG_TYPE_I64, args[3], args[0], args[1], args[2], const_args[2]); break; default: tcg_dump_ops (s, stderr); tcg_abort (); } }
{ "code": [ " tcg_out_rld (s, RLDICR, args[0], args[1], 0, 32);" ], "line_no": [ 725 ] }
static void FUNC_0 (TCGContext *VAR_0, TCGOpcode VAR_1, const TCGArg *VAR_2, const int *VAR_3) { int VAR_4; switch (VAR_1) { case INDEX_op_exit_tb: tcg_out_movi (VAR_0, TCG_TYPE_I64, TCG_REG_R3, VAR_2[0]); tcg_out_b (VAR_0, 0, (tcg_target_long) tb_ret_addr); break; case INDEX_op_goto_tb: if (VAR_0->tb_jmp_offset) { VAR_0->tb_jmp_offset[VAR_2[0]] = VAR_0->code_ptr - VAR_0->code_buf; VAR_0->code_ptr += 28; } else { tcg_abort (); } VAR_0->tb_next_offset[VAR_2[0]] = VAR_0->code_ptr - VAR_0->code_buf; break; case INDEX_op_br: { TCGLabel *l = &VAR_0->labels[VAR_2[0]]; if (l->has_value) { tcg_out_b (VAR_0, 0, l->u.value); } else { uint32_t val = *(uint32_t *) VAR_0->code_ptr; tcg_out32 (VAR_0, B | (val & 0x3fffffc)); tcg_out_reloc (VAR_0, VAR_0->code_ptr - 4, R_PPC_REL24, VAR_2[0], 0); } } break; case INDEX_op_call: tcg_out_call (VAR_0, VAR_2[0], VAR_3[0]); break; case INDEX_op_jmp: if (VAR_3[0]) { tcg_out_b (VAR_0, 0, VAR_2[0]); } else { tcg_out32 (VAR_0, MTSPR | RS (VAR_2[0]) | CTR); tcg_out32 (VAR_0, BCCTR | BO_ALWAYS); } break; case INDEX_op_movi_i32: tcg_out_movi (VAR_0, TCG_TYPE_I32, VAR_2[0], VAR_2[1]); break; case INDEX_op_movi_i64: tcg_out_movi (VAR_0, TCG_TYPE_I64, VAR_2[0], VAR_2[1]); break; case INDEX_op_ld8u_i32: case INDEX_op_ld8u_i64: tcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LBZ, LBZX); break; case INDEX_op_ld8s_i32: case INDEX_op_ld8s_i64: tcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LBZ, LBZX); tcg_out32 (VAR_0, EXTSB | RS (VAR_2[0]) | RA (VAR_2[0])); break; case INDEX_op_ld16u_i32: case INDEX_op_ld16u_i64: tcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LHZ, LHZX); break; case INDEX_op_ld16s_i32: case INDEX_op_ld16s_i64: tcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LHA, LHAX); break; case INDEX_op_ld_i32: case INDEX_op_ld32u_i64: tcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LWZ, LWZX); break; case INDEX_op_ld32s_i64: tcg_out_ldsta (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LWA, LWAX); break; case INDEX_op_ld_i64: tcg_out_ldsta (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LD, LDX); break; case INDEX_op_st8_i32: case INDEX_op_st8_i64: tcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], STB, STBX); break; case INDEX_op_st16_i32: case INDEX_op_st16_i64: tcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], STH, STHX); break; case INDEX_op_st_i32: case INDEX_op_st32_i64: tcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], STW, STWX); break; case INDEX_op_st_i64: tcg_out_ldsta (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], STD, STDX); break; case INDEX_op_add_i32: if (VAR_3[2]) ppc_addi32 (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2]); else tcg_out32 (VAR_0, ADD | TAB (VAR_2[0], VAR_2[1], VAR_2[2])); break; case INDEX_op_sub_i32: if (VAR_3[2]) ppc_addi32 (VAR_0, VAR_2[0], VAR_2[1], -VAR_2[2]); else tcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], VAR_2[2], VAR_2[1])); break; case INDEX_op_and_i64: case INDEX_op_and_i32: if (VAR_3[2]) { if ((VAR_2[2] & 0xffff) == VAR_2[2]) tcg_out32 (VAR_0, ANDI | RS (VAR_2[1]) | RA (VAR_2[0]) | VAR_2[2]); else if ((VAR_2[2] & 0xffff0000) == VAR_2[2]) tcg_out32 (VAR_0, ANDIS | RS (VAR_2[1]) | RA (VAR_2[0]) | ((VAR_2[2] >> 16) & 0xffff)); else { tcg_out_movi (VAR_0, (VAR_1 == INDEX_op_and_i32 ? TCG_TYPE_I32 : TCG_TYPE_I64), 0, VAR_2[2]); tcg_out32 (VAR_0, AND | SAB (VAR_2[1], VAR_2[0], 0)); } } else tcg_out32 (VAR_0, AND | SAB (VAR_2[1], VAR_2[0], VAR_2[2])); break; case INDEX_op_or_i64: case INDEX_op_or_i32: if (VAR_3[2]) { if (VAR_2[2] & 0xffff) { tcg_out32 (VAR_0, ORI | RS (VAR_2[1]) | RA (VAR_2[0]) | (VAR_2[2] & 0xffff)); if (VAR_2[2] >> 16) tcg_out32 (VAR_0, ORIS | RS (VAR_2[0]) | RA (VAR_2[0]) | ((VAR_2[2] >> 16) & 0xffff)); } else { tcg_out32 (VAR_0, ORIS | RS (VAR_2[1]) | RA (VAR_2[0]) | ((VAR_2[2] >> 16) & 0xffff)); } } else tcg_out32 (VAR_0, OR | SAB (VAR_2[1], VAR_2[0], VAR_2[2])); break; case INDEX_op_xor_i64: case INDEX_op_xor_i32: if (VAR_3[2]) { if ((VAR_2[2] & 0xffff) == VAR_2[2]) tcg_out32 (VAR_0, XORI | RS (VAR_2[1]) | RA (VAR_2[0]) | (VAR_2[2] & 0xffff)); else if ((VAR_2[2] & 0xffff0000) == VAR_2[2]) tcg_out32 (VAR_0, XORIS | RS (VAR_2[1]) | RA (VAR_2[0]) | ((VAR_2[2] >> 16) & 0xffff)); else { tcg_out_movi (VAR_0, (VAR_1 == INDEX_op_and_i32 ? TCG_TYPE_I32 : TCG_TYPE_I64), 0, VAR_2[2]); tcg_out32 (VAR_0, XOR | SAB (VAR_2[1], VAR_2[0], 0)); } } else tcg_out32 (VAR_0, XOR | SAB (VAR_2[1], VAR_2[0], VAR_2[2])); break; case INDEX_op_mul_i32: if (VAR_3[2]) { if (VAR_2[2] == (int16_t) VAR_2[2]) tcg_out32 (VAR_0, MULLI | RT (VAR_2[0]) | RA (VAR_2[1]) | (VAR_2[2] & 0xffff)); else { tcg_out_movi (VAR_0, TCG_TYPE_I32, 0, VAR_2[2]); tcg_out32 (VAR_0, MULLW | TAB (VAR_2[0], VAR_2[1], 0)); } } else tcg_out32 (VAR_0, MULLW | TAB (VAR_2[0], VAR_2[1], VAR_2[2])); break; case INDEX_op_div_i32: tcg_out32 (VAR_0, DIVW | TAB (VAR_2[0], VAR_2[1], VAR_2[2])); break; case INDEX_op_divu_i32: tcg_out32 (VAR_0, DIVWU | TAB (VAR_2[0], VAR_2[1], VAR_2[2])); break; case INDEX_op_rem_i32: tcg_out32 (VAR_0, DIVW | TAB (0, VAR_2[1], VAR_2[2])); tcg_out32 (VAR_0, MULLW | TAB (0, 0, VAR_2[2])); tcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], 0, VAR_2[1])); break; case INDEX_op_remu_i32: tcg_out32 (VAR_0, DIVWU | TAB (0, VAR_2[1], VAR_2[2])); tcg_out32 (VAR_0, MULLW | TAB (0, 0, VAR_2[2])); tcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], 0, VAR_2[1])); break; case INDEX_op_shl_i32: if (VAR_3[2]) { tcg_out32 (VAR_0, (RLWINM | RA (VAR_2[0]) | RS (VAR_2[1]) | SH (VAR_2[2]) | MB (0) | ME (31 - VAR_2[2]) ) ); } else tcg_out32 (VAR_0, SLW | SAB (VAR_2[1], VAR_2[0], VAR_2[2])); break; case INDEX_op_shr_i32: if (VAR_3[2]) { tcg_out32 (VAR_0, (RLWINM | RA (VAR_2[0]) | RS (VAR_2[1]) | SH (32 - VAR_2[2]) | MB (VAR_2[2]) | ME (31) ) ); } else tcg_out32 (VAR_0, SRW | SAB (VAR_2[1], VAR_2[0], VAR_2[2])); break; case INDEX_op_sar_i32: if (VAR_3[2]) tcg_out32 (VAR_0, SRAWI | RS (VAR_2[1]) | RA (VAR_2[0]) | SH (VAR_2[2])); else tcg_out32 (VAR_0, SRAW | SAB (VAR_2[1], VAR_2[0], VAR_2[2])); break; case INDEX_op_brcond_i32: tcg_out_brcond (VAR_0, VAR_2[2], VAR_2[0], VAR_2[1], VAR_3[1], VAR_2[3], 0); break; case INDEX_op_brcond_i64: tcg_out_brcond (VAR_0, VAR_2[2], VAR_2[0], VAR_2[1], VAR_3[1], VAR_2[3], 1); break; case INDEX_op_neg_i32: case INDEX_op_neg_i64: tcg_out32 (VAR_0, NEG | RT (VAR_2[0]) | RA (VAR_2[1])); break; case INDEX_op_not_i32: case INDEX_op_not_i64: tcg_out32 (VAR_0, NOR | SAB (VAR_2[1], VAR_2[0], VAR_2[1])); break; case INDEX_op_add_i64: if (VAR_3[2]) ppc_addi64 (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2]); else tcg_out32 (VAR_0, ADD | TAB (VAR_2[0], VAR_2[1], VAR_2[2])); break; case INDEX_op_sub_i64: if (VAR_3[2]) ppc_addi64 (VAR_0, VAR_2[0], VAR_2[1], -VAR_2[2]); else tcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], VAR_2[2], VAR_2[1])); break; case INDEX_op_shl_i64: if (VAR_3[2]) tcg_out_rld (VAR_0, RLDICR, VAR_2[0], VAR_2[1], VAR_2[2], 63 - VAR_2[2]); else tcg_out32 (VAR_0, SLD | SAB (VAR_2[1], VAR_2[0], VAR_2[2])); break; case INDEX_op_shr_i64: if (VAR_3[2]) tcg_out_rld (VAR_0, RLDICL, VAR_2[0], VAR_2[1], 64 - VAR_2[2], VAR_2[2]); else tcg_out32 (VAR_0, SRD | SAB (VAR_2[1], VAR_2[0], VAR_2[2])); break; case INDEX_op_sar_i64: if (VAR_3[2]) { int VAR_5 = SH (VAR_2[2] & 0x1f) | (((VAR_2[2] >> 5) & 1) << 1); tcg_out32 (VAR_0, SRADI | RA (VAR_2[0]) | RS (VAR_2[1]) | VAR_5); } else tcg_out32 (VAR_0, SRAD | SAB (VAR_2[1], VAR_2[0], VAR_2[2])); break; case INDEX_op_mul_i64: tcg_out32 (VAR_0, MULLD | TAB (VAR_2[0], VAR_2[1], VAR_2[2])); break; case INDEX_op_div_i64: tcg_out32 (VAR_0, DIVD | TAB (VAR_2[0], VAR_2[1], VAR_2[2])); break; case INDEX_op_divu_i64: tcg_out32 (VAR_0, DIVDU | TAB (VAR_2[0], VAR_2[1], VAR_2[2])); break; case INDEX_op_rem_i64: tcg_out32 (VAR_0, DIVD | TAB (0, VAR_2[1], VAR_2[2])); tcg_out32 (VAR_0, MULLD | TAB (0, 0, VAR_2[2])); tcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], 0, VAR_2[1])); break; case INDEX_op_remu_i64: tcg_out32 (VAR_0, DIVDU | TAB (0, VAR_2[1], VAR_2[2])); tcg_out32 (VAR_0, MULLD | TAB (0, 0, VAR_2[2])); tcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], 0, VAR_2[1])); break; case INDEX_op_qemu_ld8u: tcg_out_qemu_ld (VAR_0, VAR_2, 0); break; case INDEX_op_qemu_ld8s: tcg_out_qemu_ld (VAR_0, VAR_2, 0 | 4); break; case INDEX_op_qemu_ld16u: tcg_out_qemu_ld (VAR_0, VAR_2, 1); break; case INDEX_op_qemu_ld16s: tcg_out_qemu_ld (VAR_0, VAR_2, 1 | 4); break; case INDEX_op_qemu_ld32: case INDEX_op_qemu_ld32u: tcg_out_qemu_ld (VAR_0, VAR_2, 2); break; case INDEX_op_qemu_ld32s: tcg_out_qemu_ld (VAR_0, VAR_2, 2 | 4); break; case INDEX_op_qemu_ld64: tcg_out_qemu_ld (VAR_0, VAR_2, 3); break; case INDEX_op_qemu_st8: tcg_out_qemu_st (VAR_0, VAR_2, 0); break; case INDEX_op_qemu_st16: tcg_out_qemu_st (VAR_0, VAR_2, 1); break; case INDEX_op_qemu_st32: tcg_out_qemu_st (VAR_0, VAR_2, 2); break; case INDEX_op_qemu_st64: tcg_out_qemu_st (VAR_0, VAR_2, 3); break; case INDEX_op_ext8s_i32: case INDEX_op_ext8s_i64: VAR_4 = EXTSB; goto gen_ext; case INDEX_op_ext16s_i32: case INDEX_op_ext16s_i64: VAR_4 = EXTSH; goto gen_ext; case INDEX_op_ext32s_i64: VAR_4 = EXTSW; goto gen_ext; gen_ext: tcg_out32 (VAR_0, VAR_4 | RS (VAR_2[1]) | RA (VAR_2[0])); break; case INDEX_op_ext32u_i64: tcg_out_rld (VAR_0, RLDICR, VAR_2[0], VAR_2[1], 0, 32); break; case INDEX_op_setcond_i32: tcg_out_setcond (VAR_0, TCG_TYPE_I32, VAR_2[3], VAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2]); break; case INDEX_op_setcond_i64: tcg_out_setcond (VAR_0, TCG_TYPE_I64, VAR_2[3], VAR_2[0], VAR_2[1], VAR_2[2], VAR_3[2]); break; default: tcg_dump_ops (VAR_0, stderr); tcg_abort (); } }
[ "static void FUNC_0 (TCGContext *VAR_0, TCGOpcode VAR_1, const TCGArg *VAR_2,\nconst int *VAR_3)\n{", "int VAR_4;", "switch (VAR_1) {", "case INDEX_op_exit_tb:\ntcg_out_movi (VAR_0, TCG_TYPE_I64, TCG_REG_R3, VAR_2[0]);", "tcg_out_b (VAR_0, 0, (tcg_target_long) tb_ret_addr);", "break;", "case INDEX_op_goto_tb:\nif (VAR_0->tb_jmp_offset) {", "VAR_0->tb_jmp_offset[VAR_2[0]] = VAR_0->code_ptr - VAR_0->code_buf;", "VAR_0->code_ptr += 28;", "}", "else {", "tcg_abort ();", "}", "VAR_0->tb_next_offset[VAR_2[0]] = VAR_0->code_ptr - VAR_0->code_buf;", "break;", "case INDEX_op_br:\n{", "TCGLabel *l = &VAR_0->labels[VAR_2[0]];", "if (l->has_value) {", "tcg_out_b (VAR_0, 0, l->u.value);", "}", "else {", "uint32_t val = *(uint32_t *) VAR_0->code_ptr;", "tcg_out32 (VAR_0, B | (val & 0x3fffffc));", "tcg_out_reloc (VAR_0, VAR_0->code_ptr - 4, R_PPC_REL24, VAR_2[0], 0);", "}", "}", "break;", "case INDEX_op_call:\ntcg_out_call (VAR_0, VAR_2[0], VAR_3[0]);", "break;", "case INDEX_op_jmp:\nif (VAR_3[0]) {", "tcg_out_b (VAR_0, 0, VAR_2[0]);", "}", "else {", "tcg_out32 (VAR_0, MTSPR | RS (VAR_2[0]) | CTR);", "tcg_out32 (VAR_0, BCCTR | BO_ALWAYS);", "}", "break;", "case INDEX_op_movi_i32:\ntcg_out_movi (VAR_0, TCG_TYPE_I32, VAR_2[0], VAR_2[1]);", "break;", "case INDEX_op_movi_i64:\ntcg_out_movi (VAR_0, TCG_TYPE_I64, VAR_2[0], VAR_2[1]);", "break;", "case INDEX_op_ld8u_i32:\ncase INDEX_op_ld8u_i64:\ntcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LBZ, LBZX);", "break;", "case INDEX_op_ld8s_i32:\ncase INDEX_op_ld8s_i64:\ntcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LBZ, LBZX);", "tcg_out32 (VAR_0, EXTSB | RS (VAR_2[0]) | RA (VAR_2[0]));", "break;", "case INDEX_op_ld16u_i32:\ncase INDEX_op_ld16u_i64:\ntcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LHZ, LHZX);", "break;", "case INDEX_op_ld16s_i32:\ncase INDEX_op_ld16s_i64:\ntcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LHA, LHAX);", "break;", "case INDEX_op_ld_i32:\ncase INDEX_op_ld32u_i64:\ntcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LWZ, LWZX);", "break;", "case INDEX_op_ld32s_i64:\ntcg_out_ldsta (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LWA, LWAX);", "break;", "case INDEX_op_ld_i64:\ntcg_out_ldsta (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], LD, LDX);", "break;", "case INDEX_op_st8_i32:\ncase INDEX_op_st8_i64:\ntcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], STB, STBX);", "break;", "case INDEX_op_st16_i32:\ncase INDEX_op_st16_i64:\ntcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], STH, STHX);", "break;", "case INDEX_op_st_i32:\ncase INDEX_op_st32_i64:\ntcg_out_ldst (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], STW, STWX);", "break;", "case INDEX_op_st_i64:\ntcg_out_ldsta (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2], STD, STDX);", "break;", "case INDEX_op_add_i32:\nif (VAR_3[2])\nppc_addi32 (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2]);", "else\ntcg_out32 (VAR_0, ADD | TAB (VAR_2[0], VAR_2[1], VAR_2[2]));", "break;", "case INDEX_op_sub_i32:\nif (VAR_3[2])\nppc_addi32 (VAR_0, VAR_2[0], VAR_2[1], -VAR_2[2]);", "else\ntcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], VAR_2[2], VAR_2[1]));", "break;", "case INDEX_op_and_i64:\ncase INDEX_op_and_i32:\nif (VAR_3[2]) {", "if ((VAR_2[2] & 0xffff) == VAR_2[2])\ntcg_out32 (VAR_0, ANDI | RS (VAR_2[1]) | RA (VAR_2[0]) | VAR_2[2]);", "else if ((VAR_2[2] & 0xffff0000) == VAR_2[2])\ntcg_out32 (VAR_0, ANDIS | RS (VAR_2[1]) | RA (VAR_2[0])\n| ((VAR_2[2] >> 16) & 0xffff));", "else {", "tcg_out_movi (VAR_0, (VAR_1 == INDEX_op_and_i32\n? TCG_TYPE_I32\n: TCG_TYPE_I64),\n0, VAR_2[2]);", "tcg_out32 (VAR_0, AND | SAB (VAR_2[1], VAR_2[0], 0));", "}", "}", "else\ntcg_out32 (VAR_0, AND | SAB (VAR_2[1], VAR_2[0], VAR_2[2]));", "break;", "case INDEX_op_or_i64:\ncase INDEX_op_or_i32:\nif (VAR_3[2]) {", "if (VAR_2[2] & 0xffff) {", "tcg_out32 (VAR_0, ORI | RS (VAR_2[1]) | RA (VAR_2[0])\n| (VAR_2[2] & 0xffff));", "if (VAR_2[2] >> 16)\ntcg_out32 (VAR_0, ORIS | RS (VAR_2[0]) | RA (VAR_2[0])\n| ((VAR_2[2] >> 16) & 0xffff));", "}", "else {", "tcg_out32 (VAR_0, ORIS | RS (VAR_2[1]) | RA (VAR_2[0])\n| ((VAR_2[2] >> 16) & 0xffff));", "}", "}", "else\ntcg_out32 (VAR_0, OR | SAB (VAR_2[1], VAR_2[0], VAR_2[2]));", "break;", "case INDEX_op_xor_i64:\ncase INDEX_op_xor_i32:\nif (VAR_3[2]) {", "if ((VAR_2[2] & 0xffff) == VAR_2[2])\ntcg_out32 (VAR_0, XORI | RS (VAR_2[1]) | RA (VAR_2[0])\n| (VAR_2[2] & 0xffff));", "else if ((VAR_2[2] & 0xffff0000) == VAR_2[2])\ntcg_out32 (VAR_0, XORIS | RS (VAR_2[1]) | RA (VAR_2[0])\n| ((VAR_2[2] >> 16) & 0xffff));", "else {", "tcg_out_movi (VAR_0, (VAR_1 == INDEX_op_and_i32\n? TCG_TYPE_I32\n: TCG_TYPE_I64),\n0, VAR_2[2]);", "tcg_out32 (VAR_0, XOR | SAB (VAR_2[1], VAR_2[0], 0));", "}", "}", "else\ntcg_out32 (VAR_0, XOR | SAB (VAR_2[1], VAR_2[0], VAR_2[2]));", "break;", "case INDEX_op_mul_i32:\nif (VAR_3[2]) {", "if (VAR_2[2] == (int16_t) VAR_2[2])\ntcg_out32 (VAR_0, MULLI | RT (VAR_2[0]) | RA (VAR_2[1])\n| (VAR_2[2] & 0xffff));", "else {", "tcg_out_movi (VAR_0, TCG_TYPE_I32, 0, VAR_2[2]);", "tcg_out32 (VAR_0, MULLW | TAB (VAR_2[0], VAR_2[1], 0));", "}", "}", "else\ntcg_out32 (VAR_0, MULLW | TAB (VAR_2[0], VAR_2[1], VAR_2[2]));", "break;", "case INDEX_op_div_i32:\ntcg_out32 (VAR_0, DIVW | TAB (VAR_2[0], VAR_2[1], VAR_2[2]));", "break;", "case INDEX_op_divu_i32:\ntcg_out32 (VAR_0, DIVWU | TAB (VAR_2[0], VAR_2[1], VAR_2[2]));", "break;", "case INDEX_op_rem_i32:\ntcg_out32 (VAR_0, DIVW | TAB (0, VAR_2[1], VAR_2[2]));", "tcg_out32 (VAR_0, MULLW | TAB (0, 0, VAR_2[2]));", "tcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], 0, VAR_2[1]));", "break;", "case INDEX_op_remu_i32:\ntcg_out32 (VAR_0, DIVWU | TAB (0, VAR_2[1], VAR_2[2]));", "tcg_out32 (VAR_0, MULLW | TAB (0, 0, VAR_2[2]));", "tcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], 0, VAR_2[1]));", "break;", "case INDEX_op_shl_i32:\nif (VAR_3[2]) {", "tcg_out32 (VAR_0, (RLWINM\n| RA (VAR_2[0])\n| RS (VAR_2[1])\n| SH (VAR_2[2])\n| MB (0)\n| ME (31 - VAR_2[2])\n)\n);", "}", "else\ntcg_out32 (VAR_0, SLW | SAB (VAR_2[1], VAR_2[0], VAR_2[2]));", "break;", "case INDEX_op_shr_i32:\nif (VAR_3[2]) {", "tcg_out32 (VAR_0, (RLWINM\n| RA (VAR_2[0])\n| RS (VAR_2[1])\n| SH (32 - VAR_2[2])\n| MB (VAR_2[2])\n| ME (31)\n)\n);", "}", "else\ntcg_out32 (VAR_0, SRW | SAB (VAR_2[1], VAR_2[0], VAR_2[2]));", "break;", "case INDEX_op_sar_i32:\nif (VAR_3[2])\ntcg_out32 (VAR_0, SRAWI | RS (VAR_2[1]) | RA (VAR_2[0]) | SH (VAR_2[2]));", "else\ntcg_out32 (VAR_0, SRAW | SAB (VAR_2[1], VAR_2[0], VAR_2[2]));", "break;", "case INDEX_op_brcond_i32:\ntcg_out_brcond (VAR_0, VAR_2[2], VAR_2[0], VAR_2[1], VAR_3[1], VAR_2[3], 0);", "break;", "case INDEX_op_brcond_i64:\ntcg_out_brcond (VAR_0, VAR_2[2], VAR_2[0], VAR_2[1], VAR_3[1], VAR_2[3], 1);", "break;", "case INDEX_op_neg_i32:\ncase INDEX_op_neg_i64:\ntcg_out32 (VAR_0, NEG | RT (VAR_2[0]) | RA (VAR_2[1]));", "break;", "case INDEX_op_not_i32:\ncase INDEX_op_not_i64:\ntcg_out32 (VAR_0, NOR | SAB (VAR_2[1], VAR_2[0], VAR_2[1]));", "break;", "case INDEX_op_add_i64:\nif (VAR_3[2])\nppc_addi64 (VAR_0, VAR_2[0], VAR_2[1], VAR_2[2]);", "else\ntcg_out32 (VAR_0, ADD | TAB (VAR_2[0], VAR_2[1], VAR_2[2]));", "break;", "case INDEX_op_sub_i64:\nif (VAR_3[2])\nppc_addi64 (VAR_0, VAR_2[0], VAR_2[1], -VAR_2[2]);", "else\ntcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], VAR_2[2], VAR_2[1]));", "break;", "case INDEX_op_shl_i64:\nif (VAR_3[2])\ntcg_out_rld (VAR_0, RLDICR, VAR_2[0], VAR_2[1], VAR_2[2], 63 - VAR_2[2]);", "else\ntcg_out32 (VAR_0, SLD | SAB (VAR_2[1], VAR_2[0], VAR_2[2]));", "break;", "case INDEX_op_shr_i64:\nif (VAR_3[2])\ntcg_out_rld (VAR_0, RLDICL, VAR_2[0], VAR_2[1], 64 - VAR_2[2], VAR_2[2]);", "else\ntcg_out32 (VAR_0, SRD | SAB (VAR_2[1], VAR_2[0], VAR_2[2]));", "break;", "case INDEX_op_sar_i64:\nif (VAR_3[2]) {", "int VAR_5 = SH (VAR_2[2] & 0x1f) | (((VAR_2[2] >> 5) & 1) << 1);", "tcg_out32 (VAR_0, SRADI | RA (VAR_2[0]) | RS (VAR_2[1]) | VAR_5);", "}", "else\ntcg_out32 (VAR_0, SRAD | SAB (VAR_2[1], VAR_2[0], VAR_2[2]));", "break;", "case INDEX_op_mul_i64:\ntcg_out32 (VAR_0, MULLD | TAB (VAR_2[0], VAR_2[1], VAR_2[2]));", "break;", "case INDEX_op_div_i64:\ntcg_out32 (VAR_0, DIVD | TAB (VAR_2[0], VAR_2[1], VAR_2[2]));", "break;", "case INDEX_op_divu_i64:\ntcg_out32 (VAR_0, DIVDU | TAB (VAR_2[0], VAR_2[1], VAR_2[2]));", "break;", "case INDEX_op_rem_i64:\ntcg_out32 (VAR_0, DIVD | TAB (0, VAR_2[1], VAR_2[2]));", "tcg_out32 (VAR_0, MULLD | TAB (0, 0, VAR_2[2]));", "tcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], 0, VAR_2[1]));", "break;", "case INDEX_op_remu_i64:\ntcg_out32 (VAR_0, DIVDU | TAB (0, VAR_2[1], VAR_2[2]));", "tcg_out32 (VAR_0, MULLD | TAB (0, 0, VAR_2[2]));", "tcg_out32 (VAR_0, SUBF | TAB (VAR_2[0], 0, VAR_2[1]));", "break;", "case INDEX_op_qemu_ld8u:\ntcg_out_qemu_ld (VAR_0, VAR_2, 0);", "break;", "case INDEX_op_qemu_ld8s:\ntcg_out_qemu_ld (VAR_0, VAR_2, 0 | 4);", "break;", "case INDEX_op_qemu_ld16u:\ntcg_out_qemu_ld (VAR_0, VAR_2, 1);", "break;", "case INDEX_op_qemu_ld16s:\ntcg_out_qemu_ld (VAR_0, VAR_2, 1 | 4);", "break;", "case INDEX_op_qemu_ld32:\ncase INDEX_op_qemu_ld32u:\ntcg_out_qemu_ld (VAR_0, VAR_2, 2);", "break;", "case INDEX_op_qemu_ld32s:\ntcg_out_qemu_ld (VAR_0, VAR_2, 2 | 4);", "break;", "case INDEX_op_qemu_ld64:\ntcg_out_qemu_ld (VAR_0, VAR_2, 3);", "break;", "case INDEX_op_qemu_st8:\ntcg_out_qemu_st (VAR_0, VAR_2, 0);", "break;", "case INDEX_op_qemu_st16:\ntcg_out_qemu_st (VAR_0, VAR_2, 1);", "break;", "case INDEX_op_qemu_st32:\ntcg_out_qemu_st (VAR_0, VAR_2, 2);", "break;", "case INDEX_op_qemu_st64:\ntcg_out_qemu_st (VAR_0, VAR_2, 3);", "break;", "case INDEX_op_ext8s_i32:\ncase INDEX_op_ext8s_i64:\nVAR_4 = EXTSB;", "goto gen_ext;", "case INDEX_op_ext16s_i32:\ncase INDEX_op_ext16s_i64:\nVAR_4 = EXTSH;", "goto gen_ext;", "case INDEX_op_ext32s_i64:\nVAR_4 = EXTSW;", "goto gen_ext;", "gen_ext:\ntcg_out32 (VAR_0, VAR_4 | RS (VAR_2[1]) | RA (VAR_2[0]));", "break;", "case INDEX_op_ext32u_i64:\ntcg_out_rld (VAR_0, RLDICR, VAR_2[0], VAR_2[1], 0, 32);", "break;", "case INDEX_op_setcond_i32:\ntcg_out_setcond (VAR_0, TCG_TYPE_I32, VAR_2[3], VAR_2[0], VAR_2[1], VAR_2[2],\nVAR_3[2]);", "break;", "case INDEX_op_setcond_i64:\ntcg_out_setcond (VAR_0, TCG_TYPE_I64, VAR_2[3], VAR_2[0], VAR_2[1], VAR_2[2],\nVAR_3[2]);", "break;", "default:\ntcg_dump_ops (VAR_0, stderr);", "tcg_abort ();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113, 115, 117 ], [ 119 ], [ 121, 123, 125 ], [ 127 ], [ 129 ], [ 131, 133, 135 ], [ 137 ], [ 139, 141, 143 ], [ 145 ], [ 147, 149, 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 167, 169, 171 ], [ 173 ], [ 175, 177, 179 ], [ 181 ], [ 183, 185, 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 199, 201, 203 ], [ 205, 207 ], [ 209 ], [ 211, 213, 215 ], [ 217, 219 ], [ 221 ], [ 225, 227, 229 ], [ 231, 233 ], [ 235, 237, 239 ], [ 241 ], [ 243, 245, 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257, 259 ], [ 261 ], [ 263, 265, 267 ], [ 269 ], [ 271, 273 ], [ 275, 277, 279 ], [ 281 ], [ 283 ], [ 285, 287 ], [ 289 ], [ 291 ], [ 293, 295 ], [ 297 ], [ 299, 301, 303 ], [ 305, 307, 309 ], [ 311, 313, 315 ], [ 317 ], [ 319, 321, 323, 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333, 335 ], [ 337 ], [ 341, 343 ], [ 345, 347, 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361, 363 ], [ 365 ], [ 369, 371 ], [ 373 ], [ 377, 379 ], [ 381 ], [ 385, 387 ], [ 389 ], [ 391 ], [ 393 ], [ 397, 399 ], [ 401 ], [ 403 ], [ 405 ], [ 409, 411 ], [ 413, 415, 417, 419, 421, 423, 425, 427 ], [ 429 ], [ 431, 433 ], [ 435 ], [ 437, 439 ], [ 441, 443, 445, 447, 449, 451, 453, 455 ], [ 457 ], [ 459, 461 ], [ 463 ], [ 465, 467, 469 ], [ 471, 473 ], [ 475 ], [ 479, 481 ], [ 483 ], [ 487, 489 ], [ 491 ], [ 495, 497, 499 ], [ 501 ], [ 505, 507, 509 ], [ 511 ], [ 515, 517, 519 ], [ 521, 523 ], [ 525 ], [ 527, 529, 531 ], [ 533, 535 ], [ 537 ], [ 541, 543, 545 ], [ 547, 549 ], [ 551 ], [ 553, 555, 557 ], [ 559, 561 ], [ 563 ], [ 565, 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575, 577 ], [ 579 ], [ 583, 585 ], [ 587 ], [ 589, 591 ], [ 593 ], [ 595, 597 ], [ 599 ], [ 601, 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611, 613 ], [ 615 ], [ 617 ], [ 619 ], [ 623, 625 ], [ 627 ], [ 629, 631 ], [ 633 ], [ 635, 637 ], [ 639 ], [ 641, 643 ], [ 645 ], [ 647, 649, 651 ], [ 653 ], [ 655, 657 ], [ 659 ], [ 661, 663 ], [ 665 ], [ 667, 669 ], [ 671 ], [ 673, 675 ], [ 677 ], [ 679, 681 ], [ 683 ], [ 685, 687 ], [ 689 ], [ 693, 695, 697 ], [ 699 ], [ 701, 703, 705 ], [ 707 ], [ 709, 711 ], [ 713 ], [ 715, 717 ], [ 719 ], [ 723, 725 ], [ 727 ], [ 731, 733, 735 ], [ 737 ], [ 739, 741, 743 ], [ 745 ], [ 749, 751 ], [ 753 ], [ 755 ], [ 757 ] ]
12,277
static int fdctrl_init_common(FDCtrl *fdctrl) { int i, j; static int command_tables_inited = 0; /* Fill 'command_to_handler' lookup table */ if (!command_tables_inited) { command_tables_inited = 1; for (i = ARRAY_SIZE(handlers) - 1; i >= 0; i--) { for (j = 0; j < sizeof(command_to_handler); j++) { if ((j & handlers[i].mask) == handlers[i].value) { command_to_handler[j] = i; } } } } FLOPPY_DPRINTF("init controller\n"); fdctrl->fifo = qemu_memalign(512, FD_SECTOR_LEN); fdctrl->fifo_size = 512; fdctrl->result_timer = qemu_new_timer(vm_clock, fdctrl_result_timer, fdctrl); fdctrl->version = 0x90; /* Intel 82078 controller */ fdctrl->config = FD_CONFIG_EIS | FD_CONFIG_EFIFO; /* Implicit seek, polling & FIFO enabled */ fdctrl->num_floppies = MAX_FD; if (fdctrl->dma_chann != -1) DMA_register_channel(fdctrl->dma_chann, &fdctrl_transfer_handler, fdctrl); fdctrl_connect_drives(fdctrl); return 0; }
true
qemu
b47b35250fbfa062aedf6ab6e5faab84c4a76f4f
static int fdctrl_init_common(FDCtrl *fdctrl) { int i, j; static int command_tables_inited = 0; if (!command_tables_inited) { command_tables_inited = 1; for (i = ARRAY_SIZE(handlers) - 1; i >= 0; i--) { for (j = 0; j < sizeof(command_to_handler); j++) { if ((j & handlers[i].mask) == handlers[i].value) { command_to_handler[j] = i; } } } } FLOPPY_DPRINTF("init controller\n"); fdctrl->fifo = qemu_memalign(512, FD_SECTOR_LEN); fdctrl->fifo_size = 512; fdctrl->result_timer = qemu_new_timer(vm_clock, fdctrl_result_timer, fdctrl); fdctrl->version = 0x90; fdctrl->config = FD_CONFIG_EIS | FD_CONFIG_EFIFO; fdctrl->num_floppies = MAX_FD; if (fdctrl->dma_chann != -1) DMA_register_channel(fdctrl->dma_chann, &fdctrl_transfer_handler, fdctrl); fdctrl_connect_drives(fdctrl); return 0; }
{ "code": [ " fdctrl_connect_drives(fdctrl);", " return 0;" ], "line_no": [ 59, 63 ] }
static int FUNC_0(FDCtrl *VAR_0) { int VAR_1, VAR_2; static int VAR_3 = 0; if (!VAR_3) { VAR_3 = 1; for (VAR_1 = ARRAY_SIZE(handlers) - 1; VAR_1 >= 0; VAR_1--) { for (VAR_2 = 0; VAR_2 < sizeof(command_to_handler); VAR_2++) { if ((VAR_2 & handlers[VAR_1].mask) == handlers[VAR_1].value) { command_to_handler[VAR_2] = VAR_1; } } } } FLOPPY_DPRINTF("init controller\n"); VAR_0->fifo = qemu_memalign(512, FD_SECTOR_LEN); VAR_0->fifo_size = 512; VAR_0->result_timer = qemu_new_timer(vm_clock, fdctrl_result_timer, VAR_0); VAR_0->version = 0x90; VAR_0->config = FD_CONFIG_EIS | FD_CONFIG_EFIFO; VAR_0->num_floppies = MAX_FD; if (VAR_0->dma_chann != -1) DMA_register_channel(VAR_0->dma_chann, &fdctrl_transfer_handler, VAR_0); fdctrl_connect_drives(VAR_0); return 0; }
[ "static int FUNC_0(FDCtrl *VAR_0)\n{", "int VAR_1, VAR_2;", "static int VAR_3 = 0;", "if (!VAR_3) {", "VAR_3 = 1;", "for (VAR_1 = ARRAY_SIZE(handlers) - 1; VAR_1 >= 0; VAR_1--) {", "for (VAR_2 = 0; VAR_2 < sizeof(command_to_handler); VAR_2++) {", "if ((VAR_2 & handlers[VAR_1].mask) == handlers[VAR_1].value) {", "command_to_handler[VAR_2] = VAR_1;", "}", "}", "}", "}", "FLOPPY_DPRINTF(\"init controller\\n\");", "VAR_0->fifo = qemu_memalign(512, FD_SECTOR_LEN);", "VAR_0->fifo_size = 512;", "VAR_0->result_timer = qemu_new_timer(vm_clock,\nfdctrl_result_timer, VAR_0);", "VAR_0->version = 0x90;", "VAR_0->config = FD_CONFIG_EIS | FD_CONFIG_EFIFO;", "VAR_0->num_floppies = MAX_FD;", "if (VAR_0->dma_chann != -1)\nDMA_register_channel(VAR_0->dma_chann, &fdctrl_transfer_handler, VAR_0);", "fdctrl_connect_drives(VAR_0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 63 ], [ 65 ] ]
12,279
static int32_t scsi_send_command(SCSIRequest *req, uint8_t *cmd) { SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, req->dev); SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req); int ret; scsi_req_enqueue(req); if (cmd[0] != REQUEST_SENSE && (req->lun != s->lun || (cmd[1] >> 5) != s->lun)) { DPRINTF("Unimplemented LUN %d\n", req->lun ? req->lun : cmd[1] >> 5); s->sensebuf[0] = 0x70; s->sensebuf[1] = 0x00; s->sensebuf[2] = ILLEGAL_REQUEST; s->sensebuf[3] = 0x00; s->sensebuf[4] = 0x00; s->sensebuf[5] = 0x00; s->sensebuf[6] = 0x00; s->senselen = 7; s->driver_status = SG_ERR_DRIVER_SENSE; r->req.status = CHECK_CONDITION; scsi_req_complete(&r->req); return 0; } if (-1 == scsi_req_parse(&r->req, cmd)) { BADF("Unsupported command length, command %x\n", cmd[0]); scsi_req_dequeue(&r->req); scsi_req_unref(&r->req); return 0; } scsi_req_fixup(&r->req); DPRINTF("Command: lun=%d tag=0x%x len %zd data=0x%02x", lun, tag, r->req.cmd.xfer, cmd[0]); #ifdef DEBUG_SCSI { int i; for (i = 1; i < r->req.cmd.len; i++) { printf(" 0x%02x", cmd[i]); } printf("\n"); } #endif if (r->req.cmd.xfer == 0) { if (r->buf != NULL) qemu_free(r->buf); r->buflen = 0; r->buf = NULL; ret = execute_command(s->bs, r, SG_DXFER_NONE, scsi_command_complete); if (ret == -1) { scsi_command_complete(r, -EINVAL); } return 0; } if (r->buflen != r->req.cmd.xfer) { if (r->buf != NULL) qemu_free(r->buf); r->buf = qemu_malloc(r->req.cmd.xfer); r->buflen = r->req.cmd.xfer; } memset(r->buf, 0, r->buflen); r->len = r->req.cmd.xfer; if (r->req.cmd.mode == SCSI_XFER_TO_DEV) { r->len = 0; return -r->req.cmd.xfer; } else { return r->req.cmd.xfer; } }
true
qemu
a1f0cce2ac0243572ff72aa561da67fe3766a395
static int32_t scsi_send_command(SCSIRequest *req, uint8_t *cmd) { SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, req->dev); SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req); int ret; scsi_req_enqueue(req); if (cmd[0] != REQUEST_SENSE && (req->lun != s->lun || (cmd[1] >> 5) != s->lun)) { DPRINTF("Unimplemented LUN %d\n", req->lun ? req->lun : cmd[1] >> 5); s->sensebuf[0] = 0x70; s->sensebuf[1] = 0x00; s->sensebuf[2] = ILLEGAL_REQUEST; s->sensebuf[3] = 0x00; s->sensebuf[4] = 0x00; s->sensebuf[5] = 0x00; s->sensebuf[6] = 0x00; s->senselen = 7; s->driver_status = SG_ERR_DRIVER_SENSE; r->req.status = CHECK_CONDITION; scsi_req_complete(&r->req); return 0; } if (-1 == scsi_req_parse(&r->req, cmd)) { BADF("Unsupported command length, command %x\n", cmd[0]); scsi_req_dequeue(&r->req); scsi_req_unref(&r->req); return 0; } scsi_req_fixup(&r->req); DPRINTF("Command: lun=%d tag=0x%x len %zd data=0x%02x", lun, tag, r->req.cmd.xfer, cmd[0]); #ifdef DEBUG_SCSI { int i; for (i = 1; i < r->req.cmd.len; i++) { printf(" 0x%02x", cmd[i]); } printf("\n"); } #endif if (r->req.cmd.xfer == 0) { if (r->buf != NULL) qemu_free(r->buf); r->buflen = 0; r->buf = NULL; ret = execute_command(s->bs, r, SG_DXFER_NONE, scsi_command_complete); if (ret == -1) { scsi_command_complete(r, -EINVAL); } return 0; } if (r->buflen != r->req.cmd.xfer) { if (r->buf != NULL) qemu_free(r->buf); r->buf = qemu_malloc(r->req.cmd.xfer); r->buflen = r->req.cmd.xfer; } memset(r->buf, 0, r->buflen); r->len = r->req.cmd.xfer; if (r->req.cmd.mode == SCSI_XFER_TO_DEV) { r->len = 0; return -r->req.cmd.xfer; } else { return r->req.cmd.xfer; } }
{ "code": [ " s->sensebuf[0] = 0x70;", " s->sensebuf[1] = 0x00;", " s->sensebuf[2] = ILLEGAL_REQUEST;", " s->sensebuf[3] = 0x00;", " s->sensebuf[4] = 0x00;", " s->sensebuf[5] = 0x00;", " s->sensebuf[6] = 0x00;", " s->senselen = 7;", " s->driver_status = SG_ERR_DRIVER_SENSE;", " scsi_req_dequeue(&r->req);", " scsi_req_unref(&r->req);", " if (ret == -1) {", " scsi_command_complete(r, -EINVAL);" ], "line_no": [ 23, 25, 27, 29, 31, 33, 35, 37, 39, 55, 57, 105, 107 ] }
static int32_t FUNC_0(SCSIRequest *req, uint8_t *cmd) { SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, req->dev); SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req); int VAR_0; scsi_req_enqueue(req); if (cmd[0] != REQUEST_SENSE && (req->lun != s->lun || (cmd[1] >> 5) != s->lun)) { DPRINTF("Unimplemented LUN %d\n", req->lun ? req->lun : cmd[1] >> 5); s->sensebuf[0] = 0x70; s->sensebuf[1] = 0x00; s->sensebuf[2] = ILLEGAL_REQUEST; s->sensebuf[3] = 0x00; s->sensebuf[4] = 0x00; s->sensebuf[5] = 0x00; s->sensebuf[6] = 0x00; s->senselen = 7; s->driver_status = SG_ERR_DRIVER_SENSE; r->req.status = CHECK_CONDITION; scsi_req_complete(&r->req); return 0; } if (-1 == scsi_req_parse(&r->req, cmd)) { BADF("Unsupported command length, command %x\n", cmd[0]); scsi_req_dequeue(&r->req); scsi_req_unref(&r->req); return 0; } scsi_req_fixup(&r->req); DPRINTF("Command: lun=%d tag=0x%x len %zd data=0x%02x", lun, tag, r->req.cmd.xfer, cmd[0]); #ifdef DEBUG_SCSI { int i; for (i = 1; i < r->req.cmd.len; i++) { printf(" 0x%02x", cmd[i]); } printf("\n"); } #endif if (r->req.cmd.xfer == 0) { if (r->buf != NULL) qemu_free(r->buf); r->buflen = 0; r->buf = NULL; VAR_0 = execute_command(s->bs, r, SG_DXFER_NONE, scsi_command_complete); if (VAR_0 == -1) { scsi_command_complete(r, -EINVAL); } return 0; } if (r->buflen != r->req.cmd.xfer) { if (r->buf != NULL) qemu_free(r->buf); r->buf = qemu_malloc(r->req.cmd.xfer); r->buflen = r->req.cmd.xfer; } memset(r->buf, 0, r->buflen); r->len = r->req.cmd.xfer; if (r->req.cmd.mode == SCSI_XFER_TO_DEV) { r->len = 0; return -r->req.cmd.xfer; } else { return r->req.cmd.xfer; } }
[ "static int32_t FUNC_0(SCSIRequest *req, uint8_t *cmd)\n{", "SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, req->dev);", "SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req);", "int VAR_0;", "scsi_req_enqueue(req);", "if (cmd[0] != REQUEST_SENSE &&\n(req->lun != s->lun || (cmd[1] >> 5) != s->lun)) {", "DPRINTF(\"Unimplemented LUN %d\\n\", req->lun ? req->lun : cmd[1] >> 5);", "s->sensebuf[0] = 0x70;", "s->sensebuf[1] = 0x00;", "s->sensebuf[2] = ILLEGAL_REQUEST;", "s->sensebuf[3] = 0x00;", "s->sensebuf[4] = 0x00;", "s->sensebuf[5] = 0x00;", "s->sensebuf[6] = 0x00;", "s->senselen = 7;", "s->driver_status = SG_ERR_DRIVER_SENSE;", "r->req.status = CHECK_CONDITION;", "scsi_req_complete(&r->req);", "return 0;", "}", "if (-1 == scsi_req_parse(&r->req, cmd)) {", "BADF(\"Unsupported command length, command %x\\n\", cmd[0]);", "scsi_req_dequeue(&r->req);", "scsi_req_unref(&r->req);", "return 0;", "}", "scsi_req_fixup(&r->req);", "DPRINTF(\"Command: lun=%d tag=0x%x len %zd data=0x%02x\", lun, tag,\nr->req.cmd.xfer, cmd[0]);", "#ifdef DEBUG_SCSI\n{", "int i;", "for (i = 1; i < r->req.cmd.len; i++) {", "printf(\" 0x%02x\", cmd[i]);", "}", "printf(\"\\n\");", "}", "#endif\nif (r->req.cmd.xfer == 0) {", "if (r->buf != NULL)\nqemu_free(r->buf);", "r->buflen = 0;", "r->buf = NULL;", "VAR_0 = execute_command(s->bs, r, SG_DXFER_NONE, scsi_command_complete);", "if (VAR_0 == -1) {", "scsi_command_complete(r, -EINVAL);", "}", "return 0;", "}", "if (r->buflen != r->req.cmd.xfer) {", "if (r->buf != NULL)\nqemu_free(r->buf);", "r->buf = qemu_malloc(r->req.cmd.xfer);", "r->buflen = r->req.cmd.xfer;", "}", "memset(r->buf, 0, r->buflen);", "r->len = r->req.cmd.xfer;", "if (r->req.cmd.mode == SCSI_XFER_TO_DEV) {", "r->len = 0;", "return -r->req.cmd.xfer;", "} else {", "return r->req.cmd.xfer;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ] ]
12,280
static void vfio_probe_ati_bar2_quirk(VFIOPCIDevice *vdev, int nr) { VFIOQuirk *quirk; VFIOConfigMirrorQuirk *mirror; /* Only enable on newer devices where BAR2 is 64bit */ if (!vfio_pci_is(vdev, PCI_VENDOR_ID_ATI, PCI_ANY_ID) || !vdev->has_vga || nr != 2 || !vdev->bars[2].mem64) { return; } quirk = g_malloc0(sizeof(*quirk)); mirror = quirk->data = g_malloc0(sizeof(*mirror)); mirror->mem = quirk->mem = g_malloc0(sizeof(MemoryRegion)); quirk->nr_mem = 1; mirror->vdev = vdev; mirror->offset = 0x4000; mirror->bar = nr; memory_region_init_io(mirror->mem, OBJECT(vdev), &vfio_generic_mirror_quirk, mirror, "vfio-ati-bar2-4000-quirk", PCI_CONFIG_SPACE_SIZE); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, mirror->offset, mirror->mem, 1); QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next); trace_vfio_quirk_ati_bar2_probe(vdev->vbasedev.name); }
true
qemu
bdd81addf4033ce26e6cd180b060f63095f3ded9
static void vfio_probe_ati_bar2_quirk(VFIOPCIDevice *vdev, int nr) { VFIOQuirk *quirk; VFIOConfigMirrorQuirk *mirror; if (!vfio_pci_is(vdev, PCI_VENDOR_ID_ATI, PCI_ANY_ID) || !vdev->has_vga || nr != 2 || !vdev->bars[2].mem64) { return; } quirk = g_malloc0(sizeof(*quirk)); mirror = quirk->data = g_malloc0(sizeof(*mirror)); mirror->mem = quirk->mem = g_malloc0(sizeof(MemoryRegion)); quirk->nr_mem = 1; mirror->vdev = vdev; mirror->offset = 0x4000; mirror->bar = nr; memory_region_init_io(mirror->mem, OBJECT(vdev), &vfio_generic_mirror_quirk, mirror, "vfio-ati-bar2-4000-quirk", PCI_CONFIG_SPACE_SIZE); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, mirror->offset, mirror->mem, 1); QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next); trace_vfio_quirk_ati_bar2_probe(vdev->vbasedev.name); }
{ "code": [ " mirror->mem = quirk->mem = g_malloc0(sizeof(MemoryRegion));", " mirror->mem = quirk->mem = g_malloc0(sizeof(MemoryRegion));" ], "line_no": [ 27, 27 ] }
static void FUNC_0(VFIOPCIDevice *VAR_0, int VAR_1) { VFIOQuirk *quirk; VFIOConfigMirrorQuirk *mirror; if (!vfio_pci_is(VAR_0, PCI_VENDOR_ID_ATI, PCI_ANY_ID) || !VAR_0->has_vga || VAR_1 != 2 || !VAR_0->bars[2].mem64) { return; } quirk = g_malloc0(sizeof(*quirk)); mirror = quirk->data = g_malloc0(sizeof(*mirror)); mirror->mem = quirk->mem = g_malloc0(sizeof(MemoryRegion)); quirk->nr_mem = 1; mirror->VAR_0 = VAR_0; mirror->offset = 0x4000; mirror->bar = VAR_1; memory_region_init_io(mirror->mem, OBJECT(VAR_0), &vfio_generic_mirror_quirk, mirror, "vfio-ati-bar2-4000-quirk", PCI_CONFIG_SPACE_SIZE); memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem, mirror->offset, mirror->mem, 1); QLIST_INSERT_HEAD(&VAR_0->bars[VAR_1].quirks, quirk, next); trace_vfio_quirk_ati_bar2_probe(VAR_0->vbasedev.name); }
[ "static void FUNC_0(VFIOPCIDevice *VAR_0, int VAR_1)\n{", "VFIOQuirk *quirk;", "VFIOConfigMirrorQuirk *mirror;", "if (!vfio_pci_is(VAR_0, PCI_VENDOR_ID_ATI, PCI_ANY_ID) ||\n!VAR_0->has_vga || VAR_1 != 2 || !VAR_0->bars[2].mem64) {", "return;", "}", "quirk = g_malloc0(sizeof(*quirk));", "mirror = quirk->data = g_malloc0(sizeof(*mirror));", "mirror->mem = quirk->mem = g_malloc0(sizeof(MemoryRegion));", "quirk->nr_mem = 1;", "mirror->VAR_0 = VAR_0;", "mirror->offset = 0x4000;", "mirror->bar = VAR_1;", "memory_region_init_io(mirror->mem, OBJECT(VAR_0),\n&vfio_generic_mirror_quirk, mirror,\n\"vfio-ati-bar2-4000-quirk\", PCI_CONFIG_SPACE_SIZE);", "memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem,\nmirror->offset, mirror->mem, 1);", "QLIST_INSERT_HEAD(&VAR_0->bars[VAR_1].quirks, quirk, next);", "trace_vfio_quirk_ati_bar2_probe(VAR_0->vbasedev.name);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41, 43 ], [ 45, 47 ], [ 51 ], [ 55 ], [ 57 ] ]
12,282
static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup) { pkt->data = NULL; pkt->side_data = NULL; if (pkt->buf) { AVBufferRef *ref = av_buffer_ref(src->buf); if (!ref) return AVERROR(ENOMEM); pkt->buf = ref; pkt->data = ref->data; } else { DUP_DATA(pkt->data, src->data, pkt->size, 1, ALLOC_BUF); } if (pkt->side_data_elems && dup) pkt->side_data = src->side_data; if (pkt->side_data_elems && !dup) { return av_copy_packet_side_data(pkt, src); } return 0; failed_alloc: av_packet_unref(pkt); return AVERROR(ENOMEM); }
true
FFmpeg
5e1bf9d8c0d2cdbbf17b06a5dfdf87a635b3203b
static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup) { pkt->data = NULL; pkt->side_data = NULL; if (pkt->buf) { AVBufferRef *ref = av_buffer_ref(src->buf); if (!ref) return AVERROR(ENOMEM); pkt->buf = ref; pkt->data = ref->data; } else { DUP_DATA(pkt->data, src->data, pkt->size, 1, ALLOC_BUF); } if (pkt->side_data_elems && dup) pkt->side_data = src->side_data; if (pkt->side_data_elems && !dup) { return av_copy_packet_side_data(pkt, src); } return 0; failed_alloc: av_packet_unref(pkt); return AVERROR(ENOMEM); }
{ "code": [ " if (pkt->side_data_elems && dup)", " if (pkt->side_data_elems && !dup) {" ], "line_no": [ 27, 31 ] }
static int FUNC_0(AVPacket *VAR_0, const AVPacket *VAR_1, int VAR_2) { VAR_0->data = NULL; VAR_0->side_data = NULL; if (VAR_0->buf) { AVBufferRef *ref = av_buffer_ref(VAR_1->buf); if (!ref) return AVERROR(ENOMEM); VAR_0->buf = ref; VAR_0->data = ref->data; } else { DUP_DATA(VAR_0->data, VAR_1->data, VAR_0->size, 1, ALLOC_BUF); } if (VAR_0->side_data_elems && VAR_2) VAR_0->side_data = VAR_1->side_data; if (VAR_0->side_data_elems && !VAR_2) { return av_copy_packet_side_data(VAR_0, VAR_1); } return 0; failed_alloc: av_packet_unref(VAR_0); return AVERROR(ENOMEM); }
[ "static int FUNC_0(AVPacket *VAR_0, const AVPacket *VAR_1, int VAR_2)\n{", "VAR_0->data = NULL;", "VAR_0->side_data = NULL;", "if (VAR_0->buf) {", "AVBufferRef *ref = av_buffer_ref(VAR_1->buf);", "if (!ref)\nreturn AVERROR(ENOMEM);", "VAR_0->buf = ref;", "VAR_0->data = ref->data;", "} else {", "DUP_DATA(VAR_0->data, VAR_1->data, VAR_0->size, 1, ALLOC_BUF);", "}", "if (VAR_0->side_data_elems && VAR_2)\nVAR_0->side_data = VAR_1->side_data;", "if (VAR_0->side_data_elems && !VAR_2) {", "return av_copy_packet_side_data(VAR_0, VAR_1);", "}", "return 0;", "failed_alloc:\nav_packet_unref(VAR_0);", "return AVERROR(ENOMEM);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 45 ], [ 47 ] ]
12,283
static void ffm_seek1(AVFormatContext *s, int64_t pos1) { FFMContext *ffm = s->priv_data; AVIOContext *pb = s->pb; int64_t pos; pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE); pos = FFMAX(pos, FFM_PACKET_SIZE); av_dlog(s, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos); avio_seek(pb, pos, SEEK_SET); }
true
FFmpeg
928cfc7e4f42aa283bb1bd9a50f0b3caa5a0f7a5
static void ffm_seek1(AVFormatContext *s, int64_t pos1) { FFMContext *ffm = s->priv_data; AVIOContext *pb = s->pb; int64_t pos; pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE); pos = FFMAX(pos, FFM_PACKET_SIZE); av_dlog(s, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos); avio_seek(pb, pos, SEEK_SET); }
{ "code": [ "static void ffm_seek1(AVFormatContext *s, int64_t pos1)", " avio_seek(pb, pos, SEEK_SET);" ], "line_no": [ 1, 19 ] }
static void FUNC_0(AVFormatContext *VAR_0, int64_t VAR_1) { FFMContext *ffm = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int64_t pos; pos = FFMIN(VAR_1, ffm->file_size - FFM_PACKET_SIZE); pos = FFMAX(pos, FFM_PACKET_SIZE); av_dlog(VAR_0, "seek to %"PRIx64" -> %"PRIx64"\n", VAR_1, pos); avio_seek(pb, pos, SEEK_SET); }
[ "static void FUNC_0(AVFormatContext *VAR_0, int64_t VAR_1)\n{", "FFMContext *ffm = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int64_t pos;", "pos = FFMIN(VAR_1, ffm->file_size - FFM_PACKET_SIZE);", "pos = FFMAX(pos, FFM_PACKET_SIZE);", "av_dlog(VAR_0, \"seek to %\"PRIx64\" -> %\"PRIx64\"\\n\", VAR_1, pos);", "avio_seek(pb, pos, SEEK_SET);", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
12,284
int ff_h264_decode_ref_pic_list_reordering(H264Context *h, H264SliceContext *sl) { int list, index, pic_structure; print_short_term(h); print_long_term(h); h264_initialise_ref_list(h, sl); for (list = 0; list < sl->list_count; list++) { if (get_bits1(&sl->gb)) { // ref_pic_list_modification_flag_l[01] int pred = h->curr_pic_num; for (index = 0; ; index++) { unsigned int modification_of_pic_nums_idc = get_ue_golomb_31(&sl->gb); unsigned int pic_id; int i; H264Picture *ref = NULL; if (modification_of_pic_nums_idc == 3) break; if (index >= sl->ref_count[list]) { av_log(h->avctx, AV_LOG_ERROR, "reference count overflow\n"); return -1; } switch (modification_of_pic_nums_idc) { case 0: case 1: { const unsigned int abs_diff_pic_num = get_ue_golomb(&sl->gb) + 1; int frame_num; if (abs_diff_pic_num > h->max_pic_num) { av_log(h->avctx, AV_LOG_ERROR, "abs_diff_pic_num overflow\n"); return AVERROR_INVALIDDATA; } if (modification_of_pic_nums_idc == 0) pred -= abs_diff_pic_num; else pred += abs_diff_pic_num; pred &= h->max_pic_num - 1; frame_num = pic_num_extract(h, pred, &pic_structure); for (i = h->short_ref_count - 1; i >= 0; i--) { ref = h->short_ref[i]; assert(ref->reference); assert(!ref->long_ref); if (ref->frame_num == frame_num && (ref->reference & pic_structure)) break; } if (i >= 0) ref->pic_id = pred; break; } case 2: { int long_idx; pic_id = get_ue_golomb(&sl->gb); // long_term_pic_idx long_idx = pic_num_extract(h, pic_id, &pic_structure); if (long_idx > 31) { av_log(h->avctx, AV_LOG_ERROR, "long_term_pic_idx overflow\n"); return AVERROR_INVALIDDATA; } ref = h->long_ref[long_idx]; assert(!(ref && !ref->reference)); if (ref && (ref->reference & pic_structure) && !mismatches_ref(h, ref)) { ref->pic_id = pic_id; assert(ref->long_ref); i = 0; } else { i = -1; } break; } default: av_log(h->avctx, AV_LOG_ERROR, "illegal modification_of_pic_nums_idc %u\n", modification_of_pic_nums_idc); return AVERROR_INVALIDDATA; } if (i < 0) { av_log(h->avctx, AV_LOG_ERROR, "reference picture missing during reorder\n"); memset(&sl->ref_list[list][index], 0, sizeof(sl->ref_list[0][0])); // FIXME } else { for (i = index; i + 1 < sl->ref_count[list]; i++) { if (sl->ref_list[list][i].parent && ref->long_ref == sl->ref_list[list][i].parent->long_ref && ref->pic_id == sl->ref_list[list][i].pic_id) break; } for (; i > index; i--) { sl->ref_list[list][i] = sl->ref_list[list][i - 1]; } ref_from_h264pic(&sl->ref_list[list][index], ref); if (FIELD_PICTURE(h)) { pic_as_field(&sl->ref_list[list][index], pic_structure); } } } } } for (list = 0; list < sl->list_count; list++) { for (index = 0; index < sl->ref_count[list]; index++) { if ( !sl->ref_list[list][index].parent || (!FIELD_PICTURE(h) && (sl->ref_list[list][index].reference&3) != 3)) { int i; av_log(h->avctx, AV_LOG_ERROR, "Missing reference picture\n"); for (i = 0; i < FF_ARRAY_ELEMS(h->last_pocs); i++) h->last_pocs[i] = INT_MIN; return -1; } av_assert0(av_buffer_get_ref_count(sl->ref_list[list][index].parent->f->buf[0]) > 0); } } return 0; }
true
FFmpeg
b92b4775a0d07cacfdd2b4be6511f3cb362c977b
int ff_h264_decode_ref_pic_list_reordering(H264Context *h, H264SliceContext *sl) { int list, index, pic_structure; print_short_term(h); print_long_term(h); h264_initialise_ref_list(h, sl); for (list = 0; list < sl->list_count; list++) { if (get_bits1(&sl->gb)) { int pred = h->curr_pic_num; for (index = 0; ; index++) { unsigned int modification_of_pic_nums_idc = get_ue_golomb_31(&sl->gb); unsigned int pic_id; int i; H264Picture *ref = NULL; if (modification_of_pic_nums_idc == 3) break; if (index >= sl->ref_count[list]) { av_log(h->avctx, AV_LOG_ERROR, "reference count overflow\n"); return -1; } switch (modification_of_pic_nums_idc) { case 0: case 1: { const unsigned int abs_diff_pic_num = get_ue_golomb(&sl->gb) + 1; int frame_num; if (abs_diff_pic_num > h->max_pic_num) { av_log(h->avctx, AV_LOG_ERROR, "abs_diff_pic_num overflow\n"); return AVERROR_INVALIDDATA; } if (modification_of_pic_nums_idc == 0) pred -= abs_diff_pic_num; else pred += abs_diff_pic_num; pred &= h->max_pic_num - 1; frame_num = pic_num_extract(h, pred, &pic_structure); for (i = h->short_ref_count - 1; i >= 0; i--) { ref = h->short_ref[i]; assert(ref->reference); assert(!ref->long_ref); if (ref->frame_num == frame_num && (ref->reference & pic_structure)) break; } if (i >= 0) ref->pic_id = pred; break; } case 2: { int long_idx; pic_id = get_ue_golomb(&sl->gb); long_idx = pic_num_extract(h, pic_id, &pic_structure); if (long_idx > 31) { av_log(h->avctx, AV_LOG_ERROR, "long_term_pic_idx overflow\n"); return AVERROR_INVALIDDATA; } ref = h->long_ref[long_idx]; assert(!(ref && !ref->reference)); if (ref && (ref->reference & pic_structure) && !mismatches_ref(h, ref)) { ref->pic_id = pic_id; assert(ref->long_ref); i = 0; } else { i = -1; } break; } default: av_log(h->avctx, AV_LOG_ERROR, "illegal modification_of_pic_nums_idc %u\n", modification_of_pic_nums_idc); return AVERROR_INVALIDDATA; } if (i < 0) { av_log(h->avctx, AV_LOG_ERROR, "reference picture missing during reorder\n"); memset(&sl->ref_list[list][index], 0, sizeof(sl->ref_list[0][0])); } else { for (i = index; i + 1 < sl->ref_count[list]; i++) { if (sl->ref_list[list][i].parent && ref->long_ref == sl->ref_list[list][i].parent->long_ref && ref->pic_id == sl->ref_list[list][i].pic_id) break; } for (; i > index; i--) { sl->ref_list[list][i] = sl->ref_list[list][i - 1]; } ref_from_h264pic(&sl->ref_list[list][index], ref); if (FIELD_PICTURE(h)) { pic_as_field(&sl->ref_list[list][index], pic_structure); } } } } } for (list = 0; list < sl->list_count; list++) { for (index = 0; index < sl->ref_count[list]; index++) { if ( !sl->ref_list[list][index].parent || (!FIELD_PICTURE(h) && (sl->ref_list[list][index].reference&3) != 3)) { int i; av_log(h->avctx, AV_LOG_ERROR, "Missing reference picture\n"); for (i = 0; i < FF_ARRAY_ELEMS(h->last_pocs); i++) h->last_pocs[i] = INT_MIN; return -1; } av_assert0(av_buffer_get_ref_count(sl->ref_list[list][index].parent->f->buf[0]) > 0); } } return 0; }
{ "code": [ " if (long_idx > 31) {" ], "line_no": [ 131 ] }
int FUNC_0(H264Context *VAR_0, H264SliceContext *VAR_1) { int VAR_2, VAR_3, VAR_4; print_short_term(VAR_0); print_long_term(VAR_0); h264_initialise_ref_list(VAR_0, VAR_1); for (VAR_2 = 0; VAR_2 < VAR_1->list_count; VAR_2++) { if (get_bits1(&VAR_1->gb)) { int pred = VAR_0->curr_pic_num; for (VAR_3 = 0; ; VAR_3++) { unsigned int modification_of_pic_nums_idc = get_ue_golomb_31(&VAR_1->gb); unsigned int pic_id; int i; H264Picture *ref = NULL; if (modification_of_pic_nums_idc == 3) break; if (VAR_3 >= VAR_1->ref_count[VAR_2]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "reference count overflow\n"); return -1; } switch (modification_of_pic_nums_idc) { case 0: case 1: { const unsigned int abs_diff_pic_num = get_ue_golomb(&VAR_1->gb) + 1; int frame_num; if (abs_diff_pic_num > VAR_0->max_pic_num) { av_log(VAR_0->avctx, AV_LOG_ERROR, "abs_diff_pic_num overflow\n"); return AVERROR_INVALIDDATA; } if (modification_of_pic_nums_idc == 0) pred -= abs_diff_pic_num; else pred += abs_diff_pic_num; pred &= VAR_0->max_pic_num - 1; frame_num = pic_num_extract(VAR_0, pred, &VAR_4); for (i = VAR_0->short_ref_count - 1; i >= 0; i--) { ref = VAR_0->short_ref[i]; assert(ref->reference); assert(!ref->long_ref); if (ref->frame_num == frame_num && (ref->reference & VAR_4)) break; } if (i >= 0) ref->pic_id = pred; break; } case 2: { int long_idx; pic_id = get_ue_golomb(&VAR_1->gb); long_idx = pic_num_extract(VAR_0, pic_id, &VAR_4); if (long_idx > 31) { av_log(VAR_0->avctx, AV_LOG_ERROR, "long_term_pic_idx overflow\n"); return AVERROR_INVALIDDATA; } ref = VAR_0->long_ref[long_idx]; assert(!(ref && !ref->reference)); if (ref && (ref->reference & VAR_4) && !mismatches_ref(VAR_0, ref)) { ref->pic_id = pic_id; assert(ref->long_ref); i = 0; } else { i = -1; } break; } default: av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal modification_of_pic_nums_idc %u\n", modification_of_pic_nums_idc); return AVERROR_INVALIDDATA; } if (i < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "reference picture missing during reorder\n"); memset(&VAR_1->ref_list[VAR_2][VAR_3], 0, sizeof(VAR_1->ref_list[0][0])); } else { for (i = VAR_3; i + 1 < VAR_1->ref_count[VAR_2]; i++) { if (VAR_1->ref_list[VAR_2][i].parent && ref->long_ref == VAR_1->ref_list[VAR_2][i].parent->long_ref && ref->pic_id == VAR_1->ref_list[VAR_2][i].pic_id) break; } for (; i > VAR_3; i--) { VAR_1->ref_list[VAR_2][i] = VAR_1->ref_list[VAR_2][i - 1]; } ref_from_h264pic(&VAR_1->ref_list[VAR_2][VAR_3], ref); if (FIELD_PICTURE(VAR_0)) { pic_as_field(&VAR_1->ref_list[VAR_2][VAR_3], VAR_4); } } } } } for (VAR_2 = 0; VAR_2 < VAR_1->list_count; VAR_2++) { for (VAR_3 = 0; VAR_3 < VAR_1->ref_count[VAR_2]; VAR_3++) { if ( !VAR_1->ref_list[VAR_2][VAR_3].parent || (!FIELD_PICTURE(VAR_0) && (VAR_1->ref_list[VAR_2][VAR_3].reference&3) != 3)) { int i; av_log(VAR_0->avctx, AV_LOG_ERROR, "Missing reference picture\n"); for (i = 0; i < FF_ARRAY_ELEMS(VAR_0->last_pocs); i++) VAR_0->last_pocs[i] = INT_MIN; return -1; } av_assert0(av_buffer_get_ref_count(VAR_1->ref_list[VAR_2][VAR_3].parent->f->buf[0]) > 0); } } return 0; }
[ "int FUNC_0(H264Context *VAR_0, H264SliceContext *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "print_short_term(VAR_0);", "print_long_term(VAR_0);", "h264_initialise_ref_list(VAR_0, VAR_1);", "for (VAR_2 = 0; VAR_2 < VAR_1->list_count; VAR_2++) {", "if (get_bits1(&VAR_1->gb)) {", "int pred = VAR_0->curr_pic_num;", "for (VAR_3 = 0; ; VAR_3++) {", "unsigned int modification_of_pic_nums_idc = get_ue_golomb_31(&VAR_1->gb);", "unsigned int pic_id;", "int i;", "H264Picture *ref = NULL;", "if (modification_of_pic_nums_idc == 3)\nbreak;", "if (VAR_3 >= VAR_1->ref_count[VAR_2]) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"reference count overflow\\n\");", "return -1;", "}", "switch (modification_of_pic_nums_idc) {", "case 0:\ncase 1: {", "const unsigned int abs_diff_pic_num = get_ue_golomb(&VAR_1->gb) + 1;", "int frame_num;", "if (abs_diff_pic_num > VAR_0->max_pic_num) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"abs_diff_pic_num overflow\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (modification_of_pic_nums_idc == 0)\npred -= abs_diff_pic_num;", "else\npred += abs_diff_pic_num;", "pred &= VAR_0->max_pic_num - 1;", "frame_num = pic_num_extract(VAR_0, pred, &VAR_4);", "for (i = VAR_0->short_ref_count - 1; i >= 0; i--) {", "ref = VAR_0->short_ref[i];", "assert(ref->reference);", "assert(!ref->long_ref);", "if (ref->frame_num == frame_num &&\n(ref->reference & VAR_4))\nbreak;", "}", "if (i >= 0)\nref->pic_id = pred;", "break;", "}", "case 2: {", "int long_idx;", "pic_id = get_ue_golomb(&VAR_1->gb);", "long_idx = pic_num_extract(VAR_0, pic_id, &VAR_4);", "if (long_idx > 31) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"long_term_pic_idx overflow\\n\");", "return AVERROR_INVALIDDATA;", "}", "ref = VAR_0->long_ref[long_idx];", "assert(!(ref && !ref->reference));", "if (ref && (ref->reference & VAR_4) && !mismatches_ref(VAR_0, ref)) {", "ref->pic_id = pic_id;", "assert(ref->long_ref);", "i = 0;", "} else {", "i = -1;", "}", "break;", "}", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR,\n\"illegal modification_of_pic_nums_idc %u\\n\",\nmodification_of_pic_nums_idc);", "return AVERROR_INVALIDDATA;", "}", "if (i < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR,\n\"reference picture missing during reorder\\n\");", "memset(&VAR_1->ref_list[VAR_2][VAR_3], 0, sizeof(VAR_1->ref_list[0][0]));", "} else {", "for (i = VAR_3; i + 1 < VAR_1->ref_count[VAR_2]; i++) {", "if (VAR_1->ref_list[VAR_2][i].parent &&\nref->long_ref == VAR_1->ref_list[VAR_2][i].parent->long_ref &&\nref->pic_id == VAR_1->ref_list[VAR_2][i].pic_id)\nbreak;", "}", "for (; i > VAR_3; i--) {", "VAR_1->ref_list[VAR_2][i] = VAR_1->ref_list[VAR_2][i - 1];", "}", "ref_from_h264pic(&VAR_1->ref_list[VAR_2][VAR_3], ref);", "if (FIELD_PICTURE(VAR_0)) {", "pic_as_field(&VAR_1->ref_list[VAR_2][VAR_3], VAR_4);", "}", "}", "}", "}", "}", "for (VAR_2 = 0; VAR_2 < VAR_1->list_count; VAR_2++) {", "for (VAR_3 = 0; VAR_3 < VAR_1->ref_count[VAR_2]; VAR_3++) {", "if ( !VAR_1->ref_list[VAR_2][VAR_3].parent\n|| (!FIELD_PICTURE(VAR_0) && (VAR_1->ref_list[VAR_2][VAR_3].reference&3) != 3)) {", "int i;", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Missing reference picture\\n\");", "for (i = 0; i < FF_ARRAY_ELEMS(VAR_0->last_pocs); i++)", "VAR_0->last_pocs[i] = INT_MIN;", "return -1;", "}", "av_assert0(av_buffer_get_ref_count(VAR_1->ref_list[VAR_2][VAR_3].parent->f->buf[0]) > 0);", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83, 85 ], [ 87 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105, 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163, 165, 167, 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189, 191, 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249 ], [ 251 ] ]
12,285
static inline void dxt5_block_internal(uint8_t *dst, ptrdiff_t stride, const uint8_t *block) { int x, y; uint32_t colors[4]; uint8_t alpha_indices[16]; uint16_t color0 = AV_RL16(block + 8); uint16_t color1 = AV_RL16(block + 10); uint32_t code = AV_RL32(block + 12); uint8_t alpha0 = *(block); uint8_t alpha1 = *(block + 1); decompress_indices(alpha_indices, block + 2); extract_color(colors, color0, color1, 1, 0); for (y = 0; y < 4; y++) { for (x = 0; x < 4; x++) { int alpha_code = alpha_indices[x + y * 4]; uint32_t pixel; uint8_t alpha; if (alpha_code == 0) { alpha = alpha0; } else if (alpha_code == 1) { alpha = alpha1; } else { if (alpha0 > alpha1) { alpha = (uint8_t) (((8 - alpha_code) * alpha0 + (alpha_code - 1) * alpha1) / 7); } else { if (alpha_code == 6) { alpha = 0; } else if (alpha_code == 7) { alpha = 255; } else { alpha = (uint8_t) (((6 - alpha_code) * alpha0 + (alpha_code - 1) * alpha1) / 5); } } } pixel = colors[code & 3] | (alpha << 24); code >>= 2; AV_WL32(dst + x * 4, pixel); } dst += stride; } }
true
FFmpeg
2bd8eb05d21b582d627a93852b59cb3cfc305dae
static inline void dxt5_block_internal(uint8_t *dst, ptrdiff_t stride, const uint8_t *block) { int x, y; uint32_t colors[4]; uint8_t alpha_indices[16]; uint16_t color0 = AV_RL16(block + 8); uint16_t color1 = AV_RL16(block + 10); uint32_t code = AV_RL32(block + 12); uint8_t alpha0 = *(block); uint8_t alpha1 = *(block + 1); decompress_indices(alpha_indices, block + 2); extract_color(colors, color0, color1, 1, 0); for (y = 0; y < 4; y++) { for (x = 0; x < 4; x++) { int alpha_code = alpha_indices[x + y * 4]; uint32_t pixel; uint8_t alpha; if (alpha_code == 0) { alpha = alpha0; } else if (alpha_code == 1) { alpha = alpha1; } else { if (alpha0 > alpha1) { alpha = (uint8_t) (((8 - alpha_code) * alpha0 + (alpha_code - 1) * alpha1) / 7); } else { if (alpha_code == 6) { alpha = 0; } else if (alpha_code == 7) { alpha = 255; } else { alpha = (uint8_t) (((6 - alpha_code) * alpha0 + (alpha_code - 1) * alpha1) / 5); } } } pixel = colors[code & 3] | (alpha << 24); code >>= 2; AV_WL32(dst + x * 4, pixel); } dst += stride; } }
{ "code": [ " pixel = colors[code & 3] | (alpha << 24);" ], "line_no": [ 83 ] }
static inline void FUNC_0(uint8_t *VAR_0, ptrdiff_t VAR_1, const uint8_t *VAR_2) { int VAR_3, VAR_4; uint32_t colors[4]; uint8_t alpha_indices[16]; uint16_t color0 = AV_RL16(VAR_2 + 8); uint16_t color1 = AV_RL16(VAR_2 + 10); uint32_t code = AV_RL32(VAR_2 + 12); uint8_t alpha0 = *(VAR_2); uint8_t alpha1 = *(VAR_2 + 1); decompress_indices(alpha_indices, VAR_2 + 2); extract_color(colors, color0, color1, 1, 0); for (VAR_4 = 0; VAR_4 < 4; VAR_4++) { for (VAR_3 = 0; VAR_3 < 4; VAR_3++) { int VAR_5 = alpha_indices[VAR_3 + VAR_4 * 4]; uint32_t pixel; uint8_t alpha; if (VAR_5 == 0) { alpha = alpha0; } else if (VAR_5 == 1) { alpha = alpha1; } else { if (alpha0 > alpha1) { alpha = (uint8_t) (((8 - VAR_5) * alpha0 + (VAR_5 - 1) * alpha1) / 7); } else { if (VAR_5 == 6) { alpha = 0; } else if (VAR_5 == 7) { alpha = 255; } else { alpha = (uint8_t) (((6 - VAR_5) * alpha0 + (VAR_5 - 1) * alpha1) / 5); } } } pixel = colors[code & 3] | (alpha << 24); code >>= 2; AV_WL32(VAR_0 + VAR_3 * 4, pixel); } VAR_0 += VAR_1; } }
[ "static inline void FUNC_0(uint8_t *VAR_0, ptrdiff_t VAR_1,\nconst uint8_t *VAR_2)\n{", "int VAR_3, VAR_4;", "uint32_t colors[4];", "uint8_t alpha_indices[16];", "uint16_t color0 = AV_RL16(VAR_2 + 8);", "uint16_t color1 = AV_RL16(VAR_2 + 10);", "uint32_t code = AV_RL32(VAR_2 + 12);", "uint8_t alpha0 = *(VAR_2);", "uint8_t alpha1 = *(VAR_2 + 1);", "decompress_indices(alpha_indices, VAR_2 + 2);", "extract_color(colors, color0, color1, 1, 0);", "for (VAR_4 = 0; VAR_4 < 4; VAR_4++) {", "for (VAR_3 = 0; VAR_3 < 4; VAR_3++) {", "int VAR_5 = alpha_indices[VAR_3 + VAR_4 * 4];", "uint32_t pixel;", "uint8_t alpha;", "if (VAR_5 == 0) {", "alpha = alpha0;", "} else if (VAR_5 == 1) {", "alpha = alpha1;", "} else {", "if (alpha0 > alpha1) {", "alpha = (uint8_t) (((8 - VAR_5) * alpha0 +\n(VAR_5 - 1) * alpha1) / 7);", "} else {", "if (VAR_5 == 6) {", "alpha = 0;", "} else if (VAR_5 == 7) {", "alpha = 255;", "} else {", "alpha = (uint8_t) (((6 - VAR_5) * alpha0 +\n(VAR_5 - 1) * alpha1) / 5);", "}", "}", "}", "pixel = colors[code & 3] | (alpha << 24);", "code >>= 2;", "AV_WL32(VAR_0 + VAR_3 * 4, pixel);", "}", "VAR_0 += VAR_1;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ] ]
12,286
void OPPROTO op_POWER_sre (void) { T1 &= 0x1FUL; env->spr[SPR_MQ] = rotl32(T0, 32 - T1); T0 = Ts0 >> T1; RETURN(); }
true
qemu
d9bce9d99f4656ae0b0127f7472db9067b8f84ab
void OPPROTO op_POWER_sre (void) { T1 &= 0x1FUL; env->spr[SPR_MQ] = rotl32(T0, 32 - T1); T0 = Ts0 >> T1; RETURN(); }
{ "code": [ " RETURN();", " T0 = Ts0 >> T1;", " T0 = Ts0 >> T1;", " RETURN();" ], "line_no": [ 11, 9, 9, 11 ] }
void VAR_0 op_POWER_sre (void) { T1 &= 0x1FUL; env->spr[SPR_MQ] = rotl32(T0, 32 - T1); T0 = Ts0 >> T1; RETURN(); }
[ "void VAR_0 op_POWER_sre (void)\n{", "T1 &= 0x1FUL;", "env->spr[SPR_MQ] = rotl32(T0, 32 - T1);", "T0 = Ts0 >> T1;", "RETURN();", "}" ]
[ 0, 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
12,287
static int h263_decode_block(MpegEncContext * s, int16_t * block, int n, int coded) { int level, i, j, run; RLTable *rl = &ff_h263_rl_inter; const uint8_t *scan_table; GetBitContext gb= s->gb; scan_table = s->intra_scantable.permutated; if (s->h263_aic && s->mb_intra) { rl = &ff_rl_intra_aic; i = 0; if (s->ac_pred) { if (s->h263_aic_dir) scan_table = s->intra_v_scantable.permutated; /* left */ else scan_table = s->intra_h_scantable.permutated; /* top */ } } else if (s->mb_intra) { /* DC coef */ if (CONFIG_RV10_DECODER && s->codec_id == AV_CODEC_ID_RV10) { if (s->rv10_version == 3 && s->pict_type == AV_PICTURE_TYPE_I) { int component, diff; component = (n <= 3 ? 0 : n - 4 + 1); level = s->last_dc[component]; if (s->rv10_first_dc_coded[component]) { diff = ff_rv_decode_dc(s, n); if (diff == 0xffff) return -1; level += diff; level = level & 0xff; /* handle wrap round */ s->last_dc[component] = level; } else { s->rv10_first_dc_coded[component] = 1; } } else { level = get_bits(&s->gb, 8); if (level == 255) level = 128; } }else{ level = get_bits(&s->gb, 8); if((level&0x7F) == 0){ av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y); if (s->avctx->err_recognition & (AV_EF_BITSTREAM|AV_EF_COMPLIANT)) return -1; } if (level == 255) level = 128; } block[0] = level; i = 1; } else { i = 0; } if (!coded) { if (s->mb_intra && s->h263_aic) goto not_coded; s->block_last_index[n] = i - 1; return 0; } retry: { OPEN_READER(re, &s->gb); i--; // offset by -1 to allow direct indexing of scan_table for(;;) { UPDATE_CACHE(re, &s->gb); GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (run == 66) { if (level){ CLOSE_READER(re, &s->gb); av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y); return -1; } /* escape */ if (CONFIG_FLV_DECODER && s->h263_flv > 1) { int is11 = SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1); run = SHOW_UBITS(re, &s->gb, 7) + 1; if (is11) { SKIP_COUNTER(re, &s->gb, 1 + 7); UPDATE_CACHE(re, &s->gb); level = SHOW_SBITS(re, &s->gb, 11); SKIP_COUNTER(re, &s->gb, 11); } else { SKIP_CACHE(re, &s->gb, 7); level = SHOW_SBITS(re, &s->gb, 7); SKIP_COUNTER(re, &s->gb, 1 + 7 + 7); } } else { run = SHOW_UBITS(re, &s->gb, 7) + 1; SKIP_CACHE(re, &s->gb, 7); level = (int8_t)SHOW_UBITS(re, &s->gb, 8); SKIP_COUNTER(re, &s->gb, 7 + 8); if(level == -128){ UPDATE_CACHE(re, &s->gb); if (s->codec_id == AV_CODEC_ID_RV10) { /* XXX: should patch encoder too */ level = SHOW_SBITS(re, &s->gb, 12); SKIP_COUNTER(re, &s->gb, 12); }else{ level = SHOW_UBITS(re, &s->gb, 5); SKIP_CACHE(re, &s->gb, 5); level |= SHOW_SBITS(re, &s->gb, 6)<<5; SKIP_COUNTER(re, &s->gb, 5 + 6); } } } } else { if (SHOW_UBITS(re, &s->gb, 1)) level = -level; SKIP_COUNTER(re, &s->gb, 1); } i += run; if (i >= 64){ CLOSE_READER(re, &s->gb); // redo update without last flag, revert -1 offset i = i - run + ((run-1)&63) + 1; if (i < 64) { // only last marker, no overrun block[scan_table[i]] = level; break; } if(s->alt_inter_vlc && rl == &ff_h263_rl_inter && !s->mb_intra){ //Looks like a hack but no, it's the way it is supposed to work ... rl = &ff_rl_intra_aic; i = 0; s->gb= gb; s->bdsp.clear_block(block); goto retry; } av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d i:%d\n", s->mb_x, s->mb_y, s->mb_intra); return -1; } j = scan_table[i]; block[j] = level; } } not_coded: if (s->mb_intra && s->h263_aic) { ff_h263_pred_acdc(s, block, n); i = 63; } s->block_last_index[n] = i; return 0; }
true
FFmpeg
631f7484918a9e7260377c3cea878be708609e64
static int h263_decode_block(MpegEncContext * s, int16_t * block, int n, int coded) { int level, i, j, run; RLTable *rl = &ff_h263_rl_inter; const uint8_t *scan_table; GetBitContext gb= s->gb; scan_table = s->intra_scantable.permutated; if (s->h263_aic && s->mb_intra) { rl = &ff_rl_intra_aic; i = 0; if (s->ac_pred) { if (s->h263_aic_dir) scan_table = s->intra_v_scantable.permutated; else scan_table = s->intra_h_scantable.permutated; } } else if (s->mb_intra) { if (CONFIG_RV10_DECODER && s->codec_id == AV_CODEC_ID_RV10) { if (s->rv10_version == 3 && s->pict_type == AV_PICTURE_TYPE_I) { int component, diff; component = (n <= 3 ? 0 : n - 4 + 1); level = s->last_dc[component]; if (s->rv10_first_dc_coded[component]) { diff = ff_rv_decode_dc(s, n); if (diff == 0xffff) return -1; level += diff; level = level & 0xff; s->last_dc[component] = level; } else { s->rv10_first_dc_coded[component] = 1; } } else { level = get_bits(&s->gb, 8); if (level == 255) level = 128; } }else{ level = get_bits(&s->gb, 8); if((level&0x7F) == 0){ av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", level, s->mb_x, s->mb_y); if (s->avctx->err_recognition & (AV_EF_BITSTREAM|AV_EF_COMPLIANT)) return -1; } if (level == 255) level = 128; } block[0] = level; i = 1; } else { i = 0; } if (!coded) { if (s->mb_intra && s->h263_aic) goto not_coded; s->block_last_index[n] = i - 1; return 0; } retry: { OPEN_READER(re, &s->gb); i--; for(;;) { UPDATE_CACHE(re, &s->gb); GET_RL_VLC(level, run, re, &s->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (run == 66) { if (level){ CLOSE_READER(re, &s->gb); av_log(s->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\n", s->mb_x, s->mb_y); return -1; } if (CONFIG_FLV_DECODER && s->h263_flv > 1) { int is11 = SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1); run = SHOW_UBITS(re, &s->gb, 7) + 1; if (is11) { SKIP_COUNTER(re, &s->gb, 1 + 7); UPDATE_CACHE(re, &s->gb); level = SHOW_SBITS(re, &s->gb, 11); SKIP_COUNTER(re, &s->gb, 11); } else { SKIP_CACHE(re, &s->gb, 7); level = SHOW_SBITS(re, &s->gb, 7); SKIP_COUNTER(re, &s->gb, 1 + 7 + 7); } } else { run = SHOW_UBITS(re, &s->gb, 7) + 1; SKIP_CACHE(re, &s->gb, 7); level = (int8_t)SHOW_UBITS(re, &s->gb, 8); SKIP_COUNTER(re, &s->gb, 7 + 8); if(level == -128){ UPDATE_CACHE(re, &s->gb); if (s->codec_id == AV_CODEC_ID_RV10) { level = SHOW_SBITS(re, &s->gb, 12); SKIP_COUNTER(re, &s->gb, 12); }else{ level = SHOW_UBITS(re, &s->gb, 5); SKIP_CACHE(re, &s->gb, 5); level |= SHOW_SBITS(re, &s->gb, 6)<<5; SKIP_COUNTER(re, &s->gb, 5 + 6); } } } } else { if (SHOW_UBITS(re, &s->gb, 1)) level = -level; SKIP_COUNTER(re, &s->gb, 1); } i += run; if (i >= 64){ CLOSE_READER(re, &s->gb); i = i - run + ((run-1)&63) + 1; if (i < 64) { block[scan_table[i]] = level; break; } if(s->alt_inter_vlc && rl == &ff_h263_rl_inter && !s->mb_intra){ rl = &ff_rl_intra_aic; i = 0; s->gb= gb; s->bdsp.clear_block(block); goto retry; } av_log(s->avctx, AV_LOG_ERROR, "run overflow at %dx%d i:%d\n", s->mb_x, s->mb_y, s->mb_intra); return -1; } j = scan_table[i]; block[j] = level; } } not_coded: if (s->mb_intra && s->h263_aic) { ff_h263_pred_acdc(s, block, n); i = 63; } s->block_last_index[n] = i; return 0; }
{ "code": [ " level |= SHOW_SBITS(re, &s->gb, 6)<<5;" ], "line_no": [ 207 ] }
static int FUNC_0(MpegEncContext * VAR_0, int16_t * VAR_1, int VAR_2, int VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7; RLTable *rl = &ff_h263_rl_inter; const uint8_t *VAR_8; GetBitContext gb= VAR_0->gb; VAR_8 = VAR_0->intra_scantable.permutated; if (VAR_0->h263_aic && VAR_0->mb_intra) { rl = &ff_rl_intra_aic; VAR_5 = 0; if (VAR_0->ac_pred) { if (VAR_0->h263_aic_dir) VAR_8 = VAR_0->intra_v_scantable.permutated; else VAR_8 = VAR_0->intra_h_scantable.permutated; } } else if (VAR_0->mb_intra) { if (CONFIG_RV10_DECODER && VAR_0->codec_id == AV_CODEC_ID_RV10) { if (VAR_0->rv10_version == 3 && VAR_0->pict_type == AV_PICTURE_TYPE_I) { int VAR_9, VAR_10; VAR_9 = (VAR_2 <= 3 ? 0 : VAR_2 - 4 + 1); VAR_4 = VAR_0->last_dc[VAR_9]; if (VAR_0->rv10_first_dc_coded[VAR_9]) { VAR_10 = ff_rv_decode_dc(VAR_0, VAR_2); if (VAR_10 == 0xffff) return -1; VAR_4 += VAR_10; VAR_4 = VAR_4 & 0xff; VAR_0->last_dc[VAR_9] = VAR_4; } else { VAR_0->rv10_first_dc_coded[VAR_9] = 1; } } else { VAR_4 = get_bits(&VAR_0->gb, 8); if (VAR_4 == 255) VAR_4 = 128; } }else{ VAR_4 = get_bits(&VAR_0->gb, 8); if((VAR_4&0x7F) == 0){ av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\VAR_2", VAR_4, VAR_0->mb_x, VAR_0->mb_y); if (VAR_0->avctx->err_recognition & (AV_EF_BITSTREAM|AV_EF_COMPLIANT)) return -1; } if (VAR_4 == 255) VAR_4 = 128; } VAR_1[0] = VAR_4; VAR_5 = 1; } else { VAR_5 = 0; } if (!VAR_3) { if (VAR_0->mb_intra && VAR_0->h263_aic) goto not_coded; VAR_0->block_last_index[VAR_2] = VAR_5 - 1; return 0; } retry: { OPEN_READER(re, &VAR_0->gb); VAR_5--; for(;;) { UPDATE_CACHE(re, &VAR_0->gb); GET_RL_VLC(VAR_4, VAR_7, re, &VAR_0->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0); if (VAR_7 == 66) { if (VAR_4){ CLOSE_READER(re, &VAR_0->gb); av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal ac vlc code at %dx%d\VAR_2", VAR_0->mb_x, VAR_0->mb_y); return -1; } if (CONFIG_FLV_DECODER && VAR_0->h263_flv > 1) { int VAR_11 = SHOW_UBITS(re, &VAR_0->gb, 1); SKIP_CACHE(re, &VAR_0->gb, 1); VAR_7 = SHOW_UBITS(re, &VAR_0->gb, 7) + 1; if (VAR_11) { SKIP_COUNTER(re, &VAR_0->gb, 1 + 7); UPDATE_CACHE(re, &VAR_0->gb); VAR_4 = SHOW_SBITS(re, &VAR_0->gb, 11); SKIP_COUNTER(re, &VAR_0->gb, 11); } else { SKIP_CACHE(re, &VAR_0->gb, 7); VAR_4 = SHOW_SBITS(re, &VAR_0->gb, 7); SKIP_COUNTER(re, &VAR_0->gb, 1 + 7 + 7); } } else { VAR_7 = SHOW_UBITS(re, &VAR_0->gb, 7) + 1; SKIP_CACHE(re, &VAR_0->gb, 7); VAR_4 = (int8_t)SHOW_UBITS(re, &VAR_0->gb, 8); SKIP_COUNTER(re, &VAR_0->gb, 7 + 8); if(VAR_4 == -128){ UPDATE_CACHE(re, &VAR_0->gb); if (VAR_0->codec_id == AV_CODEC_ID_RV10) { VAR_4 = SHOW_SBITS(re, &VAR_0->gb, 12); SKIP_COUNTER(re, &VAR_0->gb, 12); }else{ VAR_4 = SHOW_UBITS(re, &VAR_0->gb, 5); SKIP_CACHE(re, &VAR_0->gb, 5); VAR_4 |= SHOW_SBITS(re, &VAR_0->gb, 6)<<5; SKIP_COUNTER(re, &VAR_0->gb, 5 + 6); } } } } else { if (SHOW_UBITS(re, &VAR_0->gb, 1)) VAR_4 = -VAR_4; SKIP_COUNTER(re, &VAR_0->gb, 1); } VAR_5 += VAR_7; if (VAR_5 >= 64){ CLOSE_READER(re, &VAR_0->gb); VAR_5 = VAR_5 - VAR_7 + ((VAR_7-1)&63) + 1; if (VAR_5 < 64) { VAR_1[VAR_8[VAR_5]] = VAR_4; break; } if(VAR_0->alt_inter_vlc && rl == &ff_h263_rl_inter && !VAR_0->mb_intra){ rl = &ff_rl_intra_aic; VAR_5 = 0; VAR_0->gb= gb; VAR_0->bdsp.clear_block(VAR_1); goto retry; } av_log(VAR_0->avctx, AV_LOG_ERROR, "VAR_7 overflow at %dx%d VAR_5:%d\VAR_2", VAR_0->mb_x, VAR_0->mb_y, VAR_0->mb_intra); return -1; } VAR_6 = VAR_8[VAR_5]; VAR_1[VAR_6] = VAR_4; } } not_coded: if (VAR_0->mb_intra && VAR_0->h263_aic) { ff_h263_pred_acdc(VAR_0, VAR_1, VAR_2); VAR_5 = 63; } VAR_0->block_last_index[VAR_2] = VAR_5; return 0; }
[ "static int FUNC_0(MpegEncContext * VAR_0, int16_t * VAR_1,\nint VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7;", "RLTable *rl = &ff_h263_rl_inter;", "const uint8_t *VAR_8;", "GetBitContext gb= VAR_0->gb;", "VAR_8 = VAR_0->intra_scantable.permutated;", "if (VAR_0->h263_aic && VAR_0->mb_intra) {", "rl = &ff_rl_intra_aic;", "VAR_5 = 0;", "if (VAR_0->ac_pred) {", "if (VAR_0->h263_aic_dir)\nVAR_8 = VAR_0->intra_v_scantable.permutated;", "else\nVAR_8 = VAR_0->intra_h_scantable.permutated;", "}", "} else if (VAR_0->mb_intra) {", "if (CONFIG_RV10_DECODER && VAR_0->codec_id == AV_CODEC_ID_RV10) {", "if (VAR_0->rv10_version == 3 && VAR_0->pict_type == AV_PICTURE_TYPE_I) {", "int VAR_9, VAR_10;", "VAR_9 = (VAR_2 <= 3 ? 0 : VAR_2 - 4 + 1);", "VAR_4 = VAR_0->last_dc[VAR_9];", "if (VAR_0->rv10_first_dc_coded[VAR_9]) {", "VAR_10 = ff_rv_decode_dc(VAR_0, VAR_2);", "if (VAR_10 == 0xffff)\nreturn -1;", "VAR_4 += VAR_10;", "VAR_4 = VAR_4 & 0xff;", "VAR_0->last_dc[VAR_9] = VAR_4;", "} else {", "VAR_0->rv10_first_dc_coded[VAR_9] = 1;", "}", "} else {", "VAR_4 = get_bits(&VAR_0->gb, 8);", "if (VAR_4 == 255)\nVAR_4 = 128;", "}", "}else{", "VAR_4 = get_bits(&VAR_0->gb, 8);", "if((VAR_4&0x7F) == 0){", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal dc %d at %d %d\\VAR_2\", VAR_4, VAR_0->mb_x, VAR_0->mb_y);", "if (VAR_0->avctx->err_recognition & (AV_EF_BITSTREAM|AV_EF_COMPLIANT))\nreturn -1;", "}", "if (VAR_4 == 255)\nVAR_4 = 128;", "}", "VAR_1[0] = VAR_4;", "VAR_5 = 1;", "} else {", "VAR_5 = 0;", "}", "if (!VAR_3) {", "if (VAR_0->mb_intra && VAR_0->h263_aic)\ngoto not_coded;", "VAR_0->block_last_index[VAR_2] = VAR_5 - 1;", "return 0;", "}", "retry:\n{", "OPEN_READER(re, &VAR_0->gb);", "VAR_5--;", "for(;;) {", "UPDATE_CACHE(re, &VAR_0->gb);", "GET_RL_VLC(VAR_4, VAR_7, re, &VAR_0->gb, rl->rl_vlc[0], TEX_VLC_BITS, 2, 0);", "if (VAR_7 == 66) {", "if (VAR_4){", "CLOSE_READER(re, &VAR_0->gb);", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal ac vlc code at %dx%d\\VAR_2\", VAR_0->mb_x, VAR_0->mb_y);", "return -1;", "}", "if (CONFIG_FLV_DECODER && VAR_0->h263_flv > 1) {", "int VAR_11 = SHOW_UBITS(re, &VAR_0->gb, 1);", "SKIP_CACHE(re, &VAR_0->gb, 1);", "VAR_7 = SHOW_UBITS(re, &VAR_0->gb, 7) + 1;", "if (VAR_11) {", "SKIP_COUNTER(re, &VAR_0->gb, 1 + 7);", "UPDATE_CACHE(re, &VAR_0->gb);", "VAR_4 = SHOW_SBITS(re, &VAR_0->gb, 11);", "SKIP_COUNTER(re, &VAR_0->gb, 11);", "} else {", "SKIP_CACHE(re, &VAR_0->gb, 7);", "VAR_4 = SHOW_SBITS(re, &VAR_0->gb, 7);", "SKIP_COUNTER(re, &VAR_0->gb, 1 + 7 + 7);", "}", "} else {", "VAR_7 = SHOW_UBITS(re, &VAR_0->gb, 7) + 1;", "SKIP_CACHE(re, &VAR_0->gb, 7);", "VAR_4 = (int8_t)SHOW_UBITS(re, &VAR_0->gb, 8);", "SKIP_COUNTER(re, &VAR_0->gb, 7 + 8);", "if(VAR_4 == -128){", "UPDATE_CACHE(re, &VAR_0->gb);", "if (VAR_0->codec_id == AV_CODEC_ID_RV10) {", "VAR_4 = SHOW_SBITS(re, &VAR_0->gb, 12);", "SKIP_COUNTER(re, &VAR_0->gb, 12);", "}else{", "VAR_4 = SHOW_UBITS(re, &VAR_0->gb, 5);", "SKIP_CACHE(re, &VAR_0->gb, 5);", "VAR_4 |= SHOW_SBITS(re, &VAR_0->gb, 6)<<5;", "SKIP_COUNTER(re, &VAR_0->gb, 5 + 6);", "}", "}", "}", "} else {", "if (SHOW_UBITS(re, &VAR_0->gb, 1))\nVAR_4 = -VAR_4;", "SKIP_COUNTER(re, &VAR_0->gb, 1);", "}", "VAR_5 += VAR_7;", "if (VAR_5 >= 64){", "CLOSE_READER(re, &VAR_0->gb);", "VAR_5 = VAR_5 - VAR_7 + ((VAR_7-1)&63) + 1;", "if (VAR_5 < 64) {", "VAR_1[VAR_8[VAR_5]] = VAR_4;", "break;", "}", "if(VAR_0->alt_inter_vlc && rl == &ff_h263_rl_inter && !VAR_0->mb_intra){", "rl = &ff_rl_intra_aic;", "VAR_5 = 0;", "VAR_0->gb= gb;", "VAR_0->bdsp.clear_block(VAR_1);", "goto retry;", "}", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"VAR_7 overflow at %dx%d VAR_5:%d\\VAR_2\", VAR_0->mb_x, VAR_0->mb_y, VAR_0->mb_intra);", "return -1;", "}", "VAR_6 = VAR_8[VAR_5];", "VAR_1[VAR_6] = VAR_4;", "}", "}", "not_coded:\nif (VAR_0->mb_intra && VAR_0->h263_aic) {", "ff_h263_pred_acdc(VAR_0, VAR_1, VAR_2);", "VAR_5 = 63;", "}", "VAR_0->block_last_index[VAR_2] = VAR_5;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 235 ], [ 237 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277, 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ] ]
12,288
void bdrv_op_block(BlockDriverState *bs, BlockOpType op, Error *reason) { BdrvOpBlocker *blocker; assert((int) op >= 0 && op < BLOCK_OP_TYPE_MAX); blocker = g_malloc0(sizeof(BdrvOpBlocker)); blocker->reason = reason; QLIST_INSERT_HEAD(&bs->op_blockers[op], blocker, list); }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
void bdrv_op_block(BlockDriverState *bs, BlockOpType op, Error *reason) { BdrvOpBlocker *blocker; assert((int) op >= 0 && op < BLOCK_OP_TYPE_MAX); blocker = g_malloc0(sizeof(BdrvOpBlocker)); blocker->reason = reason; QLIST_INSERT_HEAD(&bs->op_blockers[op], blocker, list); }
{ "code": [ " blocker = g_malloc0(sizeof(BdrvOpBlocker));" ], "line_no": [ 11 ] }
void FUNC_0(BlockDriverState *VAR_0, BlockOpType VAR_1, Error *VAR_2) { BdrvOpBlocker *blocker; assert((int) VAR_1 >= 0 && VAR_1 < BLOCK_OP_TYPE_MAX); blocker = g_malloc0(sizeof(BdrvOpBlocker)); blocker->VAR_2 = VAR_2; QLIST_INSERT_HEAD(&VAR_0->op_blockers[VAR_1], blocker, list); }
[ "void FUNC_0(BlockDriverState *VAR_0, BlockOpType VAR_1, Error *VAR_2)\n{", "BdrvOpBlocker *blocker;", "assert((int) VAR_1 >= 0 && VAR_1 < BLOCK_OP_TYPE_MAX);", "blocker = g_malloc0(sizeof(BdrvOpBlocker));", "blocker->VAR_2 = VAR_2;", "QLIST_INSERT_HEAD(&VAR_0->op_blockers[VAR_1], blocker, list);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
12,289
TraceEvent *trace_event_iter_next(TraceEventIter *iter) { while (iter->event < TRACE_EVENT_COUNT) { TraceEvent *ev = &(trace_events[iter->event]); iter->event++; if (!iter->pattern || pattern_glob(iter->pattern, trace_event_get_name(ev))) { return ev; } } return NULL; }
true
qemu
79218be42b835cbc7bd1b0fbd07d115add6e7605
TraceEvent *trace_event_iter_next(TraceEventIter *iter) { while (iter->event < TRACE_EVENT_COUNT) { TraceEvent *ev = &(trace_events[iter->event]); iter->event++; if (!iter->pattern || pattern_glob(iter->pattern, trace_event_get_name(ev))) { return ev; } } return NULL; }
{ "code": [ " TraceEvent *ev = &(trace_events[iter->event]);" ], "line_no": [ 7 ] }
TraceEvent *FUNC_0(TraceEventIter *iter) { while (iter->event < TRACE_EVENT_COUNT) { TraceEvent *ev = &(trace_events[iter->event]); iter->event++; if (!iter->pattern || pattern_glob(iter->pattern, trace_event_get_name(ev))) { return ev; } } return NULL; }
[ "TraceEvent *FUNC_0(TraceEventIter *iter)\n{", "while (iter->event < TRACE_EVENT_COUNT) {", "TraceEvent *ev = &(trace_events[iter->event]);", "iter->event++;", "if (!iter->pattern ||\npattern_glob(iter->pattern,\ntrace_event_get_name(ev))) {", "return ev;", "}", "}", "return NULL;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11, 13, 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ] ]
12,290
static av_cold int ape_decode_init(AVCodecContext *avctx) { APEContext *s = avctx->priv_data; int i; if (avctx->extradata_size != 6) { av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n"); return AVERROR(EINVAL); } if (avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "Only mono and stereo is supported\n"); return AVERROR(EINVAL); } s->bps = avctx->bits_per_coded_sample; switch (s->bps) { case 8: avctx->sample_fmt = AV_SAMPLE_FMT_U8; break; case 16: avctx->sample_fmt = AV_SAMPLE_FMT_S16; break; case 24: avctx->sample_fmt = AV_SAMPLE_FMT_S32; break; default: av_log_ask_for_sample(avctx, "Unsupported bits per coded sample %d\n", s->bps); return AVERROR_PATCHWELCOME; } s->avctx = avctx; s->channels = avctx->channels; s->fileversion = AV_RL16(avctx->extradata); s->compression_level = AV_RL16(avctx->extradata + 2); s->flags = AV_RL16(avctx->extradata + 4); av_log(avctx, AV_LOG_DEBUG, "Compression Level: %d - Flags: %d\n", s->compression_level, s->flags); if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE) { av_log(avctx, AV_LOG_ERROR, "Incorrect compression level %d\n", s->compression_level); return AVERROR_INVALIDDATA; } s->fset = s->compression_level / 1000 - 1; for (i = 0; i < APE_FILTER_LEVELS; i++) { if (!ape_filter_orders[s->fset][i]) break; FF_ALLOC_OR_GOTO(avctx, s->filterbuf[i], (ape_filter_orders[s->fset][i] * 3 + HISTORY_SIZE) * 4, filter_alloc_fail); } ff_dsputil_init(&s->dsp, avctx); avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; return 0; filter_alloc_fail: ape_decode_close(avctx); return AVERROR(ENOMEM); }
true
FFmpeg
8db2935db0caa8efbef009994920ef6a20289496
static av_cold int ape_decode_init(AVCodecContext *avctx) { APEContext *s = avctx->priv_data; int i; if (avctx->extradata_size != 6) { av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n"); return AVERROR(EINVAL); } if (avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "Only mono and stereo is supported\n"); return AVERROR(EINVAL); } s->bps = avctx->bits_per_coded_sample; switch (s->bps) { case 8: avctx->sample_fmt = AV_SAMPLE_FMT_U8; break; case 16: avctx->sample_fmt = AV_SAMPLE_FMT_S16; break; case 24: avctx->sample_fmt = AV_SAMPLE_FMT_S32; break; default: av_log_ask_for_sample(avctx, "Unsupported bits per coded sample %d\n", s->bps); return AVERROR_PATCHWELCOME; } s->avctx = avctx; s->channels = avctx->channels; s->fileversion = AV_RL16(avctx->extradata); s->compression_level = AV_RL16(avctx->extradata + 2); s->flags = AV_RL16(avctx->extradata + 4); av_log(avctx, AV_LOG_DEBUG, "Compression Level: %d - Flags: %d\n", s->compression_level, s->flags); if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE) { av_log(avctx, AV_LOG_ERROR, "Incorrect compression level %d\n", s->compression_level); return AVERROR_INVALIDDATA; } s->fset = s->compression_level / 1000 - 1; for (i = 0; i < APE_FILTER_LEVELS; i++) { if (!ape_filter_orders[s->fset][i]) break; FF_ALLOC_OR_GOTO(avctx, s->filterbuf[i], (ape_filter_orders[s->fset][i] * 3 + HISTORY_SIZE) * 4, filter_alloc_fail); } ff_dsputil_init(&s->dsp, avctx); avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; return 0; filter_alloc_fail: ape_decode_close(avctx); return AVERROR(ENOMEM); }
{ "code": [ " if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE) {" ], "line_no": [ 75 ] }
static av_cold int FUNC_0(AVCodecContext *avctx) { APEContext *s = avctx->priv_data; int VAR_0; if (avctx->extradata_size != 6) { av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n"); return AVERROR(EINVAL); } if (avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "Only mono and stereo is supported\n"); return AVERROR(EINVAL); } s->bps = avctx->bits_per_coded_sample; switch (s->bps) { case 8: avctx->sample_fmt = AV_SAMPLE_FMT_U8; break; case 16: avctx->sample_fmt = AV_SAMPLE_FMT_S16; break; case 24: avctx->sample_fmt = AV_SAMPLE_FMT_S32; break; default: av_log_ask_for_sample(avctx, "Unsupported bits per coded sample %d\n", s->bps); return AVERROR_PATCHWELCOME; } s->avctx = avctx; s->channels = avctx->channels; s->fileversion = AV_RL16(avctx->extradata); s->compression_level = AV_RL16(avctx->extradata + 2); s->flags = AV_RL16(avctx->extradata + 4); av_log(avctx, AV_LOG_DEBUG, "Compression Level: %d - Flags: %d\n", s->compression_level, s->flags); if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE) { av_log(avctx, AV_LOG_ERROR, "Incorrect compression level %d\n", s->compression_level); return AVERROR_INVALIDDATA; } s->fset = s->compression_level / 1000 - 1; for (VAR_0 = 0; VAR_0 < APE_FILTER_LEVELS; VAR_0++) { if (!ape_filter_orders[s->fset][VAR_0]) break; FF_ALLOC_OR_GOTO(avctx, s->filterbuf[VAR_0], (ape_filter_orders[s->fset][VAR_0] * 3 + HISTORY_SIZE) * 4, filter_alloc_fail); } ff_dsputil_init(&s->dsp, avctx); avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; return 0; filter_alloc_fail: ape_decode_close(avctx); return AVERROR(ENOMEM); }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "APEContext *s = avctx->priv_data;", "int VAR_0;", "if (avctx->extradata_size != 6) {", "av_log(avctx, AV_LOG_ERROR, \"Incorrect extradata\\n\");", "return AVERROR(EINVAL);", "}", "if (avctx->channels > 2) {", "av_log(avctx, AV_LOG_ERROR, \"Only mono and stereo is supported\\n\");", "return AVERROR(EINVAL);", "}", "s->bps = avctx->bits_per_coded_sample;", "switch (s->bps) {", "case 8:\navctx->sample_fmt = AV_SAMPLE_FMT_U8;", "break;", "case 16:\navctx->sample_fmt = AV_SAMPLE_FMT_S16;", "break;", "case 24:\navctx->sample_fmt = AV_SAMPLE_FMT_S32;", "break;", "default:\nav_log_ask_for_sample(avctx, \"Unsupported bits per coded sample %d\\n\",\ns->bps);", "return AVERROR_PATCHWELCOME;", "}", "s->avctx = avctx;", "s->channels = avctx->channels;", "s->fileversion = AV_RL16(avctx->extradata);", "s->compression_level = AV_RL16(avctx->extradata + 2);", "s->flags = AV_RL16(avctx->extradata + 4);", "av_log(avctx, AV_LOG_DEBUG, \"Compression Level: %d - Flags: %d\\n\",\ns->compression_level, s->flags);", "if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE) {", "av_log(avctx, AV_LOG_ERROR, \"Incorrect compression level %d\\n\",\ns->compression_level);", "return AVERROR_INVALIDDATA;", "}", "s->fset = s->compression_level / 1000 - 1;", "for (VAR_0 = 0; VAR_0 < APE_FILTER_LEVELS; VAR_0++) {", "if (!ape_filter_orders[s->fset][VAR_0])\nbreak;", "FF_ALLOC_OR_GOTO(avctx, s->filterbuf[VAR_0],\n(ape_filter_orders[s->fset][VAR_0] * 3 + HISTORY_SIZE) * 4,\nfilter_alloc_fail);", "}", "ff_dsputil_init(&s->dsp, avctx);", "avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;", "avcodec_get_frame_defaults(&s->frame);", "avctx->coded_frame = &s->frame;", "return 0;", "filter_alloc_fail:\nape_decode_close(avctx);", "return AVERROR(ENOMEM);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49, 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93, 95, 97 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ] ]
12,291
static double lfo_get_value(SimpleLFO *lfo) { double phs = FFMIN(100, lfo->phase / FFMIN(1.99, FFMAX(0.01, lfo->pwidth)) + lfo->offset); double val; if (phs > 1) phs = fmod(phs, 1.); switch (lfo->mode) { case SINE: val = sin(phs * 2 * M_PI); break; case TRIANGLE: if (phs > 0.75) val = (phs - 0.75) * 4 - 1; else if (phs > 0.25) val = -4 * phs + 2; else val = phs * 4; break; case SQUARE: val = phs < 0.5 ? -1 : +1; break; case SAWUP: val = phs * 2 - 1; break; case SAWDOWN: val = 1 - phs * 2; break; } return val * lfo->amount; }
true
FFmpeg
1693336aed3988e0c13ad1ff880257d80d6ae69d
static double lfo_get_value(SimpleLFO *lfo) { double phs = FFMIN(100, lfo->phase / FFMIN(1.99, FFMAX(0.01, lfo->pwidth)) + lfo->offset); double val; if (phs > 1) phs = fmod(phs, 1.); switch (lfo->mode) { case SINE: val = sin(phs * 2 * M_PI); break; case TRIANGLE: if (phs > 0.75) val = (phs - 0.75) * 4 - 1; else if (phs > 0.25) val = -4 * phs + 2; else val = phs * 4; break; case SQUARE: val = phs < 0.5 ? -1 : +1; break; case SAWUP: val = phs * 2 - 1; break; case SAWDOWN: val = 1 - phs * 2; break; } return val * lfo->amount; }
{ "code": [], "line_no": [] }
static double FUNC_0(SimpleLFO *VAR_0) { double VAR_1 = FFMIN(100, VAR_0->phase / FFMIN(1.99, FFMAX(0.01, VAR_0->pwidth)) + VAR_0->offset); double VAR_2; if (VAR_1 > 1) VAR_1 = fmod(VAR_1, 1.); switch (VAR_0->mode) { case SINE: VAR_2 = sin(VAR_1 * 2 * M_PI); break; case TRIANGLE: if (VAR_1 > 0.75) VAR_2 = (VAR_1 - 0.75) * 4 - 1; else if (VAR_1 > 0.25) VAR_2 = -4 * VAR_1 + 2; else VAR_2 = VAR_1 * 4; break; case SQUARE: VAR_2 = VAR_1 < 0.5 ? -1 : +1; break; case SAWUP: VAR_2 = VAR_1 * 2 - 1; break; case SAWDOWN: VAR_2 = 1 - VAR_1 * 2; break; } return VAR_2 * VAR_0->amount; }
[ "static double FUNC_0(SimpleLFO *VAR_0)\n{", "double VAR_1 = FFMIN(100, VAR_0->phase / FFMIN(1.99, FFMAX(0.01, VAR_0->pwidth)) + VAR_0->offset);", "double VAR_2;", "if (VAR_1 > 1)\nVAR_1 = fmod(VAR_1, 1.);", "switch (VAR_0->mode) {", "case SINE:\nVAR_2 = sin(VAR_1 * 2 * M_PI);", "break;", "case TRIANGLE:\nif (VAR_1 > 0.75)\nVAR_2 = (VAR_1 - 0.75) * 4 - 1;", "else if (VAR_1 > 0.25)\nVAR_2 = -4 * VAR_1 + 2;", "else\nVAR_2 = VAR_1 * 4;", "break;", "case SQUARE:\nVAR_2 = VAR_1 < 0.5 ? -1 : +1;", "break;", "case SAWUP:\nVAR_2 = VAR_1 * 2 - 1;", "break;", "case SAWDOWN:\nVAR_2 = 1 - VAR_1 * 2;", "break;", "}", "return VAR_2 * VAR_0->amount;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25, 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 60 ], [ 64 ], [ 66 ] ]
12,292
static int srt_get_duration(uint8_t **buf) { int i, duration = 0; for (i=0; i<2 && !duration; i++) { int s_hour, s_min, s_sec, s_hsec, e_hour, e_min, e_sec, e_hsec; if (sscanf(*buf, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d", &s_hour, &s_min, &s_sec, &s_hsec, &e_hour, &e_min, &e_sec, &e_hsec) == 8) { s_min += 60*s_hour; e_min += 60*e_hour; s_sec += 60*s_min; e_sec += 60*e_min; s_hsec += 1000*s_sec; e_hsec += 1000*e_sec; duration = e_hsec - s_hsec; } *buf += strcspn(*buf, "\n") + 1; } return duration; }
true
FFmpeg
90fc00a623de44e137fe1601b91356e8cd8bdd54
static int srt_get_duration(uint8_t **buf) { int i, duration = 0; for (i=0; i<2 && !duration; i++) { int s_hour, s_min, s_sec, s_hsec, e_hour, e_min, e_sec, e_hsec; if (sscanf(*buf, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d", &s_hour, &s_min, &s_sec, &s_hsec, &e_hour, &e_min, &e_sec, &e_hsec) == 8) { s_min += 60*s_hour; e_min += 60*e_hour; s_sec += 60*s_min; e_sec += 60*e_min; s_hsec += 1000*s_sec; e_hsec += 1000*e_sec; duration = e_hsec - s_hsec; } *buf += strcspn(*buf, "\n") + 1; } return duration; }
{ "code": [ " *buf += strcspn(*buf, \"\\n\") + 1;" ], "line_no": [ 29 ] }
static int FUNC_0(uint8_t **VAR_0) { int VAR_1, VAR_2 = 0; for (VAR_1=0; VAR_1<2 && !VAR_2; VAR_1++) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10; if (sscanf(*VAR_0, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d", &VAR_3, &VAR_4, &VAR_5, &VAR_6, &VAR_7, &VAR_8, &VAR_9, &VAR_10) == 8) { VAR_4 += 60*VAR_3; VAR_8 += 60*VAR_7; VAR_5 += 60*VAR_4; VAR_9 += 60*VAR_8; VAR_6 += 1000*VAR_5; VAR_10 += 1000*VAR_9; VAR_2 = VAR_10 - VAR_6; } *VAR_0 += strcspn(*VAR_0, "\n") + 1; } return VAR_2; }
[ "static int FUNC_0(uint8_t **VAR_0)\n{", "int VAR_1, VAR_2 = 0;", "for (VAR_1=0; VAR_1<2 && !VAR_2; VAR_1++) {", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9, VAR_10;", "if (sscanf(*VAR_0, \"%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d\",\n&VAR_3, &VAR_4, &VAR_5, &VAR_6,\n&VAR_7, &VAR_8, &VAR_9, &VAR_10) == 8) {", "VAR_4 += 60*VAR_3; VAR_8 += 60*VAR_7;", "VAR_5 += 60*VAR_4; VAR_9 += 60*VAR_8;", "VAR_6 += 1000*VAR_5; VAR_10 += 1000*VAR_9;", "VAR_2 = VAR_10 - VAR_6;", "}", "*VAR_0 += strcspn(*VAR_0, \"\\n\") + 1;", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
12,293
static int vaapi_encode_mjpeg_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic) { VAAPIEncodeContext *ctx = avctx->priv_data; VAEncPictureParameterBufferJPEG *vpic = pic->codec_picture_params; VAAPIEncodeMJPEGContext *priv = ctx->priv_data; vpic->reconstructed_picture = pic->recon_surface; vpic->coded_buf = pic->output_buffer; vpic->picture_width = ctx->input_width; vpic->picture_height = ctx->input_height; vpic->pic_flags.bits.profile = 0; vpic->pic_flags.bits.progressive = 0; vpic->pic_flags.bits.huffman = 1; vpic->pic_flags.bits.interleaved = 0; vpic->pic_flags.bits.differential = 0; vpic->sample_bit_depth = 8; vpic->num_scan = 1; vpic->num_components = 3; vpic->component_id[0] = 1; vpic->component_id[1] = 2; vpic->component_id[2] = 3; priv->component_subsample_h[0] = 2; priv->component_subsample_v[0] = 2; priv->component_subsample_h[1] = 1; priv->component_subsample_v[1] = 1; priv->component_subsample_h[2] = 1; priv->component_subsample_v[2] = 1; vpic->quantiser_table_selector[0] = 0; vpic->quantiser_table_selector[1] = 1; vpic->quantiser_table_selector[2] = 1; vpic->quality = priv->quality; pic->nb_slices = 1; return 0; }
false
FFmpeg
c8241e730f116f1c9cfc0b34110aa7f052e05332
static int vaapi_encode_mjpeg_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic) { VAAPIEncodeContext *ctx = avctx->priv_data; VAEncPictureParameterBufferJPEG *vpic = pic->codec_picture_params; VAAPIEncodeMJPEGContext *priv = ctx->priv_data; vpic->reconstructed_picture = pic->recon_surface; vpic->coded_buf = pic->output_buffer; vpic->picture_width = ctx->input_width; vpic->picture_height = ctx->input_height; vpic->pic_flags.bits.profile = 0; vpic->pic_flags.bits.progressive = 0; vpic->pic_flags.bits.huffman = 1; vpic->pic_flags.bits.interleaved = 0; vpic->pic_flags.bits.differential = 0; vpic->sample_bit_depth = 8; vpic->num_scan = 1; vpic->num_components = 3; vpic->component_id[0] = 1; vpic->component_id[1] = 2; vpic->component_id[2] = 3; priv->component_subsample_h[0] = 2; priv->component_subsample_v[0] = 2; priv->component_subsample_h[1] = 1; priv->component_subsample_v[1] = 1; priv->component_subsample_h[2] = 1; priv->component_subsample_v[2] = 1; vpic->quantiser_table_selector[0] = 0; vpic->quantiser_table_selector[1] = 1; vpic->quantiser_table_selector[2] = 1; vpic->quality = priv->quality; pic->nb_slices = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, VAAPIEncodePicture *VAR_1) { VAAPIEncodeContext *ctx = VAR_0->priv_data; VAEncPictureParameterBufferJPEG *vpic = VAR_1->codec_picture_params; VAAPIEncodeMJPEGContext *priv = ctx->priv_data; vpic->reconstructed_picture = VAR_1->recon_surface; vpic->coded_buf = VAR_1->output_buffer; vpic->picture_width = ctx->input_width; vpic->picture_height = ctx->input_height; vpic->pic_flags.bits.profile = 0; vpic->pic_flags.bits.progressive = 0; vpic->pic_flags.bits.huffman = 1; vpic->pic_flags.bits.interleaved = 0; vpic->pic_flags.bits.differential = 0; vpic->sample_bit_depth = 8; vpic->num_scan = 1; vpic->num_components = 3; vpic->component_id[0] = 1; vpic->component_id[1] = 2; vpic->component_id[2] = 3; priv->component_subsample_h[0] = 2; priv->component_subsample_v[0] = 2; priv->component_subsample_h[1] = 1; priv->component_subsample_v[1] = 1; priv->component_subsample_h[2] = 1; priv->component_subsample_v[2] = 1; vpic->quantiser_table_selector[0] = 0; vpic->quantiser_table_selector[1] = 1; vpic->quantiser_table_selector[2] = 1; vpic->quality = priv->quality; VAR_1->nb_slices = 1; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nVAAPIEncodePicture *VAR_1)\n{", "VAAPIEncodeContext *ctx = VAR_0->priv_data;", "VAEncPictureParameterBufferJPEG *vpic = VAR_1->codec_picture_params;", "VAAPIEncodeMJPEGContext *priv = ctx->priv_data;", "vpic->reconstructed_picture = VAR_1->recon_surface;", "vpic->coded_buf = VAR_1->output_buffer;", "vpic->picture_width = ctx->input_width;", "vpic->picture_height = ctx->input_height;", "vpic->pic_flags.bits.profile = 0;", "vpic->pic_flags.bits.progressive = 0;", "vpic->pic_flags.bits.huffman = 1;", "vpic->pic_flags.bits.interleaved = 0;", "vpic->pic_flags.bits.differential = 0;", "vpic->sample_bit_depth = 8;", "vpic->num_scan = 1;", "vpic->num_components = 3;", "vpic->component_id[0] = 1;", "vpic->component_id[1] = 2;", "vpic->component_id[2] = 3;", "priv->component_subsample_h[0] = 2;", "priv->component_subsample_v[0] = 2;", "priv->component_subsample_h[1] = 1;", "priv->component_subsample_v[1] = 1;", "priv->component_subsample_h[2] = 1;", "priv->component_subsample_v[2] = 1;", "vpic->quantiser_table_selector[0] = 0;", "vpic->quantiser_table_selector[1] = 1;", "vpic->quantiser_table_selector[2] = 1;", "vpic->quality = priv->quality;", "VAR_1->nb_slices = 1;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 87 ], [ 89 ] ]
12,294
static int hdcd_scan(HDCDContext *ctx, hdcd_state_t *state, const int32_t *samples, int max, int stride) { int cdt_active = 0; /* code detect timer */ int result; if (state->sustain > 0) { cdt_active = 1; if (state->sustain <= max) { state->control = 0; max = state->sustain; } state->sustain -= max; } result = 0; while (result < max) { int flag; int consumed = hdcd_integrate(ctx, state, &flag, samples, max - result, stride); result += consumed; if (flag > 0) { /* reset timer if code detected in channel */ hdcd_sustain_reset(state); break; } samples += consumed * stride; } /* code detect timer expired */ if (cdt_active && state->sustain == 0) state->count_sustain_expired++; return result; }
false
FFmpeg
d574e22659bd51cdf16723a204fef65a9e783f1d
static int hdcd_scan(HDCDContext *ctx, hdcd_state_t *state, const int32_t *samples, int max, int stride) { int cdt_active = 0; int result; if (state->sustain > 0) { cdt_active = 1; if (state->sustain <= max) { state->control = 0; max = state->sustain; } state->sustain -= max; } result = 0; while (result < max) { int flag; int consumed = hdcd_integrate(ctx, state, &flag, samples, max - result, stride); result += consumed; if (flag > 0) { hdcd_sustain_reset(state); break; } samples += consumed * stride; } if (cdt_active && state->sustain == 0) state->count_sustain_expired++; return result; }
{ "code": [], "line_no": [] }
static int FUNC_0(HDCDContext *VAR_0, hdcd_state_t *VAR_1, const int32_t *VAR_2, int VAR_3, int VAR_4) { int VAR_5 = 0; int VAR_6; if (VAR_1->sustain > 0) { VAR_5 = 1; if (VAR_1->sustain <= VAR_3) { VAR_1->control = 0; VAR_3 = VAR_1->sustain; } VAR_1->sustain -= VAR_3; } VAR_6 = 0; while (VAR_6 < VAR_3) { int VAR_7; int VAR_8 = hdcd_integrate(VAR_0, VAR_1, &VAR_7, VAR_2, VAR_3 - VAR_6, VAR_4); VAR_6 += VAR_8; if (VAR_7 > 0) { hdcd_sustain_reset(VAR_1); break; } VAR_2 += VAR_8 * VAR_4; } if (VAR_5 && VAR_1->sustain == 0) VAR_1->count_sustain_expired++; return VAR_6; }
[ "static int FUNC_0(HDCDContext *VAR_0, hdcd_state_t *VAR_1, const int32_t *VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5 = 0;", "int VAR_6;", "if (VAR_1->sustain > 0) {", "VAR_5 = 1;", "if (VAR_1->sustain <= VAR_3) {", "VAR_1->control = 0;", "VAR_3 = VAR_1->sustain;", "}", "VAR_1->sustain -= VAR_3;", "}", "VAR_6 = 0;", "while (VAR_6 < VAR_3) {", "int VAR_7;", "int VAR_8 = hdcd_integrate(VAR_0, VAR_1, &VAR_7, VAR_2, VAR_3 - VAR_6, VAR_4);", "VAR_6 += VAR_8;", "if (VAR_7 > 0) {", "hdcd_sustain_reset(VAR_1);", "break;", "}", "VAR_2 += VAR_8 * VAR_4;", "}", "if (VAR_5 && VAR_1->sustain == 0)\nVAR_1->count_sustain_expired++;", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57 ], [ 59 ] ]
12,295
static int swf_write_audio(AVFormatContext *s, AVCodecContext *enc, const uint8_t *buf, int size) { SWFContext *swf = s->priv_data; int c = 0; /* Flash Player limit */ if ( swf->swf_frame_number >= 16000 ) { return 0; } if (enc->codec_id == CODEC_ID_MP3 ) { for (c=0; c<size; c++) { swf->audio_fifo[(swf->audio_out_pos+c)%AUDIO_FIFO_SIZE] = buf[c]; } swf->audio_size += size; swf->audio_out_pos += size; swf->audio_out_pos %= AUDIO_FIFO_SIZE; } /* if audio only stream make sure we add swf frames */ if ( swf->video_type == 0 ) { swf_write_video(s, enc, 0, 0); } return 0; }
false
FFmpeg
d3e18ad02795f9761b7e5a5c018dfef786046acf
static int swf_write_audio(AVFormatContext *s, AVCodecContext *enc, const uint8_t *buf, int size) { SWFContext *swf = s->priv_data; int c = 0; if ( swf->swf_frame_number >= 16000 ) { return 0; } if (enc->codec_id == CODEC_ID_MP3 ) { for (c=0; c<size; c++) { swf->audio_fifo[(swf->audio_out_pos+c)%AUDIO_FIFO_SIZE] = buf[c]; } swf->audio_size += size; swf->audio_out_pos += size; swf->audio_out_pos %= AUDIO_FIFO_SIZE; } if ( swf->video_type == 0 ) { swf_write_video(s, enc, 0, 0); } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVCodecContext *VAR_1, const uint8_t *VAR_2, int VAR_3) { SWFContext *swf = VAR_0->priv_data; int VAR_4 = 0; if ( swf->swf_frame_number >= 16000 ) { return 0; } if (VAR_1->codec_id == CODEC_ID_MP3 ) { for (VAR_4=0; VAR_4<VAR_3; VAR_4++) { swf->audio_fifo[(swf->audio_out_pos+VAR_4)%AUDIO_FIFO_SIZE] = VAR_2[VAR_4]; } swf->audio_size += VAR_3; swf->audio_out_pos += VAR_3; swf->audio_out_pos %= AUDIO_FIFO_SIZE; } if ( swf->video_type == 0 ) { swf_write_video(VAR_0, VAR_1, 0, 0); } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVCodecContext *VAR_1, const uint8_t *VAR_2, int VAR_3)\n{", "SWFContext *swf = VAR_0->priv_data;", "int VAR_4 = 0;", "if ( swf->swf_frame_number >= 16000 ) {", "return 0;", "}", "if (VAR_1->codec_id == CODEC_ID_MP3 ) {", "for (VAR_4=0; VAR_4<VAR_3; VAR_4++) {", "swf->audio_fifo[(swf->audio_out_pos+VAR_4)%AUDIO_FIFO_SIZE] = VAR_2[VAR_4];", "}", "swf->audio_size += VAR_3;", "swf->audio_out_pos += VAR_3;", "swf->audio_out_pos %= AUDIO_FIFO_SIZE;", "}", "if ( swf->video_type == 0 ) {", "swf_write_video(VAR_0, VAR_1, 0, 0);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ] ]
12,296
static int64_t mp3_sync(AVFormatContext *s, int64_t target_pos, int flags) { int dir = (flags&AVSEEK_FLAG_BACKWARD) ? -1 : 1; int64_t best_pos; int best_score, i, j; int64_t ret; avio_seek(s->pb, FFMAX(target_pos - SEEK_WINDOW, 0), SEEK_SET); ret = avio_seek(s->pb, target_pos, SEEK_SET); if (ret < 0) return ret; #define MIN_VALID 3 best_pos = target_pos; best_score = 999; for(i=0; i<SEEK_WINDOW; i++) { int64_t pos = target_pos + (dir > 0 ? i - SEEK_WINDOW/4 : -i); int64_t candidate = -1; int score = 999; if (pos < 0) continue; for(j=0; j<MIN_VALID; j++) { ret = check(s->pb, pos); if(ret < 0) break; if ((target_pos - pos)*dir <= 0 && abs(MIN_VALID/2-j) < score) { candidate = pos; score = abs(MIN_VALID/2-j); } pos += ret; } if (best_score > score && j == MIN_VALID) { best_pos = candidate; best_score = score; if(score == 0) break; } } return avio_seek(s->pb, best_pos, SEEK_SET); }
false
FFmpeg
de1b1a7da9e6ddf42447271e519099a88b389e4a
static int64_t mp3_sync(AVFormatContext *s, int64_t target_pos, int flags) { int dir = (flags&AVSEEK_FLAG_BACKWARD) ? -1 : 1; int64_t best_pos; int best_score, i, j; int64_t ret; avio_seek(s->pb, FFMAX(target_pos - SEEK_WINDOW, 0), SEEK_SET); ret = avio_seek(s->pb, target_pos, SEEK_SET); if (ret < 0) return ret; #define MIN_VALID 3 best_pos = target_pos; best_score = 999; for(i=0; i<SEEK_WINDOW; i++) { int64_t pos = target_pos + (dir > 0 ? i - SEEK_WINDOW/4 : -i); int64_t candidate = -1; int score = 999; if (pos < 0) continue; for(j=0; j<MIN_VALID; j++) { ret = check(s->pb, pos); if(ret < 0) break; if ((target_pos - pos)*dir <= 0 && abs(MIN_VALID/2-j) < score) { candidate = pos; score = abs(MIN_VALID/2-j); } pos += ret; } if (best_score > score && j == MIN_VALID) { best_pos = candidate; best_score = score; if(score == 0) break; } } return avio_seek(s->pb, best_pos, SEEK_SET); }
{ "code": [], "line_no": [] }
static int64_t FUNC_0(AVFormatContext *s, int64_t target_pos, int flags) { int VAR_0 = (flags&AVSEEK_FLAG_BACKWARD) ? -1 : 1; int64_t best_pos; int VAR_1, VAR_2, VAR_3; int64_t ret; avio_seek(s->pb, FFMAX(target_pos - SEEK_WINDOW, 0), SEEK_SET); ret = avio_seek(s->pb, target_pos, SEEK_SET); if (ret < 0) return ret; #define MIN_VALID 3 best_pos = target_pos; VAR_1 = 999; for(VAR_2=0; VAR_2<SEEK_WINDOW; VAR_2++) { int64_t pos = target_pos + (VAR_0 > 0 ? VAR_2 - SEEK_WINDOW/4 : -VAR_2); int64_t candidate = -1; int score = 999; if (pos < 0) continue; for(VAR_3=0; VAR_3<MIN_VALID; VAR_3++) { ret = check(s->pb, pos); if(ret < 0) break; if ((target_pos - pos)*VAR_0 <= 0 && abs(MIN_VALID/2-VAR_3) < score) { candidate = pos; score = abs(MIN_VALID/2-VAR_3); } pos += ret; } if (VAR_1 > score && VAR_3 == MIN_VALID) { best_pos = candidate; VAR_1 = score; if(score == 0) break; } } return avio_seek(s->pb, best_pos, SEEK_SET); }
[ "static int64_t FUNC_0(AVFormatContext *s, int64_t target_pos, int flags)\n{", "int VAR_0 = (flags&AVSEEK_FLAG_BACKWARD) ? -1 : 1;", "int64_t best_pos;", "int VAR_1, VAR_2, VAR_3;", "int64_t ret;", "avio_seek(s->pb, FFMAX(target_pos - SEEK_WINDOW, 0), SEEK_SET);", "ret = avio_seek(s->pb, target_pos, SEEK_SET);", "if (ret < 0)\nreturn ret;", "#define MIN_VALID 3\nbest_pos = target_pos;", "VAR_1 = 999;", "for(VAR_2=0; VAR_2<SEEK_WINDOW; VAR_2++) {", "int64_t pos = target_pos + (VAR_0 > 0 ? VAR_2 - SEEK_WINDOW/4 : -VAR_2);", "int64_t candidate = -1;", "int score = 999;", "if (pos < 0)\ncontinue;", "for(VAR_3=0; VAR_3<MIN_VALID; VAR_3++) {", "ret = check(s->pb, pos);", "if(ret < 0)\nbreak;", "if ((target_pos - pos)*VAR_0 <= 0 && abs(MIN_VALID/2-VAR_3) < score) {", "candidate = pos;", "score = abs(MIN_VALID/2-VAR_3);", "}", "pos += ret;", "}", "if (VAR_1 > score && VAR_3 == MIN_VALID) {", "best_pos = candidate;", "VAR_1 = score;", "if(score == 0)\nbreak;", "}", "}", "return avio_seek(s->pb, best_pos, SEEK_SET);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ] ]
12,297
void test_segs(void) { struct modify_ldt_ldt_s ldt; long long ldt_table[3]; int res, res2; char tmp; struct { uint32_t offset; uint16_t seg; } __attribute__((packed)) segoff; ldt.entry_number = 1; ldt.base_addr = (unsigned long)&seg_data1; ldt.limit = (sizeof(seg_data1) + 0xfff) >> 12; ldt.seg_32bit = 1; ldt.contents = MODIFY_LDT_CONTENTS_DATA; ldt.read_exec_only = 0; ldt.limit_in_pages = 1; ldt.seg_not_present = 0; ldt.useable = 1; modify_ldt(1, &ldt, sizeof(ldt)); /* write ldt entry */ ldt.entry_number = 2; ldt.base_addr = (unsigned long)&seg_data2; ldt.limit = (sizeof(seg_data2) + 0xfff) >> 12; ldt.seg_32bit = 1; ldt.contents = MODIFY_LDT_CONTENTS_DATA; ldt.read_exec_only = 0; ldt.limit_in_pages = 1; ldt.seg_not_present = 0; ldt.useable = 1; modify_ldt(1, &ldt, sizeof(ldt)); /* write ldt entry */ modify_ldt(0, &ldt_table, sizeof(ldt_table)); /* read ldt entries */ #if 0 { int i; for(i=0;i<3;i++) printf("%d: %016Lx\n", i, ldt_table[i]); } #endif /* do some tests with fs or gs */ asm volatile ("movl %0, %%fs" : : "r" (MK_SEL(1))); seg_data1[1] = 0xaa; seg_data2[1] = 0x55; asm volatile ("fs movzbl 0x1, %0" : "=r" (res)); printf("FS[1] = %02x\n", res); asm volatile ("pushl %%gs\n" "movl %1, %%gs\n" "gs movzbl 0x1, %0\n" "popl %%gs\n" : "=r" (res) : "r" (MK_SEL(2))); printf("GS[1] = %02x\n", res); /* tests with ds/ss (implicit segment case) */ tmp = 0xa5; asm volatile ("pushl %%ebp\n\t" "pushl %%ds\n\t" "movl %2, %%ds\n\t" "movl %3, %%ebp\n\t" "movzbl 0x1, %0\n\t" "movzbl (%%ebp), %1\n\t" "popl %%ds\n\t" "popl %%ebp\n\t" : "=r" (res), "=r" (res2) : "r" (MK_SEL(1)), "r" (&tmp)); printf("DS[1] = %02x\n", res); printf("SS[tmp] = %02x\n", res2); segoff.seg = MK_SEL(2); segoff.offset = 0xabcdef12; asm volatile("lfs %2, %0\n\t" "movl %%fs, %1\n\t" : "=r" (res), "=g" (res2) : "m" (segoff)); printf("FS:reg = %04x:%08x\n", res2, res); TEST_LR("larw", "w", MK_SEL(2), 0x0100); TEST_LR("larl", "", MK_SEL(2), 0x0100); TEST_LR("lslw", "w", MK_SEL(2), 0); TEST_LR("lsll", "", MK_SEL(2), 0); TEST_LR("larw", "w", 0xfff8, 0); TEST_LR("larl", "", 0xfff8, 0); TEST_LR("lslw", "w", 0xfff8, 0); TEST_LR("lsll", "", 0xfff8, 0); TEST_ARPL("arpl", "w", 0x12345678 | 3, 0x762123c | 1); TEST_ARPL("arpl", "w", 0x12345678 | 1, 0x762123c | 3); TEST_ARPL("arpl", "w", 0x12345678 | 1, 0x762123c | 1); }
false
qemu
541dc0d47f10973c241e9955afc2aefc96adec51
void test_segs(void) { struct modify_ldt_ldt_s ldt; long long ldt_table[3]; int res, res2; char tmp; struct { uint32_t offset; uint16_t seg; } __attribute__((packed)) segoff; ldt.entry_number = 1; ldt.base_addr = (unsigned long)&seg_data1; ldt.limit = (sizeof(seg_data1) + 0xfff) >> 12; ldt.seg_32bit = 1; ldt.contents = MODIFY_LDT_CONTENTS_DATA; ldt.read_exec_only = 0; ldt.limit_in_pages = 1; ldt.seg_not_present = 0; ldt.useable = 1; modify_ldt(1, &ldt, sizeof(ldt)); ldt.entry_number = 2; ldt.base_addr = (unsigned long)&seg_data2; ldt.limit = (sizeof(seg_data2) + 0xfff) >> 12; ldt.seg_32bit = 1; ldt.contents = MODIFY_LDT_CONTENTS_DATA; ldt.read_exec_only = 0; ldt.limit_in_pages = 1; ldt.seg_not_present = 0; ldt.useable = 1; modify_ldt(1, &ldt, sizeof(ldt)); modify_ldt(0, &ldt_table, sizeof(ldt_table)); #if 0 { int i; for(i=0;i<3;i++) printf("%d: %016Lx\n", i, ldt_table[i]); } #endif asm volatile ("movl %0, %%fs" : : "r" (MK_SEL(1))); seg_data1[1] = 0xaa; seg_data2[1] = 0x55; asm volatile ("fs movzbl 0x1, %0" : "=r" (res)); printf("FS[1] = %02x\n", res); asm volatile ("pushl %%gs\n" "movl %1, %%gs\n" "gs movzbl 0x1, %0\n" "popl %%gs\n" : "=r" (res) : "r" (MK_SEL(2))); printf("GS[1] = %02x\n", res); tmp = 0xa5; asm volatile ("pushl %%ebp\n\t" "pushl %%ds\n\t" "movl %2, %%ds\n\t" "movl %3, %%ebp\n\t" "movzbl 0x1, %0\n\t" "movzbl (%%ebp), %1\n\t" "popl %%ds\n\t" "popl %%ebp\n\t" : "=r" (res), "=r" (res2) : "r" (MK_SEL(1)), "r" (&tmp)); printf("DS[1] = %02x\n", res); printf("SS[tmp] = %02x\n", res2); segoff.seg = MK_SEL(2); segoff.offset = 0xabcdef12; asm volatile("lfs %2, %0\n\t" "movl %%fs, %1\n\t" : "=r" (res), "=g" (res2) : "m" (segoff)); printf("FS:reg = %04x:%08x\n", res2, res); TEST_LR("larw", "w", MK_SEL(2), 0x0100); TEST_LR("larl", "", MK_SEL(2), 0x0100); TEST_LR("lslw", "w", MK_SEL(2), 0); TEST_LR("lsll", "", MK_SEL(2), 0); TEST_LR("larw", "w", 0xfff8, 0); TEST_LR("larl", "", 0xfff8, 0); TEST_LR("lslw", "w", 0xfff8, 0); TEST_LR("lsll", "", 0xfff8, 0); TEST_ARPL("arpl", "w", 0x12345678 | 3, 0x762123c | 1); TEST_ARPL("arpl", "w", 0x12345678 | 1, 0x762123c | 3); TEST_ARPL("arpl", "w", 0x12345678 | 1, 0x762123c | 1); }
{ "code": [], "line_no": [] }
void FUNC_0(void) { struct modify_ldt_ldt_s VAR_0; long long VAR_1[3]; int VAR_2, VAR_3; char VAR_4; struct { uint32_t offset; uint16_t seg; } __attribute__((packed)) VAR_5; VAR_0.entry_number = 1; VAR_0.base_addr = (unsigned long)&seg_data1; VAR_0.limit = (sizeof(seg_data1) + 0xfff) >> 12; VAR_0.seg_32bit = 1; VAR_0.contents = MODIFY_LDT_CONTENTS_DATA; VAR_0.read_exec_only = 0; VAR_0.limit_in_pages = 1; VAR_0.seg_not_present = 0; VAR_0.useable = 1; modify_ldt(1, &VAR_0, sizeof(VAR_0)); VAR_0.entry_number = 2; VAR_0.base_addr = (unsigned long)&seg_data2; VAR_0.limit = (sizeof(seg_data2) + 0xfff) >> 12; VAR_0.seg_32bit = 1; VAR_0.contents = MODIFY_LDT_CONTENTS_DATA; VAR_0.read_exec_only = 0; VAR_0.limit_in_pages = 1; VAR_0.seg_not_present = 0; VAR_0.useable = 1; modify_ldt(1, &VAR_0, sizeof(VAR_0)); modify_ldt(0, &VAR_1, sizeof(VAR_1)); #if 0 { int i; for(i=0;i<3;i++) printf("%d: %016Lx\n", i, VAR_1[i]); } #endif asm volatile ("movl %0, %%fs" : : "r" (MK_SEL(1))); seg_data1[1] = 0xaa; seg_data2[1] = 0x55; asm volatile ("fs movzbl 0x1, %0" : "=r" (VAR_2)); printf("FS[1] = %02x\n", VAR_2); asm volatile ("pushl %%gs\n" "movl %1, %%gs\n" "gs movzbl 0x1, %0\n" "popl %%gs\n" : "=r" (VAR_2) : "r" (MK_SEL(2))); printf("GS[1] = %02x\n", VAR_2); VAR_4 = 0xa5; asm volatile ("pushl %%ebp\n\t" "pushl %%ds\n\t" "movl %2, %%ds\n\t" "movl %3, %%ebp\n\t" "movzbl 0x1, %0\n\t" "movzbl (%%ebp), %1\n\t" "popl %%ds\n\t" "popl %%ebp\n\t" : "=r" (VAR_2), "=r" (VAR_3) : "r" (MK_SEL(1)), "r" (&VAR_4)); printf("DS[1] = %02x\n", VAR_2); printf("SS[VAR_4] = %02x\n", VAR_3); VAR_5.seg = MK_SEL(2); VAR_5.offset = 0xabcdef12; asm volatile("lfs %2, %0\n\t" "movl %%fs, %1\n\t" : "=r" (VAR_2), "=g" (VAR_3) : "m" (VAR_5)); printf("FS:reg = %04x:%08x\n", VAR_3, VAR_2); TEST_LR("larw", "w", MK_SEL(2), 0x0100); TEST_LR("larl", "", MK_SEL(2), 0x0100); TEST_LR("lslw", "w", MK_SEL(2), 0); TEST_LR("lsll", "", MK_SEL(2), 0); TEST_LR("larw", "w", 0xfff8, 0); TEST_LR("larl", "", 0xfff8, 0); TEST_LR("lslw", "w", 0xfff8, 0); TEST_LR("lsll", "", 0xfff8, 0); TEST_ARPL("arpl", "w", 0x12345678 | 3, 0x762123c | 1); TEST_ARPL("arpl", "w", 0x12345678 | 1, 0x762123c | 3); TEST_ARPL("arpl", "w", 0x12345678 | 1, 0x762123c | 1); }
[ "void FUNC_0(void)\n{", "struct modify_ldt_ldt_s VAR_0;", "long long VAR_1[3];", "int VAR_2, VAR_3;", "char VAR_4;", "struct {", "uint32_t offset;", "uint16_t seg;", "} __attribute__((packed)) VAR_5;", "VAR_0.entry_number = 1;", "VAR_0.base_addr = (unsigned long)&seg_data1;", "VAR_0.limit = (sizeof(seg_data1) + 0xfff) >> 12;", "VAR_0.seg_32bit = 1;", "VAR_0.contents = MODIFY_LDT_CONTENTS_DATA;", "VAR_0.read_exec_only = 0;", "VAR_0.limit_in_pages = 1;", "VAR_0.seg_not_present = 0;", "VAR_0.useable = 1;", "modify_ldt(1, &VAR_0, sizeof(VAR_0));", "VAR_0.entry_number = 2;", "VAR_0.base_addr = (unsigned long)&seg_data2;", "VAR_0.limit = (sizeof(seg_data2) + 0xfff) >> 12;", "VAR_0.seg_32bit = 1;", "VAR_0.contents = MODIFY_LDT_CONTENTS_DATA;", "VAR_0.read_exec_only = 0;", "VAR_0.limit_in_pages = 1;", "VAR_0.seg_not_present = 0;", "VAR_0.useable = 1;", "modify_ldt(1, &VAR_0, sizeof(VAR_0));", "modify_ldt(0, &VAR_1, sizeof(VAR_1));", "#if 0\n{", "int i;", "for(i=0;i<3;i++)", "printf(\"%d: %016Lx\\n\", i, VAR_1[i]);", "}", "#endif\nasm volatile (\"movl %0, %%fs\" : : \"r\" (MK_SEL(1)));", "seg_data1[1] = 0xaa;", "seg_data2[1] = 0x55;", "asm volatile (\"fs movzbl 0x1, %0\" : \"=r\" (VAR_2));", "printf(\"FS[1] = %02x\\n\", VAR_2);", "asm volatile (\"pushl %%gs\\n\"\n\"movl %1, %%gs\\n\"\n\"gs movzbl 0x1, %0\\n\"\n\"popl %%gs\\n\"\n: \"=r\" (VAR_2)\n: \"r\" (MK_SEL(2)));", "printf(\"GS[1] = %02x\\n\", VAR_2);", "VAR_4 = 0xa5;", "asm volatile (\"pushl %%ebp\\n\\t\"\n\"pushl %%ds\\n\\t\"\n\"movl %2, %%ds\\n\\t\"\n\"movl %3, %%ebp\\n\\t\"\n\"movzbl 0x1, %0\\n\\t\"\n\"movzbl (%%ebp), %1\\n\\t\"\n\"popl %%ds\\n\\t\"\n\"popl %%ebp\\n\\t\"\n: \"=r\" (VAR_2), \"=r\" (VAR_3)\n: \"r\" (MK_SEL(1)), \"r\" (&VAR_4));", "printf(\"DS[1] = %02x\\n\", VAR_2);", "printf(\"SS[VAR_4] = %02x\\n\", VAR_3);", "VAR_5.seg = MK_SEL(2);", "VAR_5.offset = 0xabcdef12;", "asm volatile(\"lfs %2, %0\\n\\t\"\n\"movl %%fs, %1\\n\\t\"\n: \"=r\" (VAR_2), \"=g\" (VAR_3)\n: \"m\" (VAR_5));", "printf(\"FS:reg = %04x:%08x\\n\", VAR_3, VAR_2);", "TEST_LR(\"larw\", \"w\", MK_SEL(2), 0x0100);", "TEST_LR(\"larl\", \"\", MK_SEL(2), 0x0100);", "TEST_LR(\"lslw\", \"w\", MK_SEL(2), 0);", "TEST_LR(\"lsll\", \"\", MK_SEL(2), 0);", "TEST_LR(\"larw\", \"w\", 0xfff8, 0);", "TEST_LR(\"larl\", \"\", 0xfff8, 0);", "TEST_LR(\"lslw\", \"w\", 0xfff8, 0);", "TEST_LR(\"lsll\", \"\", 0xfff8, 0);", "TEST_ARPL(\"arpl\", \"w\", 0x12345678 | 3, 0x762123c | 1);", "TEST_ARPL(\"arpl\", \"w\", 0x12345678 | 1, 0x762123c | 3);", "TEST_ARPL(\"arpl\", \"w\", 0x12345678 | 1, 0x762123c | 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81, 85 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 101, 103, 105, 107, 109, 111 ], [ 113 ], [ 119 ], [ 121, 123, 125, 127, 129, 131, 133, 135, 137, 139 ], [ 141 ], [ 143 ], [ 147 ], [ 149 ], [ 151, 153, 155, 157 ], [ 159 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ] ]
12,299
static void cpu_notify_map_clients(void) { MapClient *client; while (!LIST_EMPTY(&map_client_list)) { client = LIST_FIRST(&map_client_list); client->callback(client->opaque); cpu_unregister_map_client(client); } }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
static void cpu_notify_map_clients(void) { MapClient *client; while (!LIST_EMPTY(&map_client_list)) { client = LIST_FIRST(&map_client_list); client->callback(client->opaque); cpu_unregister_map_client(client); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { MapClient *client; while (!LIST_EMPTY(&map_client_list)) { client = LIST_FIRST(&map_client_list); client->callback(client->opaque); cpu_unregister_map_client(client); } }
[ "static void FUNC_0(void)\n{", "MapClient *client;", "while (!LIST_EMPTY(&map_client_list)) {", "client = LIST_FIRST(&map_client_list);", "client->callback(client->opaque);", "cpu_unregister_map_client(client);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
12,300
vcard_free(VCard *vcard) { VCardApplet *current_applet = NULL; VCardApplet *next_applet = NULL; if (vcard == NULL) { return; } vcard->reference_count--; if (vcard->reference_count != 0) { return; } if (vcard->vcard_private_free) { (*vcard->vcard_private_free)(vcard->vcard_private); vcard->vcard_private_free = 0; vcard->vcard_private = 0; } for (current_applet = vcard->applet_list; current_applet; current_applet = next_applet) { next_applet = current_applet->next; vcard_delete_applet(current_applet); } vcard_buffer_response_delete(vcard->vcard_buffer_response); g_free(vcard); }
false
qemu
1687a089f103f9b7a1b4a1555068054cb46ee9e9
vcard_free(VCard *vcard) { VCardApplet *current_applet = NULL; VCardApplet *next_applet = NULL; if (vcard == NULL) { return; } vcard->reference_count--; if (vcard->reference_count != 0) { return; } if (vcard->vcard_private_free) { (*vcard->vcard_private_free)(vcard->vcard_private); vcard->vcard_private_free = 0; vcard->vcard_private = 0; } for (current_applet = vcard->applet_list; current_applet; current_applet = next_applet) { next_applet = current_applet->next; vcard_delete_applet(current_applet); } vcard_buffer_response_delete(vcard->vcard_buffer_response); g_free(vcard); }
{ "code": [], "line_no": [] }
FUNC_0(VCard *VAR_0) { VCardApplet *current_applet = NULL; VCardApplet *next_applet = NULL; if (VAR_0 == NULL) { return; } VAR_0->reference_count--; if (VAR_0->reference_count != 0) { return; } if (VAR_0->vcard_private_free) { (*VAR_0->vcard_private_free)(VAR_0->vcard_private); VAR_0->vcard_private_free = 0; VAR_0->vcard_private = 0; } for (current_applet = VAR_0->applet_list; current_applet; current_applet = next_applet) { next_applet = current_applet->next; vcard_delete_applet(current_applet); } vcard_buffer_response_delete(VAR_0->vcard_buffer_response); g_free(VAR_0); }
[ "FUNC_0(VCard *VAR_0)\n{", "VCardApplet *current_applet = NULL;", "VCardApplet *next_applet = NULL;", "if (VAR_0 == NULL) {", "return;", "}", "VAR_0->reference_count--;", "if (VAR_0->reference_count != 0) {", "return;", "}", "if (VAR_0->vcard_private_free) {", "(*VAR_0->vcard_private_free)(VAR_0->vcard_private);", "VAR_0->vcard_private_free = 0;", "VAR_0->vcard_private = 0;", "}", "for (current_applet = VAR_0->applet_list; current_applet;", "current_applet = next_applet) {", "next_applet = current_applet->next;", "vcard_delete_applet(current_applet);", "}", "vcard_buffer_response_delete(VAR_0->vcard_buffer_response);", "g_free(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
12,301
static inline bool valid_ptex(PowerPCCPU *cpu, target_ulong ptex) { /* * hash value/pteg group index is normalized by htab_mask */ if (((ptex & ~7ULL) / HPTES_PER_GROUP) & ~cpu->env.htab_mask) { return false; } return true; }
false
qemu
36778660d7fd0748a6129916e47ecedd67bdb758
static inline bool valid_ptex(PowerPCCPU *cpu, target_ulong ptex) { if (((ptex & ~7ULL) / HPTES_PER_GROUP) & ~cpu->env.htab_mask) { return false; } return true; }
{ "code": [], "line_no": [] }
static inline bool FUNC_0(PowerPCCPU *cpu, target_ulong ptex) { if (((ptex & ~7ULL) / HPTES_PER_GROUP) & ~cpu->env.htab_mask) { return false; } return true; }
[ "static inline bool FUNC_0(PowerPCCPU *cpu, target_ulong ptex)\n{", "if (((ptex & ~7ULL) / HPTES_PER_GROUP) & ~cpu->env.htab_mask) {", "return false;", "}", "return true;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
12,302
gen_intermediate_code_internal(SuperHCPU *cpu, TranslationBlock *tb, bool search_pc) { CPUState *cs = CPU(cpu); CPUSH4State *env = &cpu->env; DisasContext ctx; target_ulong pc_start; static uint16_t *gen_opc_end; CPUBreakpoint *bp; int i, ii; int num_insns; int max_insns; pc_start = tb->pc; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; ctx.pc = pc_start; ctx.flags = (uint32_t)tb->flags; ctx.bstate = BS_NONE; ctx.memidx = (ctx.flags & SR_MD) == 0 ? 1 : 0; /* We don't know if the delayed pc came from a dynamic or static branch, so assume it is a dynamic branch. */ ctx.delayed_pc = -1; /* use delayed pc from env pointer */ ctx.tb = tb; ctx.singlestep_enabled = cs->singlestep_enabled; ctx.features = env->features; ctx.has_movcal = (ctx.flags & TB_FLAG_PENDING_MOVCA); ii = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_tb_start(); while (ctx.bstate == BS_NONE && tcg_ctx.gen_opc_ptr < gen_opc_end) { if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (ctx.pc == bp->pc) { /* We have hit a breakpoint - make sure PC is up-to-date */ tcg_gen_movi_i32(cpu_pc, ctx.pc); gen_helper_debug(cpu_env); ctx.bstate = BS_BRANCH; break; } } } if (search_pc) { i = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (ii < i) { ii++; while (ii < i) tcg_ctx.gen_opc_instr_start[ii++] = 0; } tcg_ctx.gen_opc_pc[ii] = ctx.pc; gen_opc_hflags[ii] = ctx.flags; tcg_ctx.gen_opc_instr_start[ii] = 1; tcg_ctx.gen_opc_icount[ii] = num_insns; } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); #if 0 fprintf(stderr, "Loading opcode at address 0x%08x\n", ctx.pc); fflush(stderr); #endif ctx.opcode = cpu_lduw_code(env, ctx.pc); decode_opc(&ctx); num_insns++; ctx.pc += 2; if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) break; if (cs->singlestep_enabled) { break; } if (num_insns >= max_insns) break; if (singlestep) break; } if (tb->cflags & CF_LAST_IO) gen_io_end(); if (cs->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, ctx.pc); gen_helper_debug(cpu_env); } else { switch (ctx.bstate) { case BS_STOP: /* gen_op_interrupt_restart(); */ /* fall through */ case BS_NONE: if (ctx.flags) { gen_store_flags(ctx.flags | DELAY_SLOT_CLEARME); } gen_goto_tb(&ctx, 0, ctx.pc); break; case BS_EXCP: /* gen_op_interrupt_restart(); */ tcg_gen_exit_tb(0); break; case BS_BRANCH: default: break; } } gen_tb_end(tb, num_insns); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (search_pc) { i = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; ii++; while (ii <= i) tcg_ctx.gen_opc_instr_start[ii++] = 0; } else { tb->size = ctx.pc - pc_start; tb->icount = num_insns; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("IN:\n"); /* , lookup_symbol(pc_start)); */ log_target_disas(env, pc_start, ctx.pc - pc_start, 0); qemu_log("\n"); } #endif }
false
qemu
cd42d5b23691ad73edfd6dbcfc935a960a9c5a65
gen_intermediate_code_internal(SuperHCPU *cpu, TranslationBlock *tb, bool search_pc) { CPUState *cs = CPU(cpu); CPUSH4State *env = &cpu->env; DisasContext ctx; target_ulong pc_start; static uint16_t *gen_opc_end; CPUBreakpoint *bp; int i, ii; int num_insns; int max_insns; pc_start = tb->pc; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; ctx.pc = pc_start; ctx.flags = (uint32_t)tb->flags; ctx.bstate = BS_NONE; ctx.memidx = (ctx.flags & SR_MD) == 0 ? 1 : 0; ctx.delayed_pc = -1; ctx.tb = tb; ctx.singlestep_enabled = cs->singlestep_enabled; ctx.features = env->features; ctx.has_movcal = (ctx.flags & TB_FLAG_PENDING_MOVCA); ii = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_tb_start(); while (ctx.bstate == BS_NONE && tcg_ctx.gen_opc_ptr < gen_opc_end) { if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (ctx.pc == bp->pc) { tcg_gen_movi_i32(cpu_pc, ctx.pc); gen_helper_debug(cpu_env); ctx.bstate = BS_BRANCH; break; } } } if (search_pc) { i = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (ii < i) { ii++; while (ii < i) tcg_ctx.gen_opc_instr_start[ii++] = 0; } tcg_ctx.gen_opc_pc[ii] = ctx.pc; gen_opc_hflags[ii] = ctx.flags; tcg_ctx.gen_opc_instr_start[ii] = 1; tcg_ctx.gen_opc_icount[ii] = num_insns; } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); #if 0 fprintf(stderr, "Loading opcode at address 0x%08x\n", ctx.pc); fflush(stderr); #endif ctx.opcode = cpu_lduw_code(env, ctx.pc); decode_opc(&ctx); num_insns++; ctx.pc += 2; if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) break; if (cs->singlestep_enabled) { break; } if (num_insns >= max_insns) break; if (singlestep) break; } if (tb->cflags & CF_LAST_IO) gen_io_end(); if (cs->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, ctx.pc); gen_helper_debug(cpu_env); } else { switch (ctx.bstate) { case BS_STOP: case BS_NONE: if (ctx.flags) { gen_store_flags(ctx.flags | DELAY_SLOT_CLEARME); } gen_goto_tb(&ctx, 0, ctx.pc); break; case BS_EXCP: tcg_gen_exit_tb(0); break; case BS_BRANCH: default: break; } } gen_tb_end(tb, num_insns); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (search_pc) { i = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; ii++; while (ii <= i) tcg_ctx.gen_opc_instr_start[ii++] = 0; } else { tb->size = ctx.pc - pc_start; tb->icount = num_insns; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("IN:\n"); log_target_disas(env, pc_start, ctx.pc - pc_start, 0); qemu_log("\n"); } #endif }
{ "code": [], "line_no": [] }
FUNC_0(SuperHCPU *VAR_0, TranslationBlock *VAR_1, bool VAR_2) { CPUState *cs = CPU(VAR_0); CPUSH4State *env = &VAR_0->env; DisasContext ctx; target_ulong pc_start; static uint16_t *VAR_3; CPUBreakpoint *bp; int VAR_4, VAR_5; int VAR_6; int VAR_7; pc_start = VAR_1->pc; VAR_3 = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; ctx.pc = pc_start; ctx.flags = (uint32_t)VAR_1->flags; ctx.bstate = BS_NONE; ctx.memidx = (ctx.flags & SR_MD) == 0 ? 1 : 0; ctx.delayed_pc = -1; ctx.VAR_1 = VAR_1; ctx.singlestep_enabled = cs->singlestep_enabled; ctx.features = env->features; ctx.has_movcal = (ctx.flags & TB_FLAG_PENDING_MOVCA); VAR_5 = -1; VAR_6 = 0; VAR_7 = VAR_1->cflags & CF_COUNT_MASK; if (VAR_7 == 0) VAR_7 = CF_COUNT_MASK; gen_tb_start(); while (ctx.bstate == BS_NONE && tcg_ctx.gen_opc_ptr < VAR_3) { if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (ctx.pc == bp->pc) { tcg_gen_movi_i32(cpu_pc, ctx.pc); gen_helper_debug(cpu_env); ctx.bstate = BS_BRANCH; break; } } } if (VAR_2) { VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (VAR_5 < VAR_4) { VAR_5++; while (VAR_5 < VAR_4) tcg_ctx.gen_opc_instr_start[VAR_5++] = 0; } tcg_ctx.gen_opc_pc[VAR_5] = ctx.pc; gen_opc_hflags[VAR_5] = ctx.flags; tcg_ctx.gen_opc_instr_start[VAR_5] = 1; tcg_ctx.gen_opc_icount[VAR_5] = VAR_6; } if (VAR_6 + 1 == VAR_7 && (VAR_1->cflags & CF_LAST_IO)) gen_io_start(); #if 0 fprintf(stderr, "Loading opcode at address 0x%08x\n", ctx.pc); fflush(stderr); #endif ctx.opcode = cpu_lduw_code(env, ctx.pc); decode_opc(&ctx); VAR_6++; ctx.pc += 2; if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0) break; if (cs->singlestep_enabled) { break; } if (VAR_6 >= VAR_7) break; if (singlestep) break; } if (VAR_1->cflags & CF_LAST_IO) gen_io_end(); if (cs->singlestep_enabled) { tcg_gen_movi_i32(cpu_pc, ctx.pc); gen_helper_debug(cpu_env); } else { switch (ctx.bstate) { case BS_STOP: case BS_NONE: if (ctx.flags) { gen_store_flags(ctx.flags | DELAY_SLOT_CLEARME); } gen_goto_tb(&ctx, 0, ctx.pc); break; case BS_EXCP: tcg_gen_exit_tb(0); break; case BS_BRANCH: default: break; } } gen_tb_end(VAR_1, VAR_6); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (VAR_2) { VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; VAR_5++; while (VAR_5 <= VAR_4) tcg_ctx.gen_opc_instr_start[VAR_5++] = 0; } else { VAR_1->size = ctx.pc - pc_start; VAR_1->icount = VAR_6; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("IN:\n"); log_target_disas(env, pc_start, ctx.pc - pc_start, 0); qemu_log("\n"); } #endif }
[ "FUNC_0(SuperHCPU *VAR_0, TranslationBlock *VAR_1,\nbool VAR_2)\n{", "CPUState *cs = CPU(VAR_0);", "CPUSH4State *env = &VAR_0->env;", "DisasContext ctx;", "target_ulong pc_start;", "static uint16_t *VAR_3;", "CPUBreakpoint *bp;", "int VAR_4, VAR_5;", "int VAR_6;", "int VAR_7;", "pc_start = VAR_1->pc;", "VAR_3 = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;", "ctx.pc = pc_start;", "ctx.flags = (uint32_t)VAR_1->flags;", "ctx.bstate = BS_NONE;", "ctx.memidx = (ctx.flags & SR_MD) == 0 ? 1 : 0;", "ctx.delayed_pc = -1;", "ctx.VAR_1 = VAR_1;", "ctx.singlestep_enabled = cs->singlestep_enabled;", "ctx.features = env->features;", "ctx.has_movcal = (ctx.flags & TB_FLAG_PENDING_MOVCA);", "VAR_5 = -1;", "VAR_6 = 0;", "VAR_7 = VAR_1->cflags & CF_COUNT_MASK;", "if (VAR_7 == 0)\nVAR_7 = CF_COUNT_MASK;", "gen_tb_start();", "while (ctx.bstate == BS_NONE && tcg_ctx.gen_opc_ptr < VAR_3) {", "if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {", "QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {", "if (ctx.pc == bp->pc) {", "tcg_gen_movi_i32(cpu_pc, ctx.pc);", "gen_helper_debug(cpu_env);", "ctx.bstate = BS_BRANCH;", "break;", "}", "}", "}", "if (VAR_2) {", "VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;", "if (VAR_5 < VAR_4) {", "VAR_5++;", "while (VAR_5 < VAR_4)\ntcg_ctx.gen_opc_instr_start[VAR_5++] = 0;", "}", "tcg_ctx.gen_opc_pc[VAR_5] = ctx.pc;", "gen_opc_hflags[VAR_5] = ctx.flags;", "tcg_ctx.gen_opc_instr_start[VAR_5] = 1;", "tcg_ctx.gen_opc_icount[VAR_5] = VAR_6;", "}", "if (VAR_6 + 1 == VAR_7 && (VAR_1->cflags & CF_LAST_IO))\ngen_io_start();", "#if 0\nfprintf(stderr, \"Loading opcode at address 0x%08x\\n\", ctx.pc);", "fflush(stderr);", "#endif\nctx.opcode = cpu_lduw_code(env, ctx.pc);", "decode_opc(&ctx);", "VAR_6++;", "ctx.pc += 2;", "if ((ctx.pc & (TARGET_PAGE_SIZE - 1)) == 0)\nbreak;", "if (cs->singlestep_enabled) {", "break;", "}", "if (VAR_6 >= VAR_7)\nbreak;", "if (singlestep)\nbreak;", "}", "if (VAR_1->cflags & CF_LAST_IO)\ngen_io_end();", "if (cs->singlestep_enabled) {", "tcg_gen_movi_i32(cpu_pc, ctx.pc);", "gen_helper_debug(cpu_env);", "} else {", "switch (ctx.bstate) {", "case BS_STOP:\ncase BS_NONE:\nif (ctx.flags) {", "gen_store_flags(ctx.flags | DELAY_SLOT_CLEARME);", "}", "gen_goto_tb(&ctx, 0, ctx.pc);", "break;", "case BS_EXCP:\ntcg_gen_exit_tb(0);", "break;", "case BS_BRANCH:\ndefault:\nbreak;", "}", "}", "gen_tb_end(VAR_1, VAR_6);", "*tcg_ctx.gen_opc_ptr = INDEX_op_end;", "if (VAR_2) {", "VAR_4 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;", "VAR_5++;", "while (VAR_5 <= VAR_4)\ntcg_ctx.gen_opc_instr_start[VAR_5++] = 0;", "} else {", "VAR_1->size = ctx.pc - pc_start;", "VAR_1->icount = VAR_6;", "}", "#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {", "qemu_log(\"IN:\\n\");", "log_target_disas(env, pc_start, ctx.pc - pc_start, 0);", "qemu_log(\"\\n\");", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119, 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149, 151 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187, 191 ], [ 193 ], [ 195, 197, 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 231, 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243, 245 ] ]
12,303
static uint32_t get_level1_table_address(CPUARMState *env, uint32_t address) { uint32_t table; if (address & env->cp15.c2_mask) table = env->cp15.ttbr1_el1 & 0xffffc000; else table = env->cp15.ttbr0_el1 & env->cp15.c2_base_mask; table |= (address >> 18) & 0x3ffc; return table; }
false
qemu
e389be1673052b538534643165111725a79e5afd
static uint32_t get_level1_table_address(CPUARMState *env, uint32_t address) { uint32_t table; if (address & env->cp15.c2_mask) table = env->cp15.ttbr1_el1 & 0xffffc000; else table = env->cp15.ttbr0_el1 & env->cp15.c2_base_mask; table |= (address >> 18) & 0x3ffc; return table; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(CPUARMState *env, uint32_t address) { uint32_t table; if (address & env->cp15.c2_mask) table = env->cp15.ttbr1_el1 & 0xffffc000; else table = env->cp15.ttbr0_el1 & env->cp15.c2_base_mask; table |= (address >> 18) & 0x3ffc; return table; }
[ "static uint32_t FUNC_0(CPUARMState *env, uint32_t address)\n{", "uint32_t table;", "if (address & env->cp15.c2_mask)\ntable = env->cp15.ttbr1_el1 & 0xffffc000;", "else\ntable = env->cp15.ttbr0_el1 & env->cp15.c2_base_mask;", "table |= (address >> 18) & 0x3ffc;", "return table;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 23 ] ]
12,304
static int do_setcontext(struct target_ucontext *ucp, CPUPPCState *env, int sig) { struct target_mcontext *mcp; target_ulong mcp_addr; sigset_t blocked; target_sigset_t set; if (copy_from_user(&set, h2g(ucp) + offsetof(struct target_ucontext, tuc_sigmask), sizeof (set))) return 1; #if defined(TARGET_PPC64) fprintf (stderr, "do_setcontext: not implemented\n"); return 0; #else if (__get_user(mcp_addr, &ucp->tuc_regs)) return 1; if (!lock_user_struct(VERIFY_READ, mcp, mcp_addr, 1)) return 1; target_to_host_sigset_internal(&blocked, &set); do_sigprocmask(SIG_SETMASK, &blocked, NULL); if (restore_user_regs(env, mcp, sig)) goto sigsegv; unlock_user_struct(mcp, mcp_addr, 1); return 0; sigsegv: unlock_user_struct(mcp, mcp_addr, 1); return 1; #endif }
false
qemu
c650c008e326f3a1e84083bc269265456057a212
static int do_setcontext(struct target_ucontext *ucp, CPUPPCState *env, int sig) { struct target_mcontext *mcp; target_ulong mcp_addr; sigset_t blocked; target_sigset_t set; if (copy_from_user(&set, h2g(ucp) + offsetof(struct target_ucontext, tuc_sigmask), sizeof (set))) return 1; #if defined(TARGET_PPC64) fprintf (stderr, "do_setcontext: not implemented\n"); return 0; #else if (__get_user(mcp_addr, &ucp->tuc_regs)) return 1; if (!lock_user_struct(VERIFY_READ, mcp, mcp_addr, 1)) return 1; target_to_host_sigset_internal(&blocked, &set); do_sigprocmask(SIG_SETMASK, &blocked, NULL); if (restore_user_regs(env, mcp, sig)) goto sigsegv; unlock_user_struct(mcp, mcp_addr, 1); return 0; sigsegv: unlock_user_struct(mcp, mcp_addr, 1); return 1; #endif }
{ "code": [], "line_no": [] }
static int FUNC_0(struct target_ucontext *VAR_0, CPUPPCState *VAR_1, int VAR_2) { struct target_mcontext *VAR_3; target_ulong mcp_addr; sigset_t blocked; target_sigset_t set; if (copy_from_user(&set, h2g(VAR_0) + offsetof(struct target_ucontext, tuc_sigmask), sizeof (set))) return 1; #if defined(TARGET_PPC64) fprintf (stderr, "FUNC_0: not implemented\n"); return 0; #else if (__get_user(mcp_addr, &VAR_0->tuc_regs)) return 1; if (!lock_user_struct(VERIFY_READ, VAR_3, mcp_addr, 1)) return 1; target_to_host_sigset_internal(&blocked, &set); do_sigprocmask(SIG_SETMASK, &blocked, NULL); if (restore_user_regs(VAR_1, VAR_3, VAR_2)) goto sigsegv; unlock_user_struct(VAR_3, mcp_addr, 1); return 0; sigsegv: unlock_user_struct(VAR_3, mcp_addr, 1); return 1; #endif }
[ "static int FUNC_0(struct target_ucontext *VAR_0, CPUPPCState *VAR_1, int VAR_2)\n{", "struct target_mcontext *VAR_3;", "target_ulong mcp_addr;", "sigset_t blocked;", "target_sigset_t set;", "if (copy_from_user(&set, h2g(VAR_0) + offsetof(struct target_ucontext, tuc_sigmask),\nsizeof (set)))\nreturn 1;", "#if defined(TARGET_PPC64)\nfprintf (stderr, \"FUNC_0: not implemented\\n\");", "return 0;", "#else\nif (__get_user(mcp_addr, &VAR_0->tuc_regs))\nreturn 1;", "if (!lock_user_struct(VERIFY_READ, VAR_3, mcp_addr, 1))\nreturn 1;", "target_to_host_sigset_internal(&blocked, &set);", "do_sigprocmask(SIG_SETMASK, &blocked, NULL);", "if (restore_user_regs(VAR_1, VAR_3, VAR_2))\ngoto sigsegv;", "unlock_user_struct(VAR_3, mcp_addr, 1);", "return 0;", "sigsegv:\nunlock_user_struct(VAR_3, mcp_addr, 1);", "return 1;", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17, 19 ], [ 23, 25 ], [ 27 ], [ 29, 31, 33 ], [ 37, 39 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65, 67 ] ]
12,306
static void bdrv_co_drain_bh_cb(void *opaque) { BdrvCoDrainData *data = opaque; Coroutine *co = data->co; BlockDriverState *bs = data->bs; bdrv_dec_in_flight(bs); bdrv_drain_poll(bs); data->done = true; qemu_coroutine_enter(co); }
false
qemu
d42cf28837801cd1f835089fe9db2a42a1af55cd
static void bdrv_co_drain_bh_cb(void *opaque) { BdrvCoDrainData *data = opaque; Coroutine *co = data->co; BlockDriverState *bs = data->bs; bdrv_dec_in_flight(bs); bdrv_drain_poll(bs); data->done = true; qemu_coroutine_enter(co); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { BdrvCoDrainData *data = VAR_0; Coroutine *co = data->co; BlockDriverState *bs = data->bs; bdrv_dec_in_flight(bs); bdrv_drain_poll(bs); data->done = true; qemu_coroutine_enter(co); }
[ "static void FUNC_0(void *VAR_0)\n{", "BdrvCoDrainData *data = VAR_0;", "Coroutine *co = data->co;", "BlockDriverState *bs = data->bs;", "bdrv_dec_in_flight(bs);", "bdrv_drain_poll(bs);", "data->done = true;", "qemu_coroutine_enter(co);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
12,309
QEMUTimerList *timerlist_new(QEMUClockType type, QEMUTimerListNotifyCB *cb, void *opaque) { QEMUTimerList *timer_list; QEMUClock *clock = qemu_clock_ptr(type); timer_list = g_malloc0(sizeof(QEMUTimerList)); qemu_event_init(&timer_list->timers_done_ev, true); timer_list->clock = clock; timer_list->notify_cb = cb; timer_list->notify_opaque = opaque; qemu_mutex_init(&timer_list->active_timers_lock); QLIST_INSERT_HEAD(&clock->timerlists, timer_list, list); return timer_list; }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
QEMUTimerList *timerlist_new(QEMUClockType type, QEMUTimerListNotifyCB *cb, void *opaque) { QEMUTimerList *timer_list; QEMUClock *clock = qemu_clock_ptr(type); timer_list = g_malloc0(sizeof(QEMUTimerList)); qemu_event_init(&timer_list->timers_done_ev, true); timer_list->clock = clock; timer_list->notify_cb = cb; timer_list->notify_opaque = opaque; qemu_mutex_init(&timer_list->active_timers_lock); QLIST_INSERT_HEAD(&clock->timerlists, timer_list, list); return timer_list; }
{ "code": [], "line_no": [] }
QEMUTimerList *FUNC_0(QEMUClockType type, QEMUTimerListNotifyCB *cb, void *opaque) { QEMUTimerList *timer_list; QEMUClock *clock = qemu_clock_ptr(type); timer_list = g_malloc0(sizeof(QEMUTimerList)); qemu_event_init(&timer_list->timers_done_ev, true); timer_list->clock = clock; timer_list->notify_cb = cb; timer_list->notify_opaque = opaque; qemu_mutex_init(&timer_list->active_timers_lock); QLIST_INSERT_HEAD(&clock->timerlists, timer_list, list); return timer_list; }
[ "QEMUTimerList *FUNC_0(QEMUClockType type,\nQEMUTimerListNotifyCB *cb,\nvoid *opaque)\n{", "QEMUTimerList *timer_list;", "QEMUClock *clock = qemu_clock_ptr(type);", "timer_list = g_malloc0(sizeof(QEMUTimerList));", "qemu_event_init(&timer_list->timers_done_ev, true);", "timer_list->clock = clock;", "timer_list->notify_cb = cb;", "timer_list->notify_opaque = opaque;", "qemu_mutex_init(&timer_list->active_timers_lock);", "QLIST_INSERT_HEAD(&clock->timerlists, timer_list, list);", "return timer_list;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ] ]
12,311
void cpu_check_irqs(CPUSPARCState *env) { uint32_t pil = env->pil_in | (env->softint & ~(SOFTINT_TIMER | SOFTINT_STIMER)); /* check if TM or SM in SOFTINT are set setting these also causes interrupt 14 */ if (env->softint & (SOFTINT_TIMER | SOFTINT_STIMER)) { pil |= 1 << 14; } /* The bit corresponding to psrpil is (1<< psrpil), the next bit is (2 << psrpil). */ if (pil < (2 << env->psrpil)){ if (env->interrupt_request & CPU_INTERRUPT_HARD) { CPUIRQ_DPRINTF("Reset CPU IRQ (current interrupt %x)\n", env->interrupt_index); env->interrupt_index = 0; cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); } return; } if (cpu_interrupts_enabled(env)) { unsigned int i; for (i = 15; i > env->psrpil; i--) { if (pil & (1 << i)) { int old_interrupt = env->interrupt_index; int new_interrupt = TT_EXTINT | i; if (env->tl > 0 && cpu_tsptr(env)->tt > new_interrupt) { CPUIRQ_DPRINTF("Not setting CPU IRQ: TL=%d " "current %x >= pending %x\n", env->tl, cpu_tsptr(env)->tt, new_interrupt); } else if (old_interrupt != new_interrupt) { env->interrupt_index = new_interrupt; CPUIRQ_DPRINTF("Set CPU IRQ %d old=%x new=%x\n", i, old_interrupt, new_interrupt); cpu_interrupt(env, CPU_INTERRUPT_HARD); } break; } } } else if (env->interrupt_request & CPU_INTERRUPT_HARD) { CPUIRQ_DPRINTF("Interrupts disabled, pil=%08x pil_in=%08x softint=%08x " "current interrupt %x\n", pil, env->pil_in, env->softint, env->interrupt_index); env->interrupt_index = 0; cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); } }
false
qemu
a7be9bad33d81d4bab2a51935b5443d258e7d082
void cpu_check_irqs(CPUSPARCState *env) { uint32_t pil = env->pil_in | (env->softint & ~(SOFTINT_TIMER | SOFTINT_STIMER)); if (env->softint & (SOFTINT_TIMER | SOFTINT_STIMER)) { pil |= 1 << 14; } if (pil < (2 << env->psrpil)){ if (env->interrupt_request & CPU_INTERRUPT_HARD) { CPUIRQ_DPRINTF("Reset CPU IRQ (current interrupt %x)\n", env->interrupt_index); env->interrupt_index = 0; cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); } return; } if (cpu_interrupts_enabled(env)) { unsigned int i; for (i = 15; i > env->psrpil; i--) { if (pil & (1 << i)) { int old_interrupt = env->interrupt_index; int new_interrupt = TT_EXTINT | i; if (env->tl > 0 && cpu_tsptr(env)->tt > new_interrupt) { CPUIRQ_DPRINTF("Not setting CPU IRQ: TL=%d " "current %x >= pending %x\n", env->tl, cpu_tsptr(env)->tt, new_interrupt); } else if (old_interrupt != new_interrupt) { env->interrupt_index = new_interrupt; CPUIRQ_DPRINTF("Set CPU IRQ %d old=%x new=%x\n", i, old_interrupt, new_interrupt); cpu_interrupt(env, CPU_INTERRUPT_HARD); } break; } } } else if (env->interrupt_request & CPU_INTERRUPT_HARD) { CPUIRQ_DPRINTF("Interrupts disabled, pil=%08x pil_in=%08x softint=%08x " "current interrupt %x\n", pil, env->pil_in, env->softint, env->interrupt_index); env->interrupt_index = 0; cpu_reset_interrupt(env, CPU_INTERRUPT_HARD); } }
{ "code": [], "line_no": [] }
void FUNC_0(CPUSPARCState *VAR_0) { uint32_t pil = VAR_0->pil_in | (VAR_0->softint & ~(SOFTINT_TIMER | SOFTINT_STIMER)); if (VAR_0->softint & (SOFTINT_TIMER | SOFTINT_STIMER)) { pil |= 1 << 14; } if (pil < (2 << VAR_0->psrpil)){ if (VAR_0->interrupt_request & CPU_INTERRUPT_HARD) { CPUIRQ_DPRINTF("Reset CPU IRQ (current interrupt %x)\n", VAR_0->interrupt_index); VAR_0->interrupt_index = 0; cpu_reset_interrupt(VAR_0, CPU_INTERRUPT_HARD); } return; } if (cpu_interrupts_enabled(VAR_0)) { unsigned int VAR_1; for (VAR_1 = 15; VAR_1 > VAR_0->psrpil; VAR_1--) { if (pil & (1 << VAR_1)) { int old_interrupt = VAR_0->interrupt_index; int new_interrupt = TT_EXTINT | VAR_1; if (VAR_0->tl > 0 && cpu_tsptr(VAR_0)->tt > new_interrupt) { CPUIRQ_DPRINTF("Not setting CPU IRQ: TL=%d " "current %x >= pending %x\n", VAR_0->tl, cpu_tsptr(VAR_0)->tt, new_interrupt); } else if (old_interrupt != new_interrupt) { VAR_0->interrupt_index = new_interrupt; CPUIRQ_DPRINTF("Set CPU IRQ %d old=%x new=%x\n", VAR_1, old_interrupt, new_interrupt); cpu_interrupt(VAR_0, CPU_INTERRUPT_HARD); } break; } } } else if (VAR_0->interrupt_request & CPU_INTERRUPT_HARD) { CPUIRQ_DPRINTF("Interrupts disabled, pil=%08x pil_in=%08x softint=%08x " "current interrupt %x\n", pil, VAR_0->pil_in, VAR_0->softint, VAR_0->interrupt_index); VAR_0->interrupt_index = 0; cpu_reset_interrupt(VAR_0, CPU_INTERRUPT_HARD); } }
[ "void FUNC_0(CPUSPARCState *VAR_0)\n{", "uint32_t pil = VAR_0->pil_in |\n(VAR_0->softint & ~(SOFTINT_TIMER | SOFTINT_STIMER));", "if (VAR_0->softint & (SOFTINT_TIMER | SOFTINT_STIMER)) {", "pil |= 1 << 14;", "}", "if (pil < (2 << VAR_0->psrpil)){", "if (VAR_0->interrupt_request & CPU_INTERRUPT_HARD) {", "CPUIRQ_DPRINTF(\"Reset CPU IRQ (current interrupt %x)\\n\",\nVAR_0->interrupt_index);", "VAR_0->interrupt_index = 0;", "cpu_reset_interrupt(VAR_0, CPU_INTERRUPT_HARD);", "}", "return;", "}", "if (cpu_interrupts_enabled(VAR_0)) {", "unsigned int VAR_1;", "for (VAR_1 = 15; VAR_1 > VAR_0->psrpil; VAR_1--) {", "if (pil & (1 << VAR_1)) {", "int old_interrupt = VAR_0->interrupt_index;", "int new_interrupt = TT_EXTINT | VAR_1;", "if (VAR_0->tl > 0 && cpu_tsptr(VAR_0)->tt > new_interrupt) {", "CPUIRQ_DPRINTF(\"Not setting CPU IRQ: TL=%d \"\n\"current %x >= pending %x\\n\",\nVAR_0->tl, cpu_tsptr(VAR_0)->tt, new_interrupt);", "} else if (old_interrupt != new_interrupt) {", "VAR_0->interrupt_index = new_interrupt;", "CPUIRQ_DPRINTF(\"Set CPU IRQ %d old=%x new=%x\\n\", VAR_1,\nold_interrupt, new_interrupt);", "cpu_interrupt(VAR_0, CPU_INTERRUPT_HARD);", "}", "break;", "}", "}", "} else if (VAR_0->interrupt_request & CPU_INTERRUPT_HARD) {", "CPUIRQ_DPRINTF(\"Interrupts disabled, pil=%08x pil_in=%08x softint=%08x \"\n\"current interrupt %x\\n\",\npil, VAR_0->pil_in, VAR_0->softint, VAR_0->interrupt_index);", "VAR_0->interrupt_index = 0;", "cpu_reset_interrupt(VAR_0, CPU_INTERRUPT_HARD);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 15 ], [ 17 ], [ 19 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67, 69, 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93, 95, 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ] ]
12,312
static void *qemu_kvm_cpu_thread_fn(void *arg) { CPUState *env = arg; int r; qemu_mutex_lock(&qemu_global_mutex); qemu_thread_self(env->thread); r = kvm_init_vcpu(env); if (r < 0) { fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r)); exit(1); } qemu_kvm_init_cpu_signals(env); /* signal CPU creation */ env->created = 1; qemu_cond_signal(&qemu_cpu_cond); /* and wait for machine initialization */ while (!qemu_system_ready) qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100); while (1) { if (cpu_can_run(env)) qemu_cpu_exec(env); qemu_kvm_wait_io_event(env); } return NULL; }
false
qemu
0ab07c623c629acfbc792e5a174129c19faefbb7
static void *qemu_kvm_cpu_thread_fn(void *arg) { CPUState *env = arg; int r; qemu_mutex_lock(&qemu_global_mutex); qemu_thread_self(env->thread); r = kvm_init_vcpu(env); if (r < 0) { fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r)); exit(1); } qemu_kvm_init_cpu_signals(env); env->created = 1; qemu_cond_signal(&qemu_cpu_cond); while (!qemu_system_ready) qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100); while (1) { if (cpu_can_run(env)) qemu_cpu_exec(env); qemu_kvm_wait_io_event(env); } return NULL; }
{ "code": [], "line_no": [] }
static void *FUNC_0(void *VAR_0) { CPUState *env = VAR_0; int VAR_1; qemu_mutex_lock(&qemu_global_mutex); qemu_thread_self(env->thread); VAR_1 = kvm_init_vcpu(env); if (VAR_1 < 0) { fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-VAR_1)); exit(1); } qemu_kvm_init_cpu_signals(env); env->created = 1; qemu_cond_signal(&qemu_cpu_cond); while (!qemu_system_ready) qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100); while (1) { if (cpu_can_run(env)) qemu_cpu_exec(env); qemu_kvm_wait_io_event(env); } return NULL; }
[ "static void *FUNC_0(void *VAR_0)\n{", "CPUState *env = VAR_0;", "int VAR_1;", "qemu_mutex_lock(&qemu_global_mutex);", "qemu_thread_self(env->thread);", "VAR_1 = kvm_init_vcpu(env);", "if (VAR_1 < 0) {", "fprintf(stderr, \"kvm_init_vcpu failed: %s\\n\", strerror(-VAR_1));", "exit(1);", "}", "qemu_kvm_init_cpu_signals(env);", "env->created = 1;", "qemu_cond_signal(&qemu_cpu_cond);", "while (!qemu_system_ready)\nqemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100);", "while (1) {", "if (cpu_can_run(env))\nqemu_cpu_exec(env);", "qemu_kvm_wait_io_event(env);", "}", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 35 ], [ 37 ], [ 43, 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ] ]
12,313
static long do_sigreturn_v2(CPUARMState *env) { abi_ulong frame_addr; struct sigframe_v2 *frame = NULL; /* * Since we stacked the signal on a 64-bit boundary, * then 'sp' should be word aligned here. If it's * not, then the user is trying to mess with us. */ frame_addr = env->regs[13]; trace_user_do_sigreturn(env, frame_addr); if (frame_addr & 7) { goto badframe; } if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { goto badframe; } if (do_sigframe_return_v2(env, frame_addr, &frame->uc)) { goto badframe; } unlock_user_struct(frame, frame_addr, 0); return env->regs[0]; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV /* , current */); return 0; }
false
qemu
f0267ef7115656119bf00ed77857789adc036bda
static long do_sigreturn_v2(CPUARMState *env) { abi_ulong frame_addr; struct sigframe_v2 *frame = NULL; frame_addr = env->regs[13]; trace_user_do_sigreturn(env, frame_addr); if (frame_addr & 7) { goto badframe; } if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { goto badframe; } if (do_sigframe_return_v2(env, frame_addr, &frame->uc)) { goto badframe; } unlock_user_struct(frame, frame_addr, 0); return env->regs[0]; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV ); return 0; }
{ "code": [], "line_no": [] }
static long FUNC_0(CPUARMState *VAR_0) { abi_ulong frame_addr; struct sigframe_v2 *VAR_1 = NULL; frame_addr = VAR_0->regs[13]; trace_user_do_sigreturn(VAR_0, frame_addr); if (frame_addr & 7) { goto badframe; } if (!lock_user_struct(VERIFY_READ, VAR_1, frame_addr, 1)) { goto badframe; } if (do_sigframe_return_v2(VAR_0, frame_addr, &VAR_1->uc)) { goto badframe; } unlock_user_struct(VAR_1, frame_addr, 0); return VAR_0->regs[0]; badframe: unlock_user_struct(VAR_1, frame_addr, 0); force_sig(TARGET_SIGSEGV ); return 0; }
[ "static long FUNC_0(CPUARMState *VAR_0)\n{", "abi_ulong frame_addr;", "struct sigframe_v2 *VAR_1 = NULL;", "frame_addr = VAR_0->regs[13];", "trace_user_do_sigreturn(VAR_0, frame_addr);", "if (frame_addr & 7) {", "goto badframe;", "}", "if (!lock_user_struct(VERIFY_READ, VAR_1, frame_addr, 1)) {", "goto badframe;", "}", "if (do_sigframe_return_v2(VAR_0, frame_addr, &VAR_1->uc)) {", "goto badframe;", "}", "unlock_user_struct(VAR_1, frame_addr, 0);", "return VAR_0->regs[0];", "badframe:\nunlock_user_struct(VAR_1, frame_addr, 0);", "force_sig(TARGET_SIGSEGV );", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ] ]
12,315
static int v9fs_synth_open(FsContext *ctx, V9fsPath *fs_path, int flags, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open; V9fsSynthNode *node = *(V9fsSynthNode **)fs_path->data; synth_open = g_malloc(sizeof(*synth_open)); synth_open->node = node; node->open_count++; fs->private = synth_open; return 0; }
false
qemu
364031f17932814484657e5551ba12957d993d7e
static int v9fs_synth_open(FsContext *ctx, V9fsPath *fs_path, int flags, V9fsFidOpenState *fs) { V9fsSynthOpenState *synth_open; V9fsSynthNode *node = *(V9fsSynthNode **)fs_path->data; synth_open = g_malloc(sizeof(*synth_open)); synth_open->node = node; node->open_count++; fs->private = synth_open; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1, int VAR_2, V9fsFidOpenState *VAR_3) { V9fsSynthOpenState *synth_open; V9fsSynthNode *node = *(V9fsSynthNode **)VAR_1->data; synth_open = g_malloc(sizeof(*synth_open)); synth_open->node = node; node->open_count++; VAR_3->private = synth_open; return 0; }
[ "static int FUNC_0(FsContext *VAR_0, V9fsPath *VAR_1,\nint VAR_2, V9fsFidOpenState *VAR_3)\n{", "V9fsSynthOpenState *synth_open;", "V9fsSynthNode *node = *(V9fsSynthNode **)VAR_1->data;", "synth_open = g_malloc(sizeof(*synth_open));", "synth_open->node = node;", "node->open_count++;", "VAR_3->private = synth_open;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
12,316
static void filter_mb_edgecv( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) { int i, d; const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); const int alpha = alpha_table[index_a]; const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; for( i = 0; i < 4; i++ ) { if( bS[i] == 0 ) { pix += 2 * stride; continue; } /* 2px edge length (because we use same bS than the one for luma) */ for( d = 0; d < 2; d++ ) { const uint8_t p0 = pix[-1]; const uint8_t p1 = pix[-2]; const uint8_t q0 = pix[0]; const uint8_t q1 = pix[1]; if( abs( p0 - q0 ) >= alpha || abs( p1 - p0 ) >= beta || abs( q1 - q0 ) >= beta ) { pix += stride; continue; } if( bS[i] < 4 ) { const int tc = tc0_table[index_a][bS[i] - 1] + 1; const int i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-1] = clip( p0 + i_delta, 0, 255 ); /* p0' */ pix[0] = clip( q0 - i_delta, 0, 255 ); /* q0' */ } else { pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; /* p0' */ pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; /* q0' */ } pix += stride; } } }
false
FFmpeg
3ebc7e04dea6072400d91c1c90eb3911754cee06
static void filter_mb_edgecv( H264Context *h, uint8_t *pix, int stride, int bS[4], int qp ) { int i, d; const int index_a = clip( qp + h->slice_alpha_c0_offset, 0, 51 ); const int alpha = alpha_table[index_a]; const int beta = beta_table[clip( qp + h->slice_beta_offset, 0, 51 )]; for( i = 0; i < 4; i++ ) { if( bS[i] == 0 ) { pix += 2 * stride; continue; } for( d = 0; d < 2; d++ ) { const uint8_t p0 = pix[-1]; const uint8_t p1 = pix[-2]; const uint8_t q0 = pix[0]; const uint8_t q1 = pix[1]; if( abs( p0 - q0 ) >= alpha || abs( p1 - p0 ) >= beta || abs( q1 - q0 ) >= beta ) { pix += stride; continue; } if( bS[i] < 4 ) { const int tc = tc0_table[index_a][bS[i] - 1] + 1; const int i_delta = clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc ); pix[-1] = clip( p0 + i_delta, 0, 255 ); pix[0] = clip( q0 - i_delta, 0, 255 ); } else { pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2; pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2; } pix += stride; } } }
{ "code": [], "line_no": [] }
static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3[4], int VAR_4 ) { int VAR_5, VAR_6; const int VAR_7 = clip( VAR_4 + VAR_0->slice_alpha_c0_offset, 0, 51 ); const int VAR_8 = alpha_table[VAR_7]; const int VAR_9 = beta_table[clip( VAR_4 + VAR_0->slice_beta_offset, 0, 51 )]; for( VAR_5 = 0; VAR_5 < 4; VAR_5++ ) { if( VAR_3[VAR_5] == 0 ) { VAR_1 += 2 * VAR_2; continue; } for( VAR_6 = 0; VAR_6 < 2; VAR_6++ ) { const uint8_t VAR_10 = VAR_1[-1]; const uint8_t VAR_11 = VAR_1[-2]; const uint8_t VAR_12 = VAR_1[0]; const uint8_t VAR_13 = VAR_1[1]; if( abs( VAR_10 - VAR_12 ) >= VAR_8 || abs( VAR_11 - VAR_10 ) >= VAR_9 || abs( VAR_13 - VAR_12 ) >= VAR_9 ) { VAR_1 += VAR_2; continue; } if( VAR_3[VAR_5] < 4 ) { const int VAR_14 = tc0_table[VAR_7][VAR_3[VAR_5] - 1] + 1; const int VAR_15 = clip( (((VAR_12 - VAR_10 ) << 2) + (VAR_11 - VAR_13) + 4) >> 3, -VAR_14, VAR_14 ); VAR_1[-1] = clip( VAR_10 + VAR_15, 0, 255 ); VAR_1[0] = clip( VAR_12 - VAR_15, 0, 255 ); } else { VAR_1[-1] = ( 2*VAR_11 + VAR_10 + VAR_13 + 2 ) >> 2; VAR_1[0] = ( 2*VAR_13 + VAR_12 + VAR_11 + 2 ) >> 2; } VAR_1 += VAR_2; } } }
[ "static void FUNC_0( H264Context *VAR_0, uint8_t *VAR_1, int VAR_2, int VAR_3[4], int VAR_4 ) {", "int VAR_5, VAR_6;", "const int VAR_7 = clip( VAR_4 + VAR_0->slice_alpha_c0_offset, 0, 51 );", "const int VAR_8 = alpha_table[VAR_7];", "const int VAR_9 = beta_table[clip( VAR_4 + VAR_0->slice_beta_offset, 0, 51 )];", "for( VAR_5 = 0; VAR_5 < 4; VAR_5++ ) {", "if( VAR_3[VAR_5] == 0 ) {", "VAR_1 += 2 * VAR_2;", "continue;", "}", "for( VAR_6 = 0; VAR_6 < 2; VAR_6++ )", "{", "const uint8_t VAR_10 = VAR_1[-1];", "const uint8_t VAR_11 = VAR_1[-2];", "const uint8_t VAR_12 = VAR_1[0];", "const uint8_t VAR_13 = VAR_1[1];", "if( abs( VAR_10 - VAR_12 ) >= VAR_8 ||\nabs( VAR_11 - VAR_10 ) >= VAR_9 ||\nabs( VAR_13 - VAR_12 ) >= VAR_9 ) {", "VAR_1 += VAR_2;", "continue;", "}", "if( VAR_3[VAR_5] < 4 ) {", "const int VAR_14 = tc0_table[VAR_7][VAR_3[VAR_5] - 1] + 1;", "const int VAR_15 = clip( (((VAR_12 - VAR_10 ) << 2) + (VAR_11 - VAR_13) + 4) >> 3, -VAR_14, VAR_14 );", "VAR_1[-1] = clip( VAR_10 + VAR_15, 0, 255 );", "VAR_1[0] = clip( VAR_12 - VAR_15, 0, 255 );", "} else {", "VAR_1[-1] = ( 2*VAR_11 + VAR_10 + VAR_13 + 2 ) >> 2;", "VAR_1[0] = ( 2*VAR_13 + VAR_12 + VAR_11 + 2 ) >> 2;", "}", "VAR_1 += VAR_2;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ] ]
12,318
static void rtl8139_transfer_frame(RTL8139State *s, const uint8_t *buf, int size, int do_interrupt) { if (!size) { DEBUG_PRINT(("RTL8139: +++ empty ethernet frame\n")); return; } if (TxLoopBack == (s->TxConfig & TxLoopBack)) { DEBUG_PRINT(("RTL8139: +++ transmit loopback mode\n")); rtl8139_do_receive(s, buf, size, do_interrupt); } else { qemu_send_packet(s->vc, buf, size); } }
false
qemu
e3f5ec2b5e92706e3b807059f79b1fb5d936e567
static void rtl8139_transfer_frame(RTL8139State *s, const uint8_t *buf, int size, int do_interrupt) { if (!size) { DEBUG_PRINT(("RTL8139: +++ empty ethernet frame\n")); return; } if (TxLoopBack == (s->TxConfig & TxLoopBack)) { DEBUG_PRINT(("RTL8139: +++ transmit loopback mode\n")); rtl8139_do_receive(s, buf, size, do_interrupt); } else { qemu_send_packet(s->vc, buf, size); } }
{ "code": [], "line_no": [] }
static void FUNC_0(RTL8139State *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3) { if (!VAR_2) { DEBUG_PRINT(("RTL8139: +++ empty ethernet frame\n")); return; } if (TxLoopBack == (VAR_0->TxConfig & TxLoopBack)) { DEBUG_PRINT(("RTL8139: +++ transmit loopback mode\n")); rtl8139_do_receive(VAR_0, VAR_1, VAR_2, VAR_3); } else { qemu_send_packet(VAR_0->vc, VAR_1, VAR_2); } }
[ "static void FUNC_0(RTL8139State *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3)\n{", "if (!VAR_2)\n{", "DEBUG_PRINT((\"RTL8139: +++ empty ethernet frame\\n\"));", "return;", "}", "if (TxLoopBack == (VAR_0->TxConfig & TxLoopBack))\n{", "DEBUG_PRINT((\"RTL8139: +++ transmit loopback mode\\n\"));", "rtl8139_do_receive(VAR_0, VAR_1, VAR_2, VAR_3);", "}", "else\n{", "qemu_send_packet(VAR_0->vc, VAR_1, VAR_2);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ] ]
12,319
static void sclp_execute(SCCB *sccb, uint64_t code) { S390SCLPDevice *sdev = get_event_facility(); switch (code & SCLP_CMD_CODE_MASK) { case SCLP_CMDW_READ_SCP_INFO: case SCLP_CMDW_READ_SCP_INFO_FORCED: read_SCP_info(sccb); break; case SCLP_CMDW_READ_CPU_INFO: sclp_read_cpu_info(sccb); break; default: sdev->sclp_command_handler(sdev->ef, sccb, code); break; } }
false
qemu
a0fa2cb8ccf0b73cfd3ac01d557401a2303c0de4
static void sclp_execute(SCCB *sccb, uint64_t code) { S390SCLPDevice *sdev = get_event_facility(); switch (code & SCLP_CMD_CODE_MASK) { case SCLP_CMDW_READ_SCP_INFO: case SCLP_CMDW_READ_SCP_INFO_FORCED: read_SCP_info(sccb); break; case SCLP_CMDW_READ_CPU_INFO: sclp_read_cpu_info(sccb); break; default: sdev->sclp_command_handler(sdev->ef, sccb, code); break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(SCCB *VAR_0, uint64_t VAR_1) { S390SCLPDevice *sdev = get_event_facility(); switch (VAR_1 & SCLP_CMD_CODE_MASK) { case SCLP_CMDW_READ_SCP_INFO: case SCLP_CMDW_READ_SCP_INFO_FORCED: read_SCP_info(VAR_0); break; case SCLP_CMDW_READ_CPU_INFO: sclp_read_cpu_info(VAR_0); break; default: sdev->sclp_command_handler(sdev->ef, VAR_0, VAR_1); break; } }
[ "static void FUNC_0(SCCB *VAR_0, uint64_t VAR_1)\n{", "S390SCLPDevice *sdev = get_event_facility();", "switch (VAR_1 & SCLP_CMD_CODE_MASK) {", "case SCLP_CMDW_READ_SCP_INFO:\ncase SCLP_CMDW_READ_SCP_INFO_FORCED:\nread_SCP_info(VAR_0);", "break;", "case SCLP_CMDW_READ_CPU_INFO:\nsclp_read_cpu_info(VAR_0);", "break;", "default:\nsdev->sclp_command_handler(sdev->ef, VAR_0, VAR_1);", "break;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13, 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ] ]
12,321
static int blk_prw(BlockBackend *blk, int64_t offset, uint8_t *buf, int64_t bytes, CoroutineEntry co_entry, BdrvRequestFlags flags) { AioContext *aio_context; QEMUIOVector qiov; struct iovec iov; Coroutine *co; BlkRwCo rwco; iov = (struct iovec) { .iov_base = buf, .iov_len = bytes, }; qemu_iovec_init_external(&qiov, &iov, 1); rwco = (BlkRwCo) { .blk = blk, .offset = offset, .qiov = &qiov, .flags = flags, .ret = NOT_DONE, }; co = qemu_coroutine_create(co_entry, &rwco); qemu_coroutine_enter(co); aio_context = blk_get_aio_context(blk); while (rwco.ret == NOT_DONE) { aio_poll(aio_context, true); } return rwco.ret; }
false
qemu
88b062c2036cfd05b5111147736a08ba05ea05a9
static int blk_prw(BlockBackend *blk, int64_t offset, uint8_t *buf, int64_t bytes, CoroutineEntry co_entry, BdrvRequestFlags flags) { AioContext *aio_context; QEMUIOVector qiov; struct iovec iov; Coroutine *co; BlkRwCo rwco; iov = (struct iovec) { .iov_base = buf, .iov_len = bytes, }; qemu_iovec_init_external(&qiov, &iov, 1); rwco = (BlkRwCo) { .blk = blk, .offset = offset, .qiov = &qiov, .flags = flags, .ret = NOT_DONE, }; co = qemu_coroutine_create(co_entry, &rwco); qemu_coroutine_enter(co); aio_context = blk_get_aio_context(blk); while (rwco.ret == NOT_DONE) { aio_poll(aio_context, true); } return rwco.ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockBackend *VAR_0, int64_t VAR_1, uint8_t *VAR_2, int64_t VAR_3, CoroutineEntry VAR_4, BdrvRequestFlags VAR_5) { AioContext *aio_context; QEMUIOVector qiov; struct iovec VAR_6; Coroutine *co; BlkRwCo rwco; VAR_6 = (struct iovec) { .iov_base = VAR_2, .iov_len = VAR_3, }; qemu_iovec_init_external(&qiov, &VAR_6, 1); rwco = (BlkRwCo) { .VAR_0 = VAR_0, .VAR_1 = VAR_1, .qiov = &qiov, .VAR_5 = VAR_5, .ret = NOT_DONE, }; co = qemu_coroutine_create(VAR_4, &rwco); qemu_coroutine_enter(co); aio_context = blk_get_aio_context(VAR_0); while (rwco.ret == NOT_DONE) { aio_poll(aio_context, true); } return rwco.ret; }
[ "static int FUNC_0(BlockBackend *VAR_0, int64_t VAR_1, uint8_t *VAR_2,\nint64_t VAR_3, CoroutineEntry VAR_4,\nBdrvRequestFlags VAR_5)\n{", "AioContext *aio_context;", "QEMUIOVector qiov;", "struct iovec VAR_6;", "Coroutine *co;", "BlkRwCo rwco;", "VAR_6 = (struct iovec) {", ".iov_base = VAR_2,\n.iov_len = VAR_3,\n};", "qemu_iovec_init_external(&qiov, &VAR_6, 1);", "rwco = (BlkRwCo) {", ".VAR_0 = VAR_0,\n.VAR_1 = VAR_1,\n.qiov = &qiov,\n.VAR_5 = VAR_5,\n.ret = NOT_DONE,\n};", "co = qemu_coroutine_create(VAR_4, &rwco);", "qemu_coroutine_enter(co);", "aio_context = blk_get_aio_context(VAR_0);", "while (rwco.ret == NOT_DONE) {", "aio_poll(aio_context, true);", "}", "return rwco.ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25, 27 ], [ 29 ], [ 33 ], [ 35, 37, 39, 41, 43, 45 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ] ]
12,323
static int unix_listen_saddr(UnixSocketAddress *saddr, bool update_addr, Error **errp) { struct sockaddr_un un; int sock, fd; sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { error_setg_errno(errp, errno, "Failed to create Unix socket"); return -1; } memset(&un, 0, sizeof(un)); un.sun_family = AF_UNIX; if (saddr->path && strlen(saddr->path)) { snprintf(un.sun_path, sizeof(un.sun_path), "%s", saddr->path); } else { const char *tmpdir = getenv("TMPDIR"); tmpdir = tmpdir ? tmpdir : "/tmp"; if (snprintf(un.sun_path, sizeof(un.sun_path), "%s/qemu-socket-XXXXXX", tmpdir) >= sizeof(un.sun_path)) { error_setg_errno(errp, errno, "TMPDIR environment variable (%s) too large", tmpdir); goto err; } /* * This dummy fd usage silences the mktemp() unsecure warning. * Using mkstemp() doesn't make things more secure here * though. bind() complains about existing files, so we have * to unlink first and thus re-open the race window. The * worst case possible is bind() failing, i.e. a DoS attack. */ fd = mkstemp(un.sun_path); if (fd < 0) { error_setg_errno(errp, errno, "Failed to make a temporary socket name in %s", tmpdir); goto err; } close(fd); if (update_addr) { g_free(saddr->path); saddr->path = g_strdup(un.sun_path); } } if (unlink(un.sun_path) < 0 && errno != ENOENT) { error_setg_errno(errp, errno, "Failed to unlink socket %s", un.sun_path); goto err; } if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) { error_setg_errno(errp, errno, "Failed to bind socket to %s", un.sun_path); goto err; } if (listen(sock, 1) < 0) { error_setg_errno(errp, errno, "Failed to listen on socket"); goto err; } return sock; err: closesocket(sock); return -1; }
false
qemu
ad9579aaa16d5b385922d49edac2c96c79bcfb62
static int unix_listen_saddr(UnixSocketAddress *saddr, bool update_addr, Error **errp) { struct sockaddr_un un; int sock, fd; sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { error_setg_errno(errp, errno, "Failed to create Unix socket"); return -1; } memset(&un, 0, sizeof(un)); un.sun_family = AF_UNIX; if (saddr->path && strlen(saddr->path)) { snprintf(un.sun_path, sizeof(un.sun_path), "%s", saddr->path); } else { const char *tmpdir = getenv("TMPDIR"); tmpdir = tmpdir ? tmpdir : "/tmp"; if (snprintf(un.sun_path, sizeof(un.sun_path), "%s/qemu-socket-XXXXXX", tmpdir) >= sizeof(un.sun_path)) { error_setg_errno(errp, errno, "TMPDIR environment variable (%s) too large", tmpdir); goto err; } fd = mkstemp(un.sun_path); if (fd < 0) { error_setg_errno(errp, errno, "Failed to make a temporary socket name in %s", tmpdir); goto err; } close(fd); if (update_addr) { g_free(saddr->path); saddr->path = g_strdup(un.sun_path); } } if (unlink(un.sun_path) < 0 && errno != ENOENT) { error_setg_errno(errp, errno, "Failed to unlink socket %s", un.sun_path); goto err; } if (bind(sock, (struct sockaddr*) &un, sizeof(un)) < 0) { error_setg_errno(errp, errno, "Failed to bind socket to %s", un.sun_path); goto err; } if (listen(sock, 1) < 0) { error_setg_errno(errp, errno, "Failed to listen on socket"); goto err; } return sock; err: closesocket(sock); return -1; }
{ "code": [], "line_no": [] }
static int FUNC_0(UnixSocketAddress *VAR_0, bool VAR_1, Error **VAR_2) { struct sockaddr_un VAR_3; int VAR_4, VAR_5; VAR_4 = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (VAR_4 < 0) { error_setg_errno(VAR_2, errno, "Failed to create Unix socket"); return -1; } memset(&VAR_3, 0, sizeof(VAR_3)); VAR_3.sun_family = AF_UNIX; if (VAR_0->path && strlen(VAR_0->path)) { snprintf(VAR_3.sun_path, sizeof(VAR_3.sun_path), "%s", VAR_0->path); } else { const char *VAR_6 = getenv("TMPDIR"); VAR_6 = VAR_6 ? VAR_6 : "/tmp"; if (snprintf(VAR_3.sun_path, sizeof(VAR_3.sun_path), "%s/qemu-socket-XXXXXX", VAR_6) >= sizeof(VAR_3.sun_path)) { error_setg_errno(VAR_2, errno, "TMPDIR environment variable (%s) too large", VAR_6); goto err; } VAR_5 = mkstemp(VAR_3.sun_path); if (VAR_5 < 0) { error_setg_errno(VAR_2, errno, "Failed to make a temporary socket name in %s", VAR_6); goto err; } close(VAR_5); if (VAR_1) { g_free(VAR_0->path); VAR_0->path = g_strdup(VAR_3.sun_path); } } if (unlink(VAR_3.sun_path) < 0 && errno != ENOENT) { error_setg_errno(VAR_2, errno, "Failed to unlink socket %s", VAR_3.sun_path); goto err; } if (bind(VAR_4, (struct sockaddr*) &VAR_3, sizeof(VAR_3)) < 0) { error_setg_errno(VAR_2, errno, "Failed to bind socket to %s", VAR_3.sun_path); goto err; } if (listen(VAR_4, 1) < 0) { error_setg_errno(VAR_2, errno, "Failed to listen on socket"); goto err; } return VAR_4; err: closesocket(VAR_4); return -1; }
[ "static int FUNC_0(UnixSocketAddress *VAR_0,\nbool VAR_1,\nError **VAR_2)\n{", "struct sockaddr_un VAR_3;", "int VAR_4, VAR_5;", "VAR_4 = qemu_socket(PF_UNIX, SOCK_STREAM, 0);", "if (VAR_4 < 0) {", "error_setg_errno(VAR_2, errno, \"Failed to create Unix socket\");", "return -1;", "}", "memset(&VAR_3, 0, sizeof(VAR_3));", "VAR_3.sun_family = AF_UNIX;", "if (VAR_0->path && strlen(VAR_0->path)) {", "snprintf(VAR_3.sun_path, sizeof(VAR_3.sun_path), \"%s\", VAR_0->path);", "} else {", "const char *VAR_6 = getenv(\"TMPDIR\");", "VAR_6 = VAR_6 ? VAR_6 : \"/tmp\";", "if (snprintf(VAR_3.sun_path, sizeof(VAR_3.sun_path), \"%s/qemu-socket-XXXXXX\",\nVAR_6) >= sizeof(VAR_3.sun_path)) {", "error_setg_errno(VAR_2, errno,\n\"TMPDIR environment variable (%s) too large\", VAR_6);", "goto err;", "}", "VAR_5 = mkstemp(VAR_3.sun_path);", "if (VAR_5 < 0) {", "error_setg_errno(VAR_2, errno,\n\"Failed to make a temporary socket name in %s\", VAR_6);", "goto err;", "}", "close(VAR_5);", "if (VAR_1) {", "g_free(VAR_0->path);", "VAR_0->path = g_strdup(VAR_3.sun_path);", "}", "}", "if (unlink(VAR_3.sun_path) < 0 && errno != ENOENT) {", "error_setg_errno(VAR_2, errno,\n\"Failed to unlink socket %s\", VAR_3.sun_path);", "goto err;", "}", "if (bind(VAR_4, (struct sockaddr*) &VAR_3, sizeof(VAR_3)) < 0) {", "error_setg_errno(VAR_2, errno, \"Failed to bind socket to %s\", VAR_3.sun_path);", "goto err;", "}", "if (listen(VAR_4, 1) < 0) {", "error_setg_errno(VAR_2, errno, \"Failed to listen on socket\");", "goto err;", "}", "return VAR_4;", "err:\nclosesocket(VAR_4);", "return -1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 127, 129 ], [ 131 ], [ 133 ] ]
12,324
static void mirror_start_job(const char *job_id, BlockDriverState *bs, BlockDriverState *target, const char *replaces, int64_t speed, uint32_t granularity, int64_t buf_size, BlockMirrorBackingMode backing_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, bool unmap, BlockCompletionFunc *cb, void *opaque, Error **errp, const BlockJobDriver *driver, bool is_none_mode, BlockDriverState *base) { MirrorBlockJob *s; if (granularity == 0) { granularity = bdrv_get_default_bitmap_granularity(target); } assert ((granularity & (granularity - 1)) == 0); if (buf_size < 0) { error_setg(errp, "Invalid parameter 'buf-size'"); return; } if (buf_size == 0) { buf_size = DEFAULT_MIRROR_BUF_SIZE; } s = block_job_create(job_id, driver, bs, speed, cb, opaque, errp); if (!s) { return; } s->target = blk_new(); blk_insert_bs(s->target, target); s->replaces = g_strdup(replaces); s->on_source_error = on_source_error; s->on_target_error = on_target_error; s->is_none_mode = is_none_mode; s->backing_mode = backing_mode; s->base = base; s->granularity = granularity; s->buf_size = ROUND_UP(buf_size, granularity); s->unmap = unmap; s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp); if (!s->dirty_bitmap) { g_free(s->replaces); blk_unref(s->target); block_job_unref(&s->common); return; } bdrv_op_block_all(target, s->common.blocker); s->common.co = qemu_coroutine_create(mirror_run, s); trace_mirror_start(bs, s, s->common.co, opaque); qemu_coroutine_enter(s->common.co); }
false
qemu
b49f7ead8d222bcb8df0388f3177002f3e33d046
static void mirror_start_job(const char *job_id, BlockDriverState *bs, BlockDriverState *target, const char *replaces, int64_t speed, uint32_t granularity, int64_t buf_size, BlockMirrorBackingMode backing_mode, BlockdevOnError on_source_error, BlockdevOnError on_target_error, bool unmap, BlockCompletionFunc *cb, void *opaque, Error **errp, const BlockJobDriver *driver, bool is_none_mode, BlockDriverState *base) { MirrorBlockJob *s; if (granularity == 0) { granularity = bdrv_get_default_bitmap_granularity(target); } assert ((granularity & (granularity - 1)) == 0); if (buf_size < 0) { error_setg(errp, "Invalid parameter 'buf-size'"); return; } if (buf_size == 0) { buf_size = DEFAULT_MIRROR_BUF_SIZE; } s = block_job_create(job_id, driver, bs, speed, cb, opaque, errp); if (!s) { return; } s->target = blk_new(); blk_insert_bs(s->target, target); s->replaces = g_strdup(replaces); s->on_source_error = on_source_error; s->on_target_error = on_target_error; s->is_none_mode = is_none_mode; s->backing_mode = backing_mode; s->base = base; s->granularity = granularity; s->buf_size = ROUND_UP(buf_size, granularity); s->unmap = unmap; s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp); if (!s->dirty_bitmap) { g_free(s->replaces); blk_unref(s->target); block_job_unref(&s->common); return; } bdrv_op_block_all(target, s->common.blocker); s->common.co = qemu_coroutine_create(mirror_run, s); trace_mirror_start(bs, s, s->common.co, opaque); qemu_coroutine_enter(s->common.co); }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0, BlockDriverState *VAR_1, BlockDriverState *VAR_2, const char *VAR_3, int64_t VAR_4, uint32_t VAR_5, int64_t VAR_6, BlockMirrorBackingMode VAR_7, BlockdevOnError VAR_8, BlockdevOnError VAR_9, bool VAR_10, BlockCompletionFunc *VAR_11, void *VAR_12, Error **VAR_13, const BlockJobDriver *VAR_14, bool VAR_15, BlockDriverState *VAR_16) { MirrorBlockJob *s; if (VAR_5 == 0) { VAR_5 = bdrv_get_default_bitmap_granularity(VAR_2); } assert ((VAR_5 & (VAR_5 - 1)) == 0); if (VAR_6 < 0) { error_setg(VAR_13, "Invalid parameter 'buf-size'"); return; } if (VAR_6 == 0) { VAR_6 = DEFAULT_MIRROR_BUF_SIZE; } s = block_job_create(VAR_0, VAR_14, VAR_1, VAR_4, VAR_11, VAR_12, VAR_13); if (!s) { return; } s->VAR_2 = blk_new(); blk_insert_bs(s->VAR_2, VAR_2); s->VAR_3 = g_strdup(VAR_3); s->VAR_8 = VAR_8; s->VAR_9 = VAR_9; s->VAR_15 = VAR_15; s->VAR_7 = VAR_7; s->VAR_16 = VAR_16; s->VAR_5 = VAR_5; s->VAR_6 = ROUND_UP(VAR_6, VAR_5); s->VAR_10 = VAR_10; s->dirty_bitmap = bdrv_create_dirty_bitmap(VAR_1, VAR_5, NULL, VAR_13); if (!s->dirty_bitmap) { g_free(s->VAR_3); blk_unref(s->VAR_2); block_job_unref(&s->common); return; } bdrv_op_block_all(VAR_2, s->common.blocker); s->common.co = qemu_coroutine_create(mirror_run, s); trace_mirror_start(VAR_1, s, s->common.co, VAR_12); qemu_coroutine_enter(s->common.co); }
[ "static void FUNC_0(const char *VAR_0, BlockDriverState *VAR_1,\nBlockDriverState *VAR_2, const char *VAR_3,\nint64_t VAR_4, uint32_t VAR_5,\nint64_t VAR_6,\nBlockMirrorBackingMode VAR_7,\nBlockdevOnError VAR_8,\nBlockdevOnError VAR_9,\nbool VAR_10,\nBlockCompletionFunc *VAR_11,\nvoid *VAR_12, Error **VAR_13,\nconst BlockJobDriver *VAR_14,\nbool VAR_15, BlockDriverState *VAR_16)\n{", "MirrorBlockJob *s;", "if (VAR_5 == 0) {", "VAR_5 = bdrv_get_default_bitmap_granularity(VAR_2);", "}", "assert ((VAR_5 & (VAR_5 - 1)) == 0);", "if (VAR_6 < 0) {", "error_setg(VAR_13, \"Invalid parameter 'buf-size'\");", "return;", "}", "if (VAR_6 == 0) {", "VAR_6 = DEFAULT_MIRROR_BUF_SIZE;", "}", "s = block_job_create(VAR_0, VAR_14, VAR_1, VAR_4, VAR_11, VAR_12, VAR_13);", "if (!s) {", "return;", "}", "s->VAR_2 = blk_new();", "blk_insert_bs(s->VAR_2, VAR_2);", "s->VAR_3 = g_strdup(VAR_3);", "s->VAR_8 = VAR_8;", "s->VAR_9 = VAR_9;", "s->VAR_15 = VAR_15;", "s->VAR_7 = VAR_7;", "s->VAR_16 = VAR_16;", "s->VAR_5 = VAR_5;", "s->VAR_6 = ROUND_UP(VAR_6, VAR_5);", "s->VAR_10 = VAR_10;", "s->dirty_bitmap = bdrv_create_dirty_bitmap(VAR_1, VAR_5, NULL, VAR_13);", "if (!s->dirty_bitmap) {", "g_free(s->VAR_3);", "blk_unref(s->VAR_2);", "block_job_unref(&s->common);", "return;", "}", "bdrv_op_block_all(VAR_2, s->common.blocker);", "s->common.co = qemu_coroutine_create(mirror_run, s);", "trace_mirror_start(VAR_1, s, s->common.co, VAR_12);", "qemu_coroutine_enter(s->common.co);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ] ]
12,327
int RENAME(swri_resample)(ResampleContext *c, DELEM *dst, const DELEM *src, int *consumed, int src_size, int dst_size, int update_ctx){ int dst_index, i; int index= c->index; int frac= c->frac; int dst_incr_frac= c->dst_incr % c->src_incr; int dst_incr= c->dst_incr / c->src_incr; av_assert1(c->filter_shift == FILTER_SHIFT); av_assert1(c->felem_size == sizeof(FELEM)); if (c->filter_length == 1 && c->phase_shift == 0) { int64_t index2= (1LL<<32)*c->frac/c->src_incr + (1LL<<32)*index; int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; int new_size = (src_size * (int64_t)c->src_incr - frac + c->dst_incr - 1) / c->dst_incr; dst_size= FFMIN(dst_size, new_size); for(dst_index=0; dst_index < dst_size; dst_index++){ dst[dst_index] = src[index2>>32]; index2 += incr; } index += dst_index * dst_incr; index += (frac + dst_index * (int64_t)dst_incr_frac) / c->src_incr; frac = (frac + dst_index * (int64_t)dst_incr_frac) % c->src_incr; av_assert2(index >= 0); *consumed= index; index = 0; } else if (index >= 0) { int64_t end_index = (1LL + src_size - c->filter_length) << c->phase_shift; int64_t delta_frac = (end_index - index) * c->src_incr - c->frac; int delta_n = (delta_frac + c->dst_incr - 1) / c->dst_incr; int n = FFMIN(dst_size, delta_n); int sample_index; if (!c->linear) { sample_index = index >> c->phase_shift; index &= c->phase_mask; for (dst_index = 0; dst_index < n; dst_index++) { FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; #ifdef COMMON_CORE COMMON_CORE #else FELEM2 val=0; for (i = 0; i < c->filter_length; i++) { val += src[sample_index + i] * (FELEM2)filter[i]; } OUT(dst[dst_index], val); #endif frac += dst_incr_frac; index += dst_incr; if (frac >= c->src_incr) { frac -= c->src_incr; index++; } sample_index += index >> c->phase_shift; index &= c->phase_mask; } } else { sample_index = index >> c->phase_shift; index &= c->phase_mask; for (dst_index = 0; dst_index < n; dst_index++) { FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; FELEM2 val=0, v2 = 0; #ifdef LINEAR_CORE LINEAR_CORE #else for (i = 0; i < c->filter_length; i++) { val += src[sample_index + i] * (FELEM2)filter[i]; v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc]; } #endif val += (v2 - val) * (FELEML) frac / c->src_incr; OUT(dst[dst_index], val); frac += dst_incr_frac; index += dst_incr; if (frac >= c->src_incr) { frac -= c->src_incr; index++; } sample_index += index >> c->phase_shift; index &= c->phase_mask; } } *consumed = sample_index; } else { int sample_index = 0; for(dst_index=0; dst_index < dst_size; dst_index++){ FELEM *filter; FELEM2 val=0; sample_index += index >> c->phase_shift; index &= c->phase_mask; filter = ((FELEM*)c->filter_bank) + c->filter_alloc*index; if(sample_index + c->filter_length > src_size || -sample_index >= src_size){ break; }else if(sample_index < 0){ for(i=0; i<c->filter_length; i++) val += src[FFABS(sample_index + i)] * (FELEM2)filter[i]; OUT(dst[dst_index], val); }else if(c->linear){ FELEM2 v2=0; #ifdef LINEAR_CORE LINEAR_CORE #else for(i=0; i<c->filter_length; i++){ val += src[sample_index + i] * (FELEM2)filter[i]; v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc]; } #endif val+=(v2-val)*(FELEML)frac / c->src_incr; OUT(dst[dst_index], val); }else{ #ifdef COMMON_CORE COMMON_CORE #else for(i=0; i<c->filter_length; i++){ val += src[sample_index + i] * (FELEM2)filter[i]; } OUT(dst[dst_index], val); #endif } frac += dst_incr_frac; index += dst_incr; if(frac >= c->src_incr){ frac -= c->src_incr; index++; } } *consumed= FFMAX(sample_index, 0); index += FFMIN(sample_index, 0) << c->phase_shift; } if(update_ctx){ c->frac= frac; c->index= index; } return dst_index; }
false
FFmpeg
b785c62681a0a5a330b065e0754d27a313c44c8e
int RENAME(swri_resample)(ResampleContext *c, DELEM *dst, const DELEM *src, int *consumed, int src_size, int dst_size, int update_ctx){ int dst_index, i; int index= c->index; int frac= c->frac; int dst_incr_frac= c->dst_incr % c->src_incr; int dst_incr= c->dst_incr / c->src_incr; av_assert1(c->filter_shift == FILTER_SHIFT); av_assert1(c->felem_size == sizeof(FELEM)); if (c->filter_length == 1 && c->phase_shift == 0) { int64_t index2= (1LL<<32)*c->frac/c->src_incr + (1LL<<32)*index; int64_t incr= (1LL<<32) * c->dst_incr / c->src_incr; int new_size = (src_size * (int64_t)c->src_incr - frac + c->dst_incr - 1) / c->dst_incr; dst_size= FFMIN(dst_size, new_size); for(dst_index=0; dst_index < dst_size; dst_index++){ dst[dst_index] = src[index2>>32]; index2 += incr; } index += dst_index * dst_incr; index += (frac + dst_index * (int64_t)dst_incr_frac) / c->src_incr; frac = (frac + dst_index * (int64_t)dst_incr_frac) % c->src_incr; av_assert2(index >= 0); *consumed= index; index = 0; } else if (index >= 0) { int64_t end_index = (1LL + src_size - c->filter_length) << c->phase_shift; int64_t delta_frac = (end_index - index) * c->src_incr - c->frac; int delta_n = (delta_frac + c->dst_incr - 1) / c->dst_incr; int n = FFMIN(dst_size, delta_n); int sample_index; if (!c->linear) { sample_index = index >> c->phase_shift; index &= c->phase_mask; for (dst_index = 0; dst_index < n; dst_index++) { FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; #ifdef COMMON_CORE COMMON_CORE #else FELEM2 val=0; for (i = 0; i < c->filter_length; i++) { val += src[sample_index + i] * (FELEM2)filter[i]; } OUT(dst[dst_index], val); #endif frac += dst_incr_frac; index += dst_incr; if (frac >= c->src_incr) { frac -= c->src_incr; index++; } sample_index += index >> c->phase_shift; index &= c->phase_mask; } } else { sample_index = index >> c->phase_shift; index &= c->phase_mask; for (dst_index = 0; dst_index < n; dst_index++) { FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * index; FELEM2 val=0, v2 = 0; #ifdef LINEAR_CORE LINEAR_CORE #else for (i = 0; i < c->filter_length; i++) { val += src[sample_index + i] * (FELEM2)filter[i]; v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc]; } #endif val += (v2 - val) * (FELEML) frac / c->src_incr; OUT(dst[dst_index], val); frac += dst_incr_frac; index += dst_incr; if (frac >= c->src_incr) { frac -= c->src_incr; index++; } sample_index += index >> c->phase_shift; index &= c->phase_mask; } } *consumed = sample_index; } else { int sample_index = 0; for(dst_index=0; dst_index < dst_size; dst_index++){ FELEM *filter; FELEM2 val=0; sample_index += index >> c->phase_shift; index &= c->phase_mask; filter = ((FELEM*)c->filter_bank) + c->filter_alloc*index; if(sample_index + c->filter_length > src_size || -sample_index >= src_size){ break; }else if(sample_index < 0){ for(i=0; i<c->filter_length; i++) val += src[FFABS(sample_index + i)] * (FELEM2)filter[i]; OUT(dst[dst_index], val); }else if(c->linear){ FELEM2 v2=0; #ifdef LINEAR_CORE LINEAR_CORE #else for(i=0; i<c->filter_length; i++){ val += src[sample_index + i] * (FELEM2)filter[i]; v2 += src[sample_index + i] * (FELEM2)filter[i + c->filter_alloc]; } #endif val+=(v2-val)*(FELEML)frac / c->src_incr; OUT(dst[dst_index], val); }else{ #ifdef COMMON_CORE COMMON_CORE #else for(i=0; i<c->filter_length; i++){ val += src[sample_index + i] * (FELEM2)filter[i]; } OUT(dst[dst_index], val); #endif } frac += dst_incr_frac; index += dst_incr; if(frac >= c->src_incr){ frac -= c->src_incr; index++; } } *consumed= FFMAX(sample_index, 0); index += FFMIN(sample_index, 0) << c->phase_shift; } if(update_ctx){ c->frac= frac; c->index= index; } return dst_index; }
{ "code": [], "line_no": [] }
int FUNC_0(swri_resample)(ResampleContext *c, DELEM *dst, const DELEM *src, int *consumed, int src_size, int dst_size, int update_ctx){ int VAR_0, VAR_1; int VAR_2= c->VAR_2; int VAR_3= c->VAR_3; int VAR_4= c->VAR_5 % c->src_incr; int VAR_5= c->VAR_5 / c->src_incr; av_assert1(c->filter_shift == FILTER_SHIFT); av_assert1(c->felem_size == sizeof(FELEM)); if (c->filter_length == 1 && c->phase_shift == 0) { int64_t index2= (1LL<<32)*c->VAR_3/c->src_incr + (1LL<<32)*VAR_2; int64_t incr= (1LL<<32) * c->VAR_5 / c->src_incr; int VAR_6 = (src_size * (int64_t)c->src_incr - VAR_3 + c->VAR_5 - 1) / c->VAR_5; dst_size= FFMIN(dst_size, VAR_6); for(VAR_0=0; VAR_0 < dst_size; VAR_0++){ dst[VAR_0] = src[index2>>32]; index2 += incr; } VAR_2 += VAR_0 * VAR_5; VAR_2 += (VAR_3 + VAR_0 * (int64_t)VAR_4) / c->src_incr; VAR_3 = (VAR_3 + VAR_0 * (int64_t)VAR_4) % c->src_incr; av_assert2(VAR_2 >= 0); *consumed= VAR_2; VAR_2 = 0; } else if (VAR_2 >= 0) { int64_t end_index = (1LL + src_size - c->filter_length) << c->phase_shift; int64_t delta_frac = (end_index - VAR_2) * c->src_incr - c->VAR_3; int VAR_7 = (delta_frac + c->VAR_5 - 1) / c->VAR_5; int VAR_8 = FFMIN(dst_size, VAR_7); int VAR_10; if (!c->linear) { VAR_10 = VAR_2 >> c->phase_shift; VAR_2 &= c->phase_mask; for (VAR_0 = 0; VAR_0 < VAR_8; VAR_0++) { FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * VAR_2; #ifdef COMMON_CORE COMMON_CORE #else FELEM2 val=0; for (VAR_1 = 0; VAR_1 < c->filter_length; VAR_1++) { val += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1]; } OUT(dst[VAR_0], val); #endif VAR_3 += VAR_4; VAR_2 += VAR_5; if (VAR_3 >= c->src_incr) { VAR_3 -= c->src_incr; VAR_2++; } VAR_10 += VAR_2 >> c->phase_shift; VAR_2 &= c->phase_mask; } } else { VAR_10 = VAR_2 >> c->phase_shift; VAR_2 &= c->phase_mask; for (VAR_0 = 0; VAR_0 < VAR_8; VAR_0++) { FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * VAR_2; FELEM2 val=0, v2 = 0; #ifdef LINEAR_CORE LINEAR_CORE #else for (VAR_1 = 0; VAR_1 < c->filter_length; VAR_1++) { val += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1]; v2 += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1 + c->filter_alloc]; } #endif val += (v2 - val) * (FELEML) VAR_3 / c->src_incr; OUT(dst[VAR_0], val); VAR_3 += VAR_4; VAR_2 += VAR_5; if (VAR_3 >= c->src_incr) { VAR_3 -= c->src_incr; VAR_2++; } VAR_10 += VAR_2 >> c->phase_shift; VAR_2 &= c->phase_mask; } } *consumed = VAR_10; } else { int VAR_10 = 0; for(VAR_0=0; VAR_0 < dst_size; VAR_0++){ FELEM *filter; FELEM2 val=0; VAR_10 += VAR_2 >> c->phase_shift; VAR_2 &= c->phase_mask; filter = ((FELEM*)c->filter_bank) + c->filter_alloc*VAR_2; if(VAR_10 + c->filter_length > src_size || -VAR_10 >= src_size){ break; }else if(VAR_10 < 0){ for(VAR_1=0; VAR_1<c->filter_length; VAR_1++) val += src[FFABS(VAR_10 + VAR_1)] * (FELEM2)filter[VAR_1]; OUT(dst[VAR_0], val); }else if(c->linear){ FELEM2 v2=0; #ifdef LINEAR_CORE LINEAR_CORE #else for(VAR_1=0; VAR_1<c->filter_length; VAR_1++){ val += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1]; v2 += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1 + c->filter_alloc]; } #endif val+=(v2-val)*(FELEML)VAR_3 / c->src_incr; OUT(dst[VAR_0], val); }else{ #ifdef COMMON_CORE COMMON_CORE #else for(VAR_1=0; VAR_1<c->filter_length; VAR_1++){ val += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1]; } OUT(dst[VAR_0], val); #endif } VAR_3 += VAR_4; VAR_2 += VAR_5; if(VAR_3 >= c->src_incr){ VAR_3 -= c->src_incr; VAR_2++; } } *consumed= FFMAX(VAR_10, 0); VAR_2 += FFMIN(VAR_10, 0) << c->phase_shift; } if(update_ctx){ c->VAR_3= VAR_3; c->VAR_2= VAR_2; } return VAR_0; }
[ "int FUNC_0(swri_resample)(ResampleContext *c, DELEM *dst, const DELEM *src, int *consumed, int src_size, int dst_size, int update_ctx){", "int VAR_0, VAR_1;", "int VAR_2= c->VAR_2;", "int VAR_3= c->VAR_3;", "int VAR_4= c->VAR_5 % c->src_incr;", "int VAR_5= c->VAR_5 / c->src_incr;", "av_assert1(c->filter_shift == FILTER_SHIFT);", "av_assert1(c->felem_size == sizeof(FELEM));", "if (c->filter_length == 1 && c->phase_shift == 0) {", "int64_t index2= (1LL<<32)*c->VAR_3/c->src_incr + (1LL<<32)*VAR_2;", "int64_t incr= (1LL<<32) * c->VAR_5 / c->src_incr;", "int VAR_6 = (src_size * (int64_t)c->src_incr - VAR_3 + c->VAR_5 - 1) / c->VAR_5;", "dst_size= FFMIN(dst_size, VAR_6);", "for(VAR_0=0; VAR_0 < dst_size; VAR_0++){", "dst[VAR_0] = src[index2>>32];", "index2 += incr;", "}", "VAR_2 += VAR_0 * VAR_5;", "VAR_2 += (VAR_3 + VAR_0 * (int64_t)VAR_4) / c->src_incr;", "VAR_3 = (VAR_3 + VAR_0 * (int64_t)VAR_4) % c->src_incr;", "av_assert2(VAR_2 >= 0);", "*consumed= VAR_2;", "VAR_2 = 0;", "} else if (VAR_2 >= 0) {", "int64_t end_index = (1LL + src_size - c->filter_length) << c->phase_shift;", "int64_t delta_frac = (end_index - VAR_2) * c->src_incr - c->VAR_3;", "int VAR_7 = (delta_frac + c->VAR_5 - 1) / c->VAR_5;", "int VAR_8 = FFMIN(dst_size, VAR_7);", "int VAR_10;", "if (!c->linear) {", "VAR_10 = VAR_2 >> c->phase_shift;", "VAR_2 &= c->phase_mask;", "for (VAR_0 = 0; VAR_0 < VAR_8; VAR_0++) {", "FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * VAR_2;", "#ifdef COMMON_CORE\nCOMMON_CORE\n#else\nFELEM2 val=0;", "for (VAR_1 = 0; VAR_1 < c->filter_length; VAR_1++) {", "val += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1];", "}", "OUT(dst[VAR_0], val);", "#endif\nVAR_3 += VAR_4;", "VAR_2 += VAR_5;", "if (VAR_3 >= c->src_incr) {", "VAR_3 -= c->src_incr;", "VAR_2++;", "}", "VAR_10 += VAR_2 >> c->phase_shift;", "VAR_2 &= c->phase_mask;", "}", "} else {", "VAR_10 = VAR_2 >> c->phase_shift;", "VAR_2 &= c->phase_mask;", "for (VAR_0 = 0; VAR_0 < VAR_8; VAR_0++) {", "FELEM *filter = ((FELEM *) c->filter_bank) + c->filter_alloc * VAR_2;", "FELEM2 val=0, v2 = 0;", "#ifdef LINEAR_CORE\nLINEAR_CORE\n#else\nfor (VAR_1 = 0; VAR_1 < c->filter_length; VAR_1++) {", "val += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1];", "v2 += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1 + c->filter_alloc];", "}", "#endif\nval += (v2 - val) * (FELEML) VAR_3 / c->src_incr;", "OUT(dst[VAR_0], val);", "VAR_3 += VAR_4;", "VAR_2 += VAR_5;", "if (VAR_3 >= c->src_incr) {", "VAR_3 -= c->src_incr;", "VAR_2++;", "}", "VAR_10 += VAR_2 >> c->phase_shift;", "VAR_2 &= c->phase_mask;", "}", "}", "*consumed = VAR_10;", "} else {", "int VAR_10 = 0;", "for(VAR_0=0; VAR_0 < dst_size; VAR_0++){", "FELEM *filter;", "FELEM2 val=0;", "VAR_10 += VAR_2 >> c->phase_shift;", "VAR_2 &= c->phase_mask;", "filter = ((FELEM*)c->filter_bank) + c->filter_alloc*VAR_2;", "if(VAR_10 + c->filter_length > src_size || -VAR_10 >= src_size){", "break;", "}else if(VAR_10 < 0){", "for(VAR_1=0; VAR_1<c->filter_length; VAR_1++)", "val += src[FFABS(VAR_10 + VAR_1)] * (FELEM2)filter[VAR_1];", "OUT(dst[VAR_0], val);", "}else if(c->linear){", "FELEM2 v2=0;", "#ifdef LINEAR_CORE\nLINEAR_CORE\n#else\nfor(VAR_1=0; VAR_1<c->filter_length; VAR_1++){", "val += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1];", "v2 += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1 + c->filter_alloc];", "}", "#endif\nval+=(v2-val)*(FELEML)VAR_3 / c->src_incr;", "OUT(dst[VAR_0], val);", "}else{", "#ifdef COMMON_CORE\nCOMMON_CORE\n#else\nfor(VAR_1=0; VAR_1<c->filter_length; VAR_1++){", "val += src[VAR_10 + VAR_1] * (FELEM2)filter[VAR_1];", "}", "OUT(dst[VAR_0], val);", "#endif\n}", "VAR_3 += VAR_4;", "VAR_2 += VAR_5;", "if(VAR_3 >= c->src_incr){", "VAR_3 -= c->src_incr;", "VAR_2++;", "}", "}", "*consumed= FFMAX(VAR_10, 0);", "VAR_2 += FFMIN(VAR_10, 0) << c->phase_shift;", "}", "if(update_ctx){", "c->VAR_3= VAR_3;", "c->VAR_2= VAR_2;", "}", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81, 83, 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133, 135, 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215, 217, 219, 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237, 239, 241, 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251, 253 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289 ], [ 291 ] ]
12,328
static uint32_t gic_dist_readb(void *opaque, hwaddr offset) { GICState *s = (GICState *)opaque; uint32_t res; int irq; int i; int cpu; int cm; int mask; cpu = gic_get_current_cpu(s); cm = 1 << cpu; if (offset < 0x100) { if (offset == 0) return s->enabled; if (offset == 4) return ((s->num_irq / 32) - 1) | ((NUM_CPU(s) - 1) << 5); if (offset < 0x08) return 0; if (offset >= 0x80) { /* Interrupt Security , RAZ/WI */ return 0; } goto bad_reg; } else if (offset < 0x200) { /* Interrupt Set/Clear Enable. */ if (offset < 0x180) irq = (offset - 0x100) * 8; else irq = (offset - 0x180) * 8; irq += GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; for (i = 0; i < 8; i++) { if (GIC_TEST_ENABLED(irq + i, cm)) { res |= (1 << i); } } } else if (offset < 0x300) { /* Interrupt Set/Clear Pending. */ if (offset < 0x280) irq = (offset - 0x200) * 8; else irq = (offset - 0x280) * 8; irq += GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; mask = (irq < GIC_INTERNAL) ? cm : ALL_CPU_MASK; for (i = 0; i < 8; i++) { if (GIC_TEST_PENDING(irq + i, mask)) { res |= (1 << i); } } } else if (offset < 0x400) { /* Interrupt Active. */ irq = (offset - 0x300) * 8 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; mask = (irq < GIC_INTERNAL) ? cm : ALL_CPU_MASK; for (i = 0; i < 8; i++) { if (GIC_TEST_ACTIVE(irq + i, mask)) { res |= (1 << i); } } } else if (offset < 0x800) { /* Interrupt Priority. */ irq = (offset - 0x400) + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = GIC_GET_PRIORITY(irq, cpu); } else if (offset < 0xc00) { /* Interrupt CPU Target. */ if (s->num_cpu == 1 && s->revision != REV_11MPCORE) { /* For uniprocessor GICs these RAZ/WI */ res = 0; } else { irq = (offset - 0x800) + GIC_BASE_IRQ; if (irq >= s->num_irq) { goto bad_reg; } if (irq >= 29 && irq <= 31) { res = cm; } else { res = GIC_TARGET(irq); } } } else if (offset < 0xf00) { /* Interrupt Configuration. */ irq = (offset - 0xc00) * 2 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; for (i = 0; i < 4; i++) { if (GIC_TEST_MODEL(irq + i)) res |= (1 << (i * 2)); if (GIC_TEST_EDGE_TRIGGER(irq + i)) res |= (2 << (i * 2)); } } else if (offset < 0xfe0) { goto bad_reg; } else /* offset >= 0xfe0 */ { if (offset & 3) { res = 0; } else { res = gic_id[(offset - 0xfe0) >> 2]; } } return res; bad_reg: qemu_log_mask(LOG_GUEST_ERROR, "gic_dist_readb: Bad offset %x\n", (int)offset); return 0; }
false
qemu
8d999995e45c1002aa11f269c98f2e93e6f8c42a
static uint32_t gic_dist_readb(void *opaque, hwaddr offset) { GICState *s = (GICState *)opaque; uint32_t res; int irq; int i; int cpu; int cm; int mask; cpu = gic_get_current_cpu(s); cm = 1 << cpu; if (offset < 0x100) { if (offset == 0) return s->enabled; if (offset == 4) return ((s->num_irq / 32) - 1) | ((NUM_CPU(s) - 1) << 5); if (offset < 0x08) return 0; if (offset >= 0x80) { return 0; } goto bad_reg; } else if (offset < 0x200) { if (offset < 0x180) irq = (offset - 0x100) * 8; else irq = (offset - 0x180) * 8; irq += GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; for (i = 0; i < 8; i++) { if (GIC_TEST_ENABLED(irq + i, cm)) { res |= (1 << i); } } } else if (offset < 0x300) { if (offset < 0x280) irq = (offset - 0x200) * 8; else irq = (offset - 0x280) * 8; irq += GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; mask = (irq < GIC_INTERNAL) ? cm : ALL_CPU_MASK; for (i = 0; i < 8; i++) { if (GIC_TEST_PENDING(irq + i, mask)) { res |= (1 << i); } } } else if (offset < 0x400) { irq = (offset - 0x300) * 8 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; mask = (irq < GIC_INTERNAL) ? cm : ALL_CPU_MASK; for (i = 0; i < 8; i++) { if (GIC_TEST_ACTIVE(irq + i, mask)) { res |= (1 << i); } } } else if (offset < 0x800) { irq = (offset - 0x400) + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = GIC_GET_PRIORITY(irq, cpu); } else if (offset < 0xc00) { if (s->num_cpu == 1 && s->revision != REV_11MPCORE) { res = 0; } else { irq = (offset - 0x800) + GIC_BASE_IRQ; if (irq >= s->num_irq) { goto bad_reg; } if (irq >= 29 && irq <= 31) { res = cm; } else { res = GIC_TARGET(irq); } } } else if (offset < 0xf00) { irq = (offset - 0xc00) * 2 + GIC_BASE_IRQ; if (irq >= s->num_irq) goto bad_reg; res = 0; for (i = 0; i < 4; i++) { if (GIC_TEST_MODEL(irq + i)) res |= (1 << (i * 2)); if (GIC_TEST_EDGE_TRIGGER(irq + i)) res |= (2 << (i * 2)); } } else if (offset < 0xfe0) { goto bad_reg; } else { if (offset & 3) { res = 0; } else { res = gic_id[(offset - 0xfe0) >> 2]; } } return res; bad_reg: qemu_log_mask(LOG_GUEST_ERROR, "gic_dist_readb: Bad offset %x\n", (int)offset); return 0; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(void *opaque, hwaddr offset) { GICState *s = (GICState *)opaque; uint32_t res; int VAR_0; int VAR_1; int VAR_2; int VAR_3; int VAR_4; VAR_2 = gic_get_current_cpu(s); VAR_3 = 1 << VAR_2; if (offset < 0x100) { if (offset == 0) return s->enabled; if (offset == 4) return ((s->num_irq / 32) - 1) | ((NUM_CPU(s) - 1) << 5); if (offset < 0x08) return 0; if (offset >= 0x80) { return 0; } goto bad_reg; } else if (offset < 0x200) { if (offset < 0x180) VAR_0 = (offset - 0x100) * 8; else VAR_0 = (offset - 0x180) * 8; VAR_0 += GIC_BASE_IRQ; if (VAR_0 >= s->num_irq) goto bad_reg; res = 0; for (VAR_1 = 0; VAR_1 < 8; VAR_1++) { if (GIC_TEST_ENABLED(VAR_0 + VAR_1, VAR_3)) { res |= (1 << VAR_1); } } } else if (offset < 0x300) { if (offset < 0x280) VAR_0 = (offset - 0x200) * 8; else VAR_0 = (offset - 0x280) * 8; VAR_0 += GIC_BASE_IRQ; if (VAR_0 >= s->num_irq) goto bad_reg; res = 0; VAR_4 = (VAR_0 < GIC_INTERNAL) ? VAR_3 : ALL_CPU_MASK; for (VAR_1 = 0; VAR_1 < 8; VAR_1++) { if (GIC_TEST_PENDING(VAR_0 + VAR_1, VAR_4)) { res |= (1 << VAR_1); } } } else if (offset < 0x400) { VAR_0 = (offset - 0x300) * 8 + GIC_BASE_IRQ; if (VAR_0 >= s->num_irq) goto bad_reg; res = 0; VAR_4 = (VAR_0 < GIC_INTERNAL) ? VAR_3 : ALL_CPU_MASK; for (VAR_1 = 0; VAR_1 < 8; VAR_1++) { if (GIC_TEST_ACTIVE(VAR_0 + VAR_1, VAR_4)) { res |= (1 << VAR_1); } } } else if (offset < 0x800) { VAR_0 = (offset - 0x400) + GIC_BASE_IRQ; if (VAR_0 >= s->num_irq) goto bad_reg; res = GIC_GET_PRIORITY(VAR_0, VAR_2); } else if (offset < 0xc00) { if (s->num_cpu == 1 && s->revision != REV_11MPCORE) { res = 0; } else { VAR_0 = (offset - 0x800) + GIC_BASE_IRQ; if (VAR_0 >= s->num_irq) { goto bad_reg; } if (VAR_0 >= 29 && VAR_0 <= 31) { res = VAR_3; } else { res = GIC_TARGET(VAR_0); } } } else if (offset < 0xf00) { VAR_0 = (offset - 0xc00) * 2 + GIC_BASE_IRQ; if (VAR_0 >= s->num_irq) goto bad_reg; res = 0; for (VAR_1 = 0; VAR_1 < 4; VAR_1++) { if (GIC_TEST_MODEL(VAR_0 + VAR_1)) res |= (1 << (VAR_1 * 2)); if (GIC_TEST_EDGE_TRIGGER(VAR_0 + VAR_1)) res |= (2 << (VAR_1 * 2)); } } else if (offset < 0xfe0) { goto bad_reg; } else { if (offset & 3) { res = 0; } else { res = gic_id[(offset - 0xfe0) >> 2]; } } return res; bad_reg: qemu_log_mask(LOG_GUEST_ERROR, "FUNC_0: Bad offset %x\n", (int)offset); return 0; }
[ "static uint32_t FUNC_0(void *opaque, hwaddr offset)\n{", "GICState *s = (GICState *)opaque;", "uint32_t res;", "int VAR_0;", "int VAR_1;", "int VAR_2;", "int VAR_3;", "int VAR_4;", "VAR_2 = gic_get_current_cpu(s);", "VAR_3 = 1 << VAR_2;", "if (offset < 0x100) {", "if (offset == 0)\nreturn s->enabled;", "if (offset == 4)\nreturn ((s->num_irq / 32) - 1) | ((NUM_CPU(s) - 1) << 5);", "if (offset < 0x08)\nreturn 0;", "if (offset >= 0x80) {", "return 0;", "}", "goto bad_reg;", "} else if (offset < 0x200) {", "if (offset < 0x180)\nVAR_0 = (offset - 0x100) * 8;", "else\nVAR_0 = (offset - 0x180) * 8;", "VAR_0 += GIC_BASE_IRQ;", "if (VAR_0 >= s->num_irq)\ngoto bad_reg;", "res = 0;", "for (VAR_1 = 0; VAR_1 < 8; VAR_1++) {", "if (GIC_TEST_ENABLED(VAR_0 + VAR_1, VAR_3)) {", "res |= (1 << VAR_1);", "}", "}", "} else if (offset < 0x300) {", "if (offset < 0x280)\nVAR_0 = (offset - 0x200) * 8;", "else\nVAR_0 = (offset - 0x280) * 8;", "VAR_0 += GIC_BASE_IRQ;", "if (VAR_0 >= s->num_irq)\ngoto bad_reg;", "res = 0;", "VAR_4 = (VAR_0 < GIC_INTERNAL) ? VAR_3 : ALL_CPU_MASK;", "for (VAR_1 = 0; VAR_1 < 8; VAR_1++) {", "if (GIC_TEST_PENDING(VAR_0 + VAR_1, VAR_4)) {", "res |= (1 << VAR_1);", "}", "}", "} else if (offset < 0x400) {", "VAR_0 = (offset - 0x300) * 8 + GIC_BASE_IRQ;", "if (VAR_0 >= s->num_irq)\ngoto bad_reg;", "res = 0;", "VAR_4 = (VAR_0 < GIC_INTERNAL) ? VAR_3 : ALL_CPU_MASK;", "for (VAR_1 = 0; VAR_1 < 8; VAR_1++) {", "if (GIC_TEST_ACTIVE(VAR_0 + VAR_1, VAR_4)) {", "res |= (1 << VAR_1);", "}", "}", "} else if (offset < 0x800) {", "VAR_0 = (offset - 0x400) + GIC_BASE_IRQ;", "if (VAR_0 >= s->num_irq)\ngoto bad_reg;", "res = GIC_GET_PRIORITY(VAR_0, VAR_2);", "} else if (offset < 0xc00) {", "if (s->num_cpu == 1 && s->revision != REV_11MPCORE) {", "res = 0;", "} else {", "VAR_0 = (offset - 0x800) + GIC_BASE_IRQ;", "if (VAR_0 >= s->num_irq) {", "goto bad_reg;", "}", "if (VAR_0 >= 29 && VAR_0 <= 31) {", "res = VAR_3;", "} else {", "res = GIC_TARGET(VAR_0);", "}", "}", "} else if (offset < 0xf00) {", "VAR_0 = (offset - 0xc00) * 2 + GIC_BASE_IRQ;", "if (VAR_0 >= s->num_irq)\ngoto bad_reg;", "res = 0;", "for (VAR_1 = 0; VAR_1 < 4; VAR_1++) {", "if (GIC_TEST_MODEL(VAR_0 + VAR_1))\nres |= (1 << (VAR_1 * 2));", "if (GIC_TEST_EDGE_TRIGGER(VAR_0 + VAR_1))\nres |= (2 << (VAR_1 * 2));", "}", "} else if (offset < 0xfe0) {", "goto bad_reg;", "} else {", "if (offset & 3) {", "res = 0;", "} else {", "res = gic_id[(offset - 0xfe0) >> 2];", "}", "}", "return res;", "bad_reg:\nqemu_log_mask(LOG_GUEST_ERROR,\n\"FUNC_0: Bad offset %x\\n\", (int)offset);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 83, 85 ], [ 87, 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185, 187 ], [ 189 ], [ 191 ], [ 193, 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223, 225, 227 ], [ 229 ], [ 231 ] ]
12,330
MemoryRegionSection memory_region_find(MemoryRegion *mr, hwaddr addr, uint64_t size) { MemoryRegionSection ret = { .mr = NULL }; MemoryRegion *root; AddressSpace *as; AddrRange range; FlatView *view; FlatRange *fr; addr += mr->addr; for (root = mr; root->parent; ) { root = root->parent; addr += root->addr; } as = memory_region_to_address_space(root); range = addrrange_make(int128_make64(addr), int128_make64(size)); view = as->current_map; fr = flatview_lookup(view, range); if (!fr) { return ret; } while (fr > view->ranges && addrrange_intersects(fr[-1].addr, range)) { --fr; } ret.mr = fr->mr; ret.address_space = as; range = addrrange_intersection(range, fr->addr); ret.offset_within_region = fr->offset_in_region; ret.offset_within_region += int128_get64(int128_sub(range.start, fr->addr.start)); ret.size = range.size; ret.offset_within_address_space = int128_get64(range.start); ret.readonly = fr->readonly; memory_region_ref(ret.mr); return ret; }
false
qemu
856d72454f03aea26fd61c728762ef9cd1d71512
MemoryRegionSection memory_region_find(MemoryRegion *mr, hwaddr addr, uint64_t size) { MemoryRegionSection ret = { .mr = NULL }; MemoryRegion *root; AddressSpace *as; AddrRange range; FlatView *view; FlatRange *fr; addr += mr->addr; for (root = mr; root->parent; ) { root = root->parent; addr += root->addr; } as = memory_region_to_address_space(root); range = addrrange_make(int128_make64(addr), int128_make64(size)); view = as->current_map; fr = flatview_lookup(view, range); if (!fr) { return ret; } while (fr > view->ranges && addrrange_intersects(fr[-1].addr, range)) { --fr; } ret.mr = fr->mr; ret.address_space = as; range = addrrange_intersection(range, fr->addr); ret.offset_within_region = fr->offset_in_region; ret.offset_within_region += int128_get64(int128_sub(range.start, fr->addr.start)); ret.size = range.size; ret.offset_within_address_space = int128_get64(range.start); ret.readonly = fr->readonly; memory_region_ref(ret.mr); return ret; }
{ "code": [], "line_no": [] }
MemoryRegionSection FUNC_0(MemoryRegion *mr, hwaddr addr, uint64_t size) { MemoryRegionSection ret = { .mr = NULL }; MemoryRegion *root; AddressSpace *as; AddrRange range; FlatView *view; FlatRange *fr; addr += mr->addr; for (root = mr; root->parent; ) { root = root->parent; addr += root->addr; } as = memory_region_to_address_space(root); range = addrrange_make(int128_make64(addr), int128_make64(size)); view = as->current_map; fr = flatview_lookup(view, range); if (!fr) { return ret; } while (fr > view->ranges && addrrange_intersects(fr[-1].addr, range)) { --fr; } ret.mr = fr->mr; ret.address_space = as; range = addrrange_intersection(range, fr->addr); ret.offset_within_region = fr->offset_in_region; ret.offset_within_region += int128_get64(int128_sub(range.start, fr->addr.start)); ret.size = range.size; ret.offset_within_address_space = int128_get64(range.start); ret.readonly = fr->readonly; memory_region_ref(ret.mr); return ret; }
[ "MemoryRegionSection FUNC_0(MemoryRegion *mr,\nhwaddr addr, uint64_t size)\n{", "MemoryRegionSection ret = { .mr = NULL };", "MemoryRegion *root;", "AddressSpace *as;", "AddrRange range;", "FlatView *view;", "FlatRange *fr;", "addr += mr->addr;", "for (root = mr; root->parent; ) {", "root = root->parent;", "addr += root->addr;", "}", "as = memory_region_to_address_space(root);", "range = addrrange_make(int128_make64(addr), int128_make64(size));", "view = as->current_map;", "fr = flatview_lookup(view, range);", "if (!fr) {", "return ret;", "}", "while (fr > view->ranges && addrrange_intersects(fr[-1].addr, range)) {", "--fr;", "}", "ret.mr = fr->mr;", "ret.address_space = as;", "range = addrrange_intersection(range, fr->addr);", "ret.offset_within_region = fr->offset_in_region;", "ret.offset_within_region += int128_get64(int128_sub(range.start,\nfr->addr.start));", "ret.size = range.size;", "ret.offset_within_address_space = int128_get64(range.start);", "ret.readonly = fr->readonly;", "memory_region_ref(ret.mr);", "return ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ] ]
12,331
static void omap_tcmi_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque; if (size != 4) { return omap_badwidth_write32(opaque, addr, value); } switch (addr) { case 0x00: /* IMIF_PRIO */ case 0x04: /* EMIFS_PRIO */ case 0x08: /* EMIFF_PRIO */ case 0x10: /* EMIFS_CS0_CONFIG */ case 0x14: /* EMIFS_CS1_CONFIG */ case 0x18: /* EMIFS_CS2_CONFIG */ case 0x1c: /* EMIFS_CS3_CONFIG */ case 0x20: /* EMIFF_SDRAM_CONFIG */ case 0x24: /* EMIFF_MRS */ case 0x28: /* TIMEOUT1 */ case 0x2c: /* TIMEOUT2 */ case 0x30: /* TIMEOUT3 */ case 0x3c: /* EMIFF_SDRAM_CONFIG_2 */ case 0x40: /* EMIFS_CFG_DYN_WAIT */ s->tcmi_regs[addr >> 2] = value; break; case 0x0c: /* EMIFS_CONFIG */ s->tcmi_regs[addr >> 2] = (value & 0xf) | (1 << 4); break; default: OMAP_BAD_REG(addr); } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void omap_tcmi_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque; if (size != 4) { return omap_badwidth_write32(opaque, addr, value); } switch (addr) { case 0x00: case 0x04: case 0x08: case 0x10: case 0x14: case 0x18: case 0x1c: case 0x20: case 0x24: case 0x28: case 0x2c: case 0x30: case 0x3c: case 0x40: s->tcmi_regs[addr >> 2] = value; break; case 0x0c: s->tcmi_regs[addr >> 2] = (value & 0xf) | (1 << 4); break; default: OMAP_BAD_REG(addr); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { struct omap_mpu_state_s *VAR_4 = (struct omap_mpu_state_s *) VAR_0; if (VAR_3 != 4) { return omap_badwidth_write32(VAR_0, VAR_1, VAR_2); } switch (VAR_1) { case 0x00: case 0x04: case 0x08: case 0x10: case 0x14: case 0x18: case 0x1c: case 0x20: case 0x24: case 0x28: case 0x2c: case 0x30: case 0x3c: case 0x40: VAR_4->tcmi_regs[VAR_1 >> 2] = VAR_2; break; case 0x0c: VAR_4->tcmi_regs[VAR_1 >> 2] = (VAR_2 & 0xf) | (1 << 4); break; default: OMAP_BAD_REG(VAR_1); } }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "struct omap_mpu_state_s *VAR_4 = (struct omap_mpu_state_s *) VAR_0;", "if (VAR_3 != 4) {", "return omap_badwidth_write32(VAR_0, VAR_1, VAR_2);", "}", "switch (VAR_1) {", "case 0x00:\ncase 0x04:\ncase 0x08:\ncase 0x10:\ncase 0x14:\ncase 0x18:\ncase 0x1c:\ncase 0x20:\ncase 0x24:\ncase 0x28:\ncase 0x2c:\ncase 0x30:\ncase 0x3c:\ncase 0x40:\nVAR_4->tcmi_regs[VAR_1 >> 2] = VAR_2;", "break;", "case 0x0c:\nVAR_4->tcmi_regs[VAR_1 >> 2] = (VAR_2 & 0xf) | (1 << 4);", "break;", "default:\nOMAP_BAD_REG(VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 61, 63 ], [ 65 ], [ 67 ] ]
12,332
static av_cold int xbm_encode_init(AVCodecContext *avctx) { avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; return 0; }
false
FFmpeg
d6604b29ef544793479d7fb4e05ef6622bb3e534
static av_cold int xbm_encode_init(AVCodecContext *avctx) { avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; return 0; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { avctx->coded_frame = av_frame_alloc(); if (!avctx->coded_frame) return AVERROR(ENOMEM); avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; return 0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "avctx->coded_frame = av_frame_alloc();", "if (!avctx->coded_frame)\nreturn AVERROR(ENOMEM);", "avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 15 ], [ 17 ] ]
12,333
static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; const x86_reg chromWidth= width>>1; for (y=0; y<height; y++) { #if COMPILE_TEMPLATE_MMX //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway) __asm__ volatile( "xor %%"REG_a", %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" PREFETCH" 32(%1, %%"REG_a", 2) \n\t" PREFETCH" 32(%2, %%"REG_a") \n\t" PREFETCH" 32(%3, %%"REG_a") \n\t" "movq (%2, %%"REG_a"), %%mm0 \n\t" // U(0) "movq %%mm0, %%mm2 \n\t" // U(0) "movq (%3, %%"REG_a"), %%mm1 \n\t" // V(0) "punpcklbw %%mm1, %%mm0 \n\t" // UVUV UVUV(0) "punpckhbw %%mm1, %%mm2 \n\t" // UVUV UVUV(8) "movq (%1, %%"REG_a",2), %%mm3 \n\t" // Y(0) "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" // Y(8) "movq %%mm3, %%mm4 \n\t" // Y(0) "movq %%mm5, %%mm6 \n\t" // Y(8) "punpcklbw %%mm0, %%mm3 \n\t" // YUYV YUYV(0) "punpckhbw %%mm0, %%mm4 \n\t" // YUYV YUYV(4) "punpcklbw %%mm2, %%mm5 \n\t" // YUYV YUYV(8) "punpckhbw %%mm2, %%mm6 \n\t" // YUYV YUYV(12) MOVNTQ" %%mm3, (%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm5, 16(%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4) \n\t" "add $8, %%"REG_a" \n\t" "cmp %4, %%"REG_a" \n\t" " jb 1b \n\t" ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth) : "%"REG_a ); #else #if ARCH_ALPHA && HAVE_MVI #define pl2yuy2(n) \ y1 = yc[n]; \ y2 = yc2[n]; \ u = uc[n]; \ v = vc[n]; \ __asm__("unpkbw %1, %0" : "=r"(y1) : "r"(y1)); \ __asm__("unpkbw %1, %0" : "=r"(y2) : "r"(y2)); \ __asm__("unpkbl %1, %0" : "=r"(u) : "r"(u)); \ __asm__("unpkbl %1, %0" : "=r"(v) : "r"(v)); \ yuv1 = (u << 8) + (v << 24); \ yuv2 = yuv1 + y2; \ yuv1 += y1; \ qdst[n] = yuv1; \ qdst2[n] = yuv2; int i; uint64_t *qdst = (uint64_t *) dst; uint64_t *qdst2 = (uint64_t *) (dst + dstStride); const uint32_t *yc = (uint32_t *) ysrc; const uint32_t *yc2 = (uint32_t *) (ysrc + lumStride); const uint16_t *uc = (uint16_t*) usrc, *vc = (uint16_t*) vsrc; for (i = 0; i < chromWidth; i += 8) { uint64_t y1, y2, yuv1, yuv2; uint64_t u, v; /* Prefetch */ __asm__("ldq $31,64(%0)" :: "r"(yc)); __asm__("ldq $31,64(%0)" :: "r"(yc2)); __asm__("ldq $31,64(%0)" :: "r"(uc)); __asm__("ldq $31,64(%0)" :: "r"(vc)); pl2yuy2(0); pl2yuy2(1); pl2yuy2(2); pl2yuy2(3); yc += 4; yc2 += 4; uc += 4; vc += 4; qdst += 4; qdst2 += 4; } y++; ysrc += lumStride; dst += dstStride; #elif HAVE_FAST_64BIT int i; uint64_t *ldst = (uint64_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < chromWidth; i += 2) { uint64_t k, l; k = yc[0] + (uc[0] << 8) + (yc[1] << 16) + (vc[0] << 24); l = yc[2] + (uc[1] << 8) + (yc[3] << 16) + (vc[1] << 24); *ldst++ = k + (l << 32); yc += 4; uc += 2; vc += 2; } #else int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < chromWidth; i++) { #if HAVE_BIGENDIAN *idst++ = (yc[0] << 24)+ (uc[0] << 16) + (yc[1] << 8) + (vc[0] << 0); #else *idst++ = yc[0] + (uc[0] << 8) + (yc[1] << 16) + (vc[0] << 24); #endif yc += 2; uc++; vc++; } #endif #endif if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) { usrc += chromStride; vsrc += chromStride; } ysrc += lumStride; dst += dstStride; } #if COMPILE_TEMPLATE_MMX __asm__(EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long y; const x86_reg chromWidth= width>>1; for (y=0; y<height; y++) { #if COMPILE_TEMPLATE_MMX __asm__ volatile( "xor %%"REG_a", %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" PREFETCH" 32(%1, %%"REG_a", 2) \n\t" PREFETCH" 32(%2, %%"REG_a") \n\t" PREFETCH" 32(%3, %%"REG_a") \n\t" "movq (%2, %%"REG_a"), %%mm0 \n\t" "movq %%mm0, %%mm2 \n\t" "movq (%3, %%"REG_a"), %%mm1 \n\t" "punpcklbw %%mm1, %%mm0 \n\t" "punpckhbw %%mm1, %%mm2 \n\t" "movq (%1, %%"REG_a",2), %%mm3 \n\t" "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" "movq %%mm3, %%mm4 \n\t" "movq %%mm5, %%mm6 \n\t" "punpcklbw %%mm0, %%mm3 \n\t" "punpckhbw %%mm0, %%mm4 \n\t" "punpcklbw %%mm2, %%mm5 \n\t" "punpckhbw %%mm2, %%mm6 \n\t" MOVNTQ" %%mm3, (%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm5, 16(%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4) \n\t" "add $8, %%"REG_a" \n\t" "cmp %4, %%"REG_a" \n\t" " jb 1b \n\t" ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth) : "%"REG_a ); #else #if ARCH_ALPHA && HAVE_MVI #define pl2yuy2(n) \ y1 = yc[n]; \ y2 = yc2[n]; \ u = uc[n]; \ v = vc[n]; \ __asm__("unpkbw %1, %0" : "=r"(y1) : "r"(y1)); \ __asm__("unpkbw %1, %0" : "=r"(y2) : "r"(y2)); \ __asm__("unpkbl %1, %0" : "=r"(u) : "r"(u)); \ __asm__("unpkbl %1, %0" : "=r"(v) : "r"(v)); \ yuv1 = (u << 8) + (v << 24); \ yuv2 = yuv1 + y2; \ yuv1 += y1; \ qdst[n] = yuv1; \ qdst2[n] = yuv2; int i; uint64_t *qdst = (uint64_t *) dst; uint64_t *qdst2 = (uint64_t *) (dst + dstStride); const uint32_t *yc = (uint32_t *) ysrc; const uint32_t *yc2 = (uint32_t *) (ysrc + lumStride); const uint16_t *uc = (uint16_t*) usrc, *vc = (uint16_t*) vsrc; for (i = 0; i < chromWidth; i += 8) { uint64_t y1, y2, yuv1, yuv2; uint64_t u, v; __asm__("ldq $31,64(%0)" :: "r"(yc)); __asm__("ldq $31,64(%0)" :: "r"(yc2)); __asm__("ldq $31,64(%0)" :: "r"(uc)); __asm__("ldq $31,64(%0)" :: "r"(vc)); pl2yuy2(0); pl2yuy2(1); pl2yuy2(2); pl2yuy2(3); yc += 4; yc2 += 4; uc += 4; vc += 4; qdst += 4; qdst2 += 4; } y++; ysrc += lumStride; dst += dstStride; #elif HAVE_FAST_64BIT int i; uint64_t *ldst = (uint64_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < chromWidth; i += 2) { uint64_t k, l; k = yc[0] + (uc[0] << 8) + (yc[1] << 16) + (vc[0] << 24); l = yc[2] + (uc[1] << 8) + (yc[3] << 16) + (vc[1] << 24); *ldst++ = k + (l << 32); yc += 4; uc += 2; vc += 2; } #else int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < chromWidth; i++) { #if HAVE_BIGENDIAN *idst++ = (yc[0] << 24)+ (uc[0] << 16) + (yc[1] << 8) + (vc[0] << 0); #else *idst++ = yc[0] + (uc[0] << 8) + (yc[1] << 16) + (vc[0] << 24); #endif yc += 2; uc++; vc++; } #endif #endif if ((y&(vertLumPerChroma-1)) == vertLumPerChroma-1) { usrc += chromStride; vsrc += chromStride; } ysrc += lumStride; dst += dstStride; } #if COMPILE_TEMPLATE_MMX __asm__(EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
{ "code": [], "line_no": [] }
static inline void FUNC_0(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride, long vertLumPerChroma) { long VAR_0; const x86_reg VAR_1= width>>1; for (VAR_0=0; VAR_0<height; VAR_0++) { #if COMPILE_TEMPLATE_MMX __asm__ volatile( "xor %%"REG_a", %%"REG_a" \n\t" ".p2align 4 \n\t" "1: \n\t" PREFETCH" 32(%1, %%"REG_a", 2) \n\t" PREFETCH" 32(%2, %%"REG_a") \n\t" PREFETCH" 32(%3, %%"REG_a") \n\t" "movq (%2, %%"REG_a"), %%mm0 \n\t" "movq %%mm0, %%mm2 \n\t" "movq (%3, %%"REG_a"), %%mm1 \n\t" "punpcklbw %%mm1, %%mm0 \n\t" "punpckhbw %%mm1, %%mm2 \n\t" "movq (%1, %%"REG_a",2), %%mm3 \n\t" "movq 8(%1, %%"REG_a",2), %%mm5 \n\t" "movq %%mm3, %%mm4 \n\t" "movq %%mm5, %%mm6 \n\t" "punpcklbw %%mm0, %%mm3 \n\t" "punpckhbw %%mm0, %%mm4 \n\t" "punpcklbw %%mm2, %%mm5 \n\t" "punpckhbw %%mm2, %%mm6 \n\t" MOVNTQ" %%mm3, (%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm5, 16(%0, %%"REG_a", 4) \n\t" MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4) \n\t" "add $8, %%"REG_a" \n\t" "cmp %4, %%"REG_a" \n\t" " jb 1b \n\t" ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (VAR_1) : "%"REG_a ); #else #if ARCH_ALPHA && HAVE_MVI #define pl2yuy2(n) \ y1 = yc[n]; \ y2 = yc2[n]; \ u = uc[n]; \ v = vc[n]; \ __asm__("unpkbw %1, %0" : "=r"(y1) : "r"(y1)); \ __asm__("unpkbw %1, %0" : "=r"(y2) : "r"(y2)); \ __asm__("unpkbl %1, %0" : "=r"(u) : "r"(u)); \ __asm__("unpkbl %1, %0" : "=r"(v) : "r"(v)); \ yuv1 = (u << 8) + (v << 24); \ yuv2 = yuv1 + y2; \ yuv1 += y1; \ qdst[n] = yuv1; \ qdst2[n] = yuv2; int i; uint64_t *qdst = (uint64_t *) dst; uint64_t *qdst2 = (uint64_t *) (dst + dstStride); const uint32_t *yc = (uint32_t *) ysrc; const uint32_t *yc2 = (uint32_t *) (ysrc + lumStride); const uint16_t *uc = (uint16_t*) usrc, *vc = (uint16_t*) vsrc; for (i = 0; i < VAR_1; i += 8) { uint64_t y1, y2, yuv1, yuv2; uint64_t u, v; __asm__("ldq $31,64(%0)" :: "r"(yc)); __asm__("ldq $31,64(%0)" :: "r"(yc2)); __asm__("ldq $31,64(%0)" :: "r"(uc)); __asm__("ldq $31,64(%0)" :: "r"(vc)); pl2yuy2(0); pl2yuy2(1); pl2yuy2(2); pl2yuy2(3); yc += 4; yc2 += 4; uc += 4; vc += 4; qdst += 4; qdst2 += 4; } VAR_0++; ysrc += lumStride; dst += dstStride; #elif HAVE_FAST_64BIT int i; uint64_t *ldst = (uint64_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < VAR_1; i += 2) { uint64_t k, l; k = yc[0] + (uc[0] << 8) + (yc[1] << 16) + (vc[0] << 24); l = yc[2] + (uc[1] << 8) + (yc[3] << 16) + (vc[1] << 24); *ldst++ = k + (l << 32); yc += 4; uc += 2; vc += 2; } #else int i, *idst = (int32_t *) dst; const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc; for (i = 0; i < VAR_1; i++) { #if HAVE_BIGENDIAN *idst++ = (yc[0] << 24)+ (uc[0] << 16) + (yc[1] << 8) + (vc[0] << 0); #else *idst++ = yc[0] + (uc[0] << 8) + (yc[1] << 16) + (vc[0] << 24); #endif yc += 2; uc++; vc++; } #endif #endif if ((VAR_0&(vertLumPerChroma-1)) == vertLumPerChroma-1) { usrc += chromStride; vsrc += chromStride; } ysrc += lumStride; dst += dstStride; } #if COMPILE_TEMPLATE_MMX __asm__(EMMS" \n\t" SFENCE" \n\t" :::"memory"); #endif }
[ "static inline void FUNC_0(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,\nlong width, long height,\nlong lumStride, long chromStride, long dstStride, long vertLumPerChroma)\n{", "long VAR_0;", "const x86_reg VAR_1= width>>1;", "for (VAR_0=0; VAR_0<height; VAR_0++) {", "#if COMPILE_TEMPLATE_MMX\n__asm__ volatile(\n\"xor %%\"REG_a\", %%\"REG_a\" \\n\\t\"\n\".p2align 4 \\n\\t\"\n\"1: \\n\\t\"\nPREFETCH\" 32(%1, %%\"REG_a\", 2) \\n\\t\"\nPREFETCH\" 32(%2, %%\"REG_a\") \\n\\t\"\nPREFETCH\" 32(%3, %%\"REG_a\") \\n\\t\"\n\"movq (%2, %%\"REG_a\"), %%mm0 \\n\\t\"\n\"movq %%mm0, %%mm2 \\n\\t\"\n\"movq (%3, %%\"REG_a\"), %%mm1 \\n\\t\"\n\"punpcklbw %%mm1, %%mm0 \\n\\t\"\n\"punpckhbw %%mm1, %%mm2 \\n\\t\"\n\"movq (%1, %%\"REG_a\",2), %%mm3 \\n\\t\"\n\"movq 8(%1, %%\"REG_a\",2), %%mm5 \\n\\t\"\n\"movq %%mm3, %%mm4 \\n\\t\"\n\"movq %%mm5, %%mm6 \\n\\t\"\n\"punpcklbw %%mm0, %%mm3 \\n\\t\"\n\"punpckhbw %%mm0, %%mm4 \\n\\t\"\n\"punpcklbw %%mm2, %%mm5 \\n\\t\"\n\"punpckhbw %%mm2, %%mm6 \\n\\t\"\nMOVNTQ\" %%mm3, (%0, %%\"REG_a\", 4) \\n\\t\"\nMOVNTQ\" %%mm4, 8(%0, %%\"REG_a\", 4) \\n\\t\"\nMOVNTQ\" %%mm5, 16(%0, %%\"REG_a\", 4) \\n\\t\"\nMOVNTQ\" %%mm6, 24(%0, %%\"REG_a\", 4) \\n\\t\"\n\"add $8, %%\"REG_a\" \\n\\t\"\n\"cmp %4, %%\"REG_a\" \\n\\t\"\n\" jb 1b \\n\\t\"\n::\"r\"(dst), \"r\"(ysrc), \"r\"(usrc), \"r\"(vsrc), \"g\" (VAR_1)\n: \"%\"REG_a\n);", "#else\n#if ARCH_ALPHA && HAVE_MVI\n#define pl2yuy2(n) \\\ny1 = yc[n]; \\", "y2 = yc2[n]; \\", "u = uc[n]; \\", "v = vc[n]; \\", "__asm__(\"unpkbw %1, %0\" : \"=r\"(y1) : \"r\"(y1)); \\", "__asm__(\"unpkbw %1, %0\" : \"=r\"(y2) : \"r\"(y2)); \\", "__asm__(\"unpkbl %1, %0\" : \"=r\"(u) : \"r\"(u)); \\", "__asm__(\"unpkbl %1, %0\" : \"=r\"(v) : \"r\"(v)); \\", "yuv1 = (u << 8) + (v << 24); \\", "yuv2 = yuv1 + y2; \\", "yuv1 += y1; \\", "qdst[n] = yuv1; \\", "qdst2[n] = yuv2;", "int i;", "uint64_t *qdst = (uint64_t *) dst;", "uint64_t *qdst2 = (uint64_t *) (dst + dstStride);", "const uint32_t *yc = (uint32_t *) ysrc;", "const uint32_t *yc2 = (uint32_t *) (ysrc + lumStride);", "const uint16_t *uc = (uint16_t*) usrc, *vc = (uint16_t*) vsrc;", "for (i = 0; i < VAR_1; i += 8) {", "uint64_t y1, y2, yuv1, yuv2;", "uint64_t u, v;", "__asm__(\"ldq $31,64(%0)\" :: \"r\"(yc));", "__asm__(\"ldq $31,64(%0)\" :: \"r\"(yc2));", "__asm__(\"ldq $31,64(%0)\" :: \"r\"(uc));", "__asm__(\"ldq $31,64(%0)\" :: \"r\"(vc));", "pl2yuy2(0);", "pl2yuy2(1);", "pl2yuy2(2);", "pl2yuy2(3);", "yc += 4;", "yc2 += 4;", "uc += 4;", "vc += 4;", "qdst += 4;", "qdst2 += 4;", "}", "VAR_0++;", "ysrc += lumStride;", "dst += dstStride;", "#elif HAVE_FAST_64BIT\nint i;", "uint64_t *ldst = (uint64_t *) dst;", "const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;", "for (i = 0; i < VAR_1; i += 2) {", "uint64_t k, l;", "k = yc[0] + (uc[0] << 8) +\n(yc[1] << 16) + (vc[0] << 24);", "l = yc[2] + (uc[1] << 8) +\n(yc[3] << 16) + (vc[1] << 24);", "*ldst++ = k + (l << 32);", "yc += 4;", "uc += 2;", "vc += 2;", "}", "#else\nint i, *idst = (int32_t *) dst;", "const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;", "for (i = 0; i < VAR_1; i++) {", "#if HAVE_BIGENDIAN\n*idst++ = (yc[0] << 24)+ (uc[0] << 16) +\n(yc[1] << 8) + (vc[0] << 0);", "#else\n*idst++ = yc[0] + (uc[0] << 8) +\n(yc[1] << 16) + (vc[0] << 24);", "#endif\nyc += 2;", "uc++;", "vc++;", "}", "#endif\n#endif\nif ((VAR_0&(vertLumPerChroma-1)) == vertLumPerChroma-1) {", "usrc += chromStride;", "vsrc += chromStride;", "}", "ysrc += lumStride;", "dst += dstStride;", "}", "#if COMPILE_TEMPLATE_MMX\n__asm__(EMMS\" \\n\\t\"\nSFENCE\" \\n\\t\"\n:::\"memory\");", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 45, 47, 49, 51, 53, 55, 57, 59, 63, 65, 67, 69, 73, 75, 77, 79, 81, 83 ], [ 85, 89, 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199, 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 223, 225, 227 ], [ 229, 231, 233 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245, 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263, 265, 267, 269 ], [ 271, 273 ] ]
12,334
DECL_IMDCT_BLOCKS(sse,sse) #endif DECL_IMDCT_BLOCKS(sse2,sse) DECL_IMDCT_BLOCKS(sse3,sse) DECL_IMDCT_BLOCKS(ssse3,sse) #endif #if HAVE_AVX_EXTERNAL DECL_IMDCT_BLOCKS(avx,avx) #endif #endif /* HAVE_YASM */ av_cold void ff_mpadsp_init_x86(MPADSPContext *s) { int cpu_flags = av_get_cpu_flags(); int i, j; for (j = 0; j < 4; j++) { for (i = 0; i < 40; i ++) { mdct_win_sse[0][j][4*i ] = ff_mdct_win_float[j ][i]; mdct_win_sse[0][j][4*i + 1] = ff_mdct_win_float[j + 4][i]; mdct_win_sse[0][j][4*i + 2] = ff_mdct_win_float[j ][i]; mdct_win_sse[0][j][4*i + 3] = ff_mdct_win_float[j + 4][i]; mdct_win_sse[1][j][4*i ] = ff_mdct_win_float[0 ][i]; mdct_win_sse[1][j][4*i + 1] = ff_mdct_win_float[4 ][i]; mdct_win_sse[1][j][4*i + 2] = ff_mdct_win_float[j ][i]; mdct_win_sse[1][j][4*i + 3] = ff_mdct_win_float[j + 4][i]; } } #if HAVE_6REGS && HAVE_SSE_INLINE if (INLINE_SSE(cpu_flags)) { s->apply_window_float = apply_window_mp3; } #endif /* HAVE_SSE_INLINE */ #if HAVE_YASM #if HAVE_SSE #if ARCH_X86_32 if (EXTERNAL_SSE(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_sse; } #endif if (EXTERNAL_SSE2(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_sse2; } if (EXTERNAL_SSE3(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_sse3; } if (EXTERNAL_SSSE3(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_ssse3; } #endif #if HAVE_AVX_EXTERNAL if (EXTERNAL_AVX(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_avx; } #endif #endif /* HAVE_YASM */ }
false
FFmpeg
0544c95fd6d0e3c1072554f9d13baf45af7fbf56
DECL_IMDCT_BLOCKS(sse,sse) #endif DECL_IMDCT_BLOCKS(sse2,sse) DECL_IMDCT_BLOCKS(sse3,sse) DECL_IMDCT_BLOCKS(ssse3,sse) #endif #if HAVE_AVX_EXTERNAL DECL_IMDCT_BLOCKS(avx,avx) #endif #endif av_cold void ff_mpadsp_init_x86(MPADSPContext *s) { int cpu_flags = av_get_cpu_flags(); int i, j; for (j = 0; j < 4; j++) { for (i = 0; i < 40; i ++) { mdct_win_sse[0][j][4*i ] = ff_mdct_win_float[j ][i]; mdct_win_sse[0][j][4*i + 1] = ff_mdct_win_float[j + 4][i]; mdct_win_sse[0][j][4*i + 2] = ff_mdct_win_float[j ][i]; mdct_win_sse[0][j][4*i + 3] = ff_mdct_win_float[j + 4][i]; mdct_win_sse[1][j][4*i ] = ff_mdct_win_float[0 ][i]; mdct_win_sse[1][j][4*i + 1] = ff_mdct_win_float[4 ][i]; mdct_win_sse[1][j][4*i + 2] = ff_mdct_win_float[j ][i]; mdct_win_sse[1][j][4*i + 3] = ff_mdct_win_float[j + 4][i]; } } #if HAVE_6REGS && HAVE_SSE_INLINE if (INLINE_SSE(cpu_flags)) { s->apply_window_float = apply_window_mp3; } #endif #if HAVE_YASM #if HAVE_SSE #if ARCH_X86_32 if (EXTERNAL_SSE(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_sse; } #endif if (EXTERNAL_SSE2(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_sse2; } if (EXTERNAL_SSE3(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_sse3; } if (EXTERNAL_SSSE3(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_ssse3; } #endif #if HAVE_AVX_EXTERNAL if (EXTERNAL_AVX(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_avx; } #endif #endif }
{ "code": [], "line_no": [] }
DECL_IMDCT_BLOCKS(sse,sse) #endif DECL_IMDCT_BLOCKS(sse2,sse) DECL_IMDCT_BLOCKS(sse3,sse) DECL_IMDCT_BLOCKS(ssse3,sse) #endif #if HAVE_AVX_EXTERNAL DECL_IMDCT_BLOCKS(avx,avx) #endif #endif av_cold void ff_mpadsp_init_x86(MPADSPContext *s) { int cpu_flags = av_get_cpu_flags(); int i, j; for (j = 0; j < 4; j++) { for (i = 0; i < 40; i ++) { mdct_win_sse[0][j][4*i ] = ff_mdct_win_float[j ][i]; mdct_win_sse[0][j][4*i + 1] = ff_mdct_win_float[j + 4][i]; mdct_win_sse[0][j][4*i + 2] = ff_mdct_win_float[j ][i]; mdct_win_sse[0][j][4*i + 3] = ff_mdct_win_float[j + 4][i]; mdct_win_sse[1][j][4*i ] = ff_mdct_win_float[0 ][i]; mdct_win_sse[1][j][4*i + 1] = ff_mdct_win_float[4 ][i]; mdct_win_sse[1][j][4*i + 2] = ff_mdct_win_float[j ][i]; mdct_win_sse[1][j][4*i + 3] = ff_mdct_win_float[j + 4][i]; } } #if HAVE_6REGS && HAVE_SSE_INLINE if (INLINE_SSE(cpu_flags)) { s->apply_window_float = apply_window_mp3; } #endif #if HAVE_YASM #if HAVE_SSE #if ARCH_X86_32 if (EXTERNAL_SSE(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_sse; } #endif if (EXTERNAL_SSE2(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_sse2; } if (EXTERNAL_SSE3(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_sse3; } if (EXTERNAL_SSSE3(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_ssse3; } #endif #if HAVE_AVX_EXTERNAL if (EXTERNAL_AVX(cpu_flags)) { s->imdct36_blocks_float = imdct36_blocks_avx; } #endif #endif }
[ "DECL_IMDCT_BLOCKS(sse,sse)\n#endif\nDECL_IMDCT_BLOCKS(sse2,sse)\nDECL_IMDCT_BLOCKS(sse3,sse)\nDECL_IMDCT_BLOCKS(ssse3,sse)\n#endif\n#if HAVE_AVX_EXTERNAL\nDECL_IMDCT_BLOCKS(avx,avx)\n#endif\n#endif\nav_cold void ff_mpadsp_init_x86(MPADSPContext *s)\n{", "int cpu_flags = av_get_cpu_flags();", "int i, j;", "for (j = 0; j < 4; j++) {", "for (i = 0; i < 40; i ++) {", "mdct_win_sse[0][j][4*i ] = ff_mdct_win_float[j ][i];", "mdct_win_sse[0][j][4*i + 1] = ff_mdct_win_float[j + 4][i];", "mdct_win_sse[0][j][4*i + 2] = ff_mdct_win_float[j ][i];", "mdct_win_sse[0][j][4*i + 3] = ff_mdct_win_float[j + 4][i];", "mdct_win_sse[1][j][4*i ] = ff_mdct_win_float[0 ][i];", "mdct_win_sse[1][j][4*i + 1] = ff_mdct_win_float[4 ][i];", "mdct_win_sse[1][j][4*i + 2] = ff_mdct_win_float[j ][i];", "mdct_win_sse[1][j][4*i + 3] = ff_mdct_win_float[j + 4][i];", "}", "}", "#if HAVE_6REGS && HAVE_SSE_INLINE\nif (INLINE_SSE(cpu_flags)) {", "s->apply_window_float = apply_window_mp3;", "}", "#endif\n#if HAVE_YASM\n#if HAVE_SSE\n#if ARCH_X86_32\nif (EXTERNAL_SSE(cpu_flags)) {", "s->imdct36_blocks_float = imdct36_blocks_sse;", "}", "#endif\nif (EXTERNAL_SSE2(cpu_flags)) {", "s->imdct36_blocks_float = imdct36_blocks_sse2;", "}", "if (EXTERNAL_SSE3(cpu_flags)) {", "s->imdct36_blocks_float = imdct36_blocks_sse3;", "}", "if (EXTERNAL_SSSE3(cpu_flags)) {", "s->imdct36_blocks_float = imdct36_blocks_ssse3;", "}", "#endif\n#if HAVE_AVX_EXTERNAL\nif (EXTERNAL_AVX(cpu_flags)) {", "s->imdct36_blocks_float = imdct36_blocks_avx;", "}", "#endif\n#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 23, 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67, 71, 73, 75, 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105, 107 ], [ 109 ], [ 111 ], [ 113, 115, 117 ] ]
12,335
static void dirac_unpack_block_motion_data(DiracContext *s) { GetBitContext *gb = &s->gb; uint8_t *sbsplit = s->sbsplit; int i, x, y, q, p; DiracArith arith[8]; align_get_bits(gb); /* [DIRAC_STD] 11.2.4 and 12.2.1 Number of blocks and superblocks */ s->sbwidth = DIVRNDUP(s->source.width, 4*s->plane[0].xbsep); s->sbheight = DIVRNDUP(s->source.height, 4*s->plane[0].ybsep); s->blwidth = 4 * s->sbwidth; s->blheight = 4 * s->sbheight; /* [DIRAC_STD] 12.3.1 Superblock splitting modes. superblock_split_modes() decode superblock split modes */ ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb)); /* svq3_get_ue_golomb(gb) is the length */ for (y = 0; y < s->sbheight; y++) { for (x = 0; x < s->sbwidth; x++) { int split = dirac_get_arith_uint(arith, CTX_SB_F1, CTX_SB_DATA); sbsplit[x] = (split + pred_sbsplit(sbsplit+x, s->sbwidth, x, y)) % 3; } sbsplit += s->sbwidth; } /* setup arith decoding */ ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb)); for (i = 0; i < s->num_refs; i++) { ff_dirac_init_arith_decoder(arith + 4 + 2 * i, gb, svq3_get_ue_golomb(gb)); ff_dirac_init_arith_decoder(arith + 5 + 2 * i, gb, svq3_get_ue_golomb(gb)); } for (i = 0; i < 3; i++) ff_dirac_init_arith_decoder(arith+1+i, gb, svq3_get_ue_golomb(gb)); for (y = 0; y < s->sbheight; y++) for (x = 0; x < s->sbwidth; x++) { int blkcnt = 1 << s->sbsplit[y * s->sbwidth + x]; int step = 4 >> s->sbsplit[y * s->sbwidth + x]; for (q = 0; q < blkcnt; q++) for (p = 0; p < blkcnt; p++) { int bx = 4 * x + p*step; int by = 4 * y + q*step; DiracBlock *block = &s->blmotion[by*s->blwidth + bx]; decode_block_params(s, arith, block, s->blwidth, bx, by); propagate_block_data(block, s->blwidth, step); } } }
true
FFmpeg
9729f140ae073f1df2041b6c5fd2068592eb9c48
static void dirac_unpack_block_motion_data(DiracContext *s) { GetBitContext *gb = &s->gb; uint8_t *sbsplit = s->sbsplit; int i, x, y, q, p; DiracArith arith[8]; align_get_bits(gb); s->sbwidth = DIVRNDUP(s->source.width, 4*s->plane[0].xbsep); s->sbheight = DIVRNDUP(s->source.height, 4*s->plane[0].ybsep); s->blwidth = 4 * s->sbwidth; s->blheight = 4 * s->sbheight; ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb)); for (y = 0; y < s->sbheight; y++) { for (x = 0; x < s->sbwidth; x++) { int split = dirac_get_arith_uint(arith, CTX_SB_F1, CTX_SB_DATA); sbsplit[x] = (split + pred_sbsplit(sbsplit+x, s->sbwidth, x, y)) % 3; } sbsplit += s->sbwidth; } ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb)); for (i = 0; i < s->num_refs; i++) { ff_dirac_init_arith_decoder(arith + 4 + 2 * i, gb, svq3_get_ue_golomb(gb)); ff_dirac_init_arith_decoder(arith + 5 + 2 * i, gb, svq3_get_ue_golomb(gb)); } for (i = 0; i < 3; i++) ff_dirac_init_arith_decoder(arith+1+i, gb, svq3_get_ue_golomb(gb)); for (y = 0; y < s->sbheight; y++) for (x = 0; x < s->sbwidth; x++) { int blkcnt = 1 << s->sbsplit[y * s->sbwidth + x]; int step = 4 >> s->sbsplit[y * s->sbwidth + x]; for (q = 0; q < blkcnt; q++) for (p = 0; p < blkcnt; p++) { int bx = 4 * x + p*step; int by = 4 * y + q*step; DiracBlock *block = &s->blmotion[by*s->blwidth + bx]; decode_block_params(s, arith, block, s->blwidth, bx, by); propagate_block_data(block, s->blwidth, step); } } }
{ "code": [ "static void dirac_unpack_block_motion_data(DiracContext *s)", " int split = dirac_get_arith_uint(arith, CTX_SB_F1, CTX_SB_DATA);" ], "line_no": [ 1, 41 ] }
static void FUNC_0(DiracContext *VAR_0) { GetBitContext *gb = &VAR_0->gb; uint8_t *sbsplit = VAR_0->sbsplit; int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5; DiracArith arith[8]; align_get_bits(gb); VAR_0->sbwidth = DIVRNDUP(VAR_0->source.width, 4*VAR_0->plane[0].xbsep); VAR_0->sbheight = DIVRNDUP(VAR_0->source.height, 4*VAR_0->plane[0].ybsep); VAR_0->blwidth = 4 * VAR_0->sbwidth; VAR_0->blheight = 4 * VAR_0->sbheight; ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb)); for (VAR_3 = 0; VAR_3 < VAR_0->sbheight; VAR_3++) { for (VAR_2 = 0; VAR_2 < VAR_0->sbwidth; VAR_2++) { int split = dirac_get_arith_uint(arith, CTX_SB_F1, CTX_SB_DATA); sbsplit[VAR_2] = (split + pred_sbsplit(sbsplit+VAR_2, VAR_0->sbwidth, VAR_2, VAR_3)) % 3; } sbsplit += VAR_0->sbwidth; } ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb)); for (VAR_1 = 0; VAR_1 < VAR_0->num_refs; VAR_1++) { ff_dirac_init_arith_decoder(arith + 4 + 2 * VAR_1, gb, svq3_get_ue_golomb(gb)); ff_dirac_init_arith_decoder(arith + 5 + 2 * VAR_1, gb, svq3_get_ue_golomb(gb)); } for (VAR_1 = 0; VAR_1 < 3; VAR_1++) ff_dirac_init_arith_decoder(arith+1+VAR_1, gb, svq3_get_ue_golomb(gb)); for (VAR_3 = 0; VAR_3 < VAR_0->sbheight; VAR_3++) for (VAR_2 = 0; VAR_2 < VAR_0->sbwidth; VAR_2++) { int blkcnt = 1 << VAR_0->sbsplit[VAR_3 * VAR_0->sbwidth + VAR_2]; int step = 4 >> VAR_0->sbsplit[VAR_3 * VAR_0->sbwidth + VAR_2]; for (VAR_4 = 0; VAR_4 < blkcnt; VAR_4++) for (VAR_5 = 0; VAR_5 < blkcnt; VAR_5++) { int bx = 4 * VAR_2 + VAR_5*step; int by = 4 * VAR_3 + VAR_4*step; DiracBlock *block = &VAR_0->blmotion[by*VAR_0->blwidth + bx]; decode_block_params(VAR_0, arith, block, VAR_0->blwidth, bx, by); propagate_block_data(block, VAR_0->blwidth, step); } } }
[ "static void FUNC_0(DiracContext *VAR_0)\n{", "GetBitContext *gb = &VAR_0->gb;", "uint8_t *sbsplit = VAR_0->sbsplit;", "int VAR_1, VAR_2, VAR_3, VAR_4, VAR_5;", "DiracArith arith[8];", "align_get_bits(gb);", "VAR_0->sbwidth = DIVRNDUP(VAR_0->source.width, 4*VAR_0->plane[0].xbsep);", "VAR_0->sbheight = DIVRNDUP(VAR_0->source.height, 4*VAR_0->plane[0].ybsep);", "VAR_0->blwidth = 4 * VAR_0->sbwidth;", "VAR_0->blheight = 4 * VAR_0->sbheight;", "ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb));", "for (VAR_3 = 0; VAR_3 < VAR_0->sbheight; VAR_3++) {", "for (VAR_2 = 0; VAR_2 < VAR_0->sbwidth; VAR_2++) {", "int split = dirac_get_arith_uint(arith, CTX_SB_F1, CTX_SB_DATA);", "sbsplit[VAR_2] = (split + pred_sbsplit(sbsplit+VAR_2, VAR_0->sbwidth, VAR_2, VAR_3)) % 3;", "}", "sbsplit += VAR_0->sbwidth;", "}", "ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb));", "for (VAR_1 = 0; VAR_1 < VAR_0->num_refs; VAR_1++) {", "ff_dirac_init_arith_decoder(arith + 4 + 2 * VAR_1, gb, svq3_get_ue_golomb(gb));", "ff_dirac_init_arith_decoder(arith + 5 + 2 * VAR_1, gb, svq3_get_ue_golomb(gb));", "}", "for (VAR_1 = 0; VAR_1 < 3; VAR_1++)", "ff_dirac_init_arith_decoder(arith+1+VAR_1, gb, svq3_get_ue_golomb(gb));", "for (VAR_3 = 0; VAR_3 < VAR_0->sbheight; VAR_3++)", "for (VAR_2 = 0; VAR_2 < VAR_0->sbwidth; VAR_2++) {", "int blkcnt = 1 << VAR_0->sbsplit[VAR_3 * VAR_0->sbwidth + VAR_2];", "int step = 4 >> VAR_0->sbsplit[VAR_3 * VAR_0->sbwidth + VAR_2];", "for (VAR_4 = 0; VAR_4 < blkcnt; VAR_4++)", "for (VAR_5 = 0; VAR_5 < blkcnt; VAR_5++) {", "int bx = 4 * VAR_2 + VAR_5*step;", "int by = 4 * VAR_3 + VAR_4*step;", "DiracBlock *block = &VAR_0->blmotion[by*VAR_0->blwidth + bx];", "decode_block_params(VAR_0, arith, block, VAR_0->blwidth, bx, by);", "propagate_block_data(block, VAR_0->blwidth, step);", "}", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ] ]
12,336
static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){ long i; for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ long a = *(long*)(src+i); long b = *(long*)(dst+i); *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80); } for(; i<w; i++) dst[i+0] += src[i+0]; }
true
FFmpeg
d1916d13e28b87f4b1b214231149e12e1d536b4b
static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){ long i; for(i=0; i<=w-sizeof(long); i+=sizeof(long)){ long a = *(long*)(src+i); long b = *(long*)(dst+i); *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80); } for(; i<w; i++) dst[i+0] += src[i+0]; }
{ "code": [ " for(i=0; i<=w-sizeof(long); i+=sizeof(long)){", " for(i=0; i<=w-sizeof(long); i+=sizeof(long)){" ], "line_no": [ 5, 5 ] }
static void FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, int VAR_2){ long VAR_3; for(VAR_3=0; VAR_3<=VAR_2-sizeof(long); VAR_3+=sizeof(long)){ long VAR_4 = *(long*)(VAR_1+VAR_3); long VAR_5 = *(long*)(VAR_0+VAR_3); *(long*)(VAR_0+VAR_3) = ((VAR_4&pb_7f) + (VAR_5&pb_7f)) ^ ((VAR_4^VAR_5)&pb_80); } for(; VAR_3<VAR_2; VAR_3++) VAR_0[VAR_3+0] += VAR_1[VAR_3+0]; }
[ "static void FUNC_0(uint8_t *VAR_0, uint8_t *VAR_1, int VAR_2){", "long VAR_3;", "for(VAR_3=0; VAR_3<=VAR_2-sizeof(long); VAR_3+=sizeof(long)){", "long VAR_4 = *(long*)(VAR_1+VAR_3);", "long VAR_5 = *(long*)(VAR_0+VAR_3);", "*(long*)(VAR_0+VAR_3) = ((VAR_4&pb_7f) + (VAR_5&pb_7f)) ^ ((VAR_4^VAR_5)&pb_80);", "}", "for(; VAR_3<VAR_2; VAR_3++)", "VAR_0[VAR_3+0] += VAR_1[VAR_3+0];", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
12,337
static int write_f(BlockBackend *blk, int argc, char **argv) { struct timeval t1, t2; bool Cflag = false, qflag = false, bflag = false; bool Pflag = false, zflag = false, cflag = false; int flags = 0; int c, cnt; char *buf = NULL; int64_t offset; int64_t count; /* Some compilers get confused and warn if this is not initialized. */ int64_t total = 0; int pattern = 0xcd; while ((c = getopt(argc, argv, "bcCfpP:quz")) != -1) { switch (c) { case 'b': bflag = true; break; case 'c': cflag = true; break; case 'C': Cflag = true; break; case 'f': flags |= BDRV_REQ_FUA; break; case 'p': /* Ignored for backwards compatibility */ break; case 'P': Pflag = true; pattern = parse_pattern(optarg); if (pattern < 0) { return 0; } break; case 'q': qflag = true; break; case 'u': flags |= BDRV_REQ_MAY_UNMAP; break; case 'z': zflag = true; break; default: return qemuio_command_usage(&write_cmd); } } if (optind != argc - 2) { return qemuio_command_usage(&write_cmd); } if (bflag && zflag) { printf("-b and -z cannot be specified at the same time\n"); return 0; } if ((flags & BDRV_REQ_FUA) && (bflag || cflag)) { printf("-f and -b or -c cannot be specified at the same time\n"); return 0; } if ((flags & BDRV_REQ_MAY_UNMAP) && !zflag) { printf("-u requires -z to be specified\n"); return 0; } if (zflag && Pflag) { printf("-z and -P cannot be specified at the same time\n"); return 0; } offset = cvtnum(argv[optind]); if (offset < 0) { print_cvtnum_err(offset, argv[optind]); return 0; } optind++; count = cvtnum(argv[optind]); if (count < 0) { print_cvtnum_err(count, argv[optind]); return 0; } else if (count > SIZE_MAX) { printf("length cannot exceed %" PRIu64 ", given %s\n", (uint64_t) SIZE_MAX, argv[optind]); return 0; } if (bflag || cflag) { if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", offset); return 0; } if (count & 0x1ff) { printf("count %"PRId64" is not sector aligned\n", count); return 0; } } if (!zflag) { buf = qemu_io_alloc(blk, count, pattern); } gettimeofday(&t1, NULL); if (bflag) { cnt = do_save_vmstate(blk, buf, offset, count, &total); } else if (zflag) { cnt = do_co_pwrite_zeroes(blk, offset, count, flags, &total); } else if (cflag) { cnt = do_write_compressed(blk, buf, offset, count, &total); } else { cnt = do_pwrite(blk, buf, offset, count, flags, &total); } gettimeofday(&t2, NULL); if (cnt < 0) { printf("write failed: %s\n", strerror(-cnt)); goto out; } if (qflag) { goto out; } /* Finally, report back -- -C gives a parsable format */ t2 = tsub(t2, t1); print_report("wrote", &t2, offset, count, total, cnt, Cflag); out: if (!zflag) { qemu_io_free(buf); } return 0; }
true
qemu
3026c4688ca80d9c5cc1606368c4a1009a6f507d
static int write_f(BlockBackend *blk, int argc, char **argv) { struct timeval t1, t2; bool Cflag = false, qflag = false, bflag = false; bool Pflag = false, zflag = false, cflag = false; int flags = 0; int c, cnt; char *buf = NULL; int64_t offset; int64_t count; int64_t total = 0; int pattern = 0xcd; while ((c = getopt(argc, argv, "bcCfpP:quz")) != -1) { switch (c) { case 'b': bflag = true; break; case 'c': cflag = true; break; case 'C': Cflag = true; break; case 'f': flags |= BDRV_REQ_FUA; break; case 'p': break; case 'P': Pflag = true; pattern = parse_pattern(optarg); if (pattern < 0) { return 0; } break; case 'q': qflag = true; break; case 'u': flags |= BDRV_REQ_MAY_UNMAP; break; case 'z': zflag = true; break; default: return qemuio_command_usage(&write_cmd); } } if (optind != argc - 2) { return qemuio_command_usage(&write_cmd); } if (bflag && zflag) { printf("-b and -z cannot be specified at the same time\n"); return 0; } if ((flags & BDRV_REQ_FUA) && (bflag || cflag)) { printf("-f and -b or -c cannot be specified at the same time\n"); return 0; } if ((flags & BDRV_REQ_MAY_UNMAP) && !zflag) { printf("-u requires -z to be specified\n"); return 0; } if (zflag && Pflag) { printf("-z and -P cannot be specified at the same time\n"); return 0; } offset = cvtnum(argv[optind]); if (offset < 0) { print_cvtnum_err(offset, argv[optind]); return 0; } optind++; count = cvtnum(argv[optind]); if (count < 0) { print_cvtnum_err(count, argv[optind]); return 0; } else if (count > SIZE_MAX) { printf("length cannot exceed %" PRIu64 ", given %s\n", (uint64_t) SIZE_MAX, argv[optind]); return 0; } if (bflag || cflag) { if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", offset); return 0; } if (count & 0x1ff) { printf("count %"PRId64" is not sector aligned\n", count); return 0; } } if (!zflag) { buf = qemu_io_alloc(blk, count, pattern); } gettimeofday(&t1, NULL); if (bflag) { cnt = do_save_vmstate(blk, buf, offset, count, &total); } else if (zflag) { cnt = do_co_pwrite_zeroes(blk, offset, count, flags, &total); } else if (cflag) { cnt = do_write_compressed(blk, buf, offset, count, &total); } else { cnt = do_pwrite(blk, buf, offset, count, flags, &total); } gettimeofday(&t2, NULL); if (cnt < 0) { printf("write failed: %s\n", strerror(-cnt)); goto out; } if (qflag) { goto out; } t2 = tsub(t2, t1); print_report("wrote", &t2, offset, count, total, cnt, Cflag); out: if (!zflag) { qemu_io_free(buf); } return 0; }
{ "code": [ " } else if (count > SIZE_MAX) {", " (uint64_t) SIZE_MAX, argv[optind]);", " } else if (count > SIZE_MAX) {", " (uint64_t) SIZE_MAX, argv[optind]);" ], "line_no": [ 175, 179, 175, 179 ] }
static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2) { struct timeval VAR_3, VAR_4; bool Cflag = false, qflag = false, bflag = false; bool Pflag = false, zflag = false, cflag = false; int VAR_5 = 0; int VAR_6, VAR_7; char *VAR_8 = NULL; int64_t offset; int64_t count; int64_t total = 0; int VAR_9 = 0xcd; while ((VAR_6 = getopt(VAR_1, VAR_2, "bcCfpP:quz")) != -1) { switch (VAR_6) { case 'b': bflag = true; break; case 'VAR_6': cflag = true; break; case 'C': Cflag = true; break; case 'f': VAR_5 |= BDRV_REQ_FUA; break; case 'p': break; case 'P': Pflag = true; VAR_9 = parse_pattern(optarg); if (VAR_9 < 0) { return 0; } break; case 'q': qflag = true; break; case 'u': VAR_5 |= BDRV_REQ_MAY_UNMAP; break; case 'z': zflag = true; break; default: return qemuio_command_usage(&write_cmd); } } if (optind != VAR_1 - 2) { return qemuio_command_usage(&write_cmd); } if (bflag && zflag) { printf("-b and -z cannot be specified at the same time\n"); return 0; } if ((VAR_5 & BDRV_REQ_FUA) && (bflag || cflag)) { printf("-f and -b or -VAR_6 cannot be specified at the same time\n"); return 0; } if ((VAR_5 & BDRV_REQ_MAY_UNMAP) && !zflag) { printf("-u requires -z to be specified\n"); return 0; } if (zflag && Pflag) { printf("-z and -P cannot be specified at the same time\n"); return 0; } offset = cvtnum(VAR_2[optind]); if (offset < 0) { print_cvtnum_err(offset, VAR_2[optind]); return 0; } optind++; count = cvtnum(VAR_2[optind]); if (count < 0) { print_cvtnum_err(count, VAR_2[optind]); return 0; } else if (count > SIZE_MAX) { printf("length cannot exceed %" PRIu64 ", given %s\n", (uint64_t) SIZE_MAX, VAR_2[optind]); return 0; } if (bflag || cflag) { if (offset & 0x1ff) { printf("offset %" PRId64 " is not sector aligned\n", offset); return 0; } if (count & 0x1ff) { printf("count %"PRId64" is not sector aligned\n", count); return 0; } } if (!zflag) { VAR_8 = qemu_io_alloc(VAR_0, count, VAR_9); } gettimeofday(&VAR_3, NULL); if (bflag) { VAR_7 = do_save_vmstate(VAR_0, VAR_8, offset, count, &total); } else if (zflag) { VAR_7 = do_co_pwrite_zeroes(VAR_0, offset, count, VAR_5, &total); } else if (cflag) { VAR_7 = do_write_compressed(VAR_0, VAR_8, offset, count, &total); } else { VAR_7 = do_pwrite(VAR_0, VAR_8, offset, count, VAR_5, &total); } gettimeofday(&VAR_4, NULL); if (VAR_7 < 0) { printf("write failed: %s\n", strerror(-VAR_7)); goto out; } if (qflag) { goto out; } VAR_4 = tsub(VAR_4, VAR_3); print_report("wrote", &VAR_4, offset, count, total, VAR_7, Cflag); out: if (!zflag) { qemu_io_free(VAR_8); } return 0; }
[ "static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2)\n{", "struct timeval VAR_3, VAR_4;", "bool Cflag = false, qflag = false, bflag = false;", "bool Pflag = false, zflag = false, cflag = false;", "int VAR_5 = 0;", "int VAR_6, VAR_7;", "char *VAR_8 = NULL;", "int64_t offset;", "int64_t count;", "int64_t total = 0;", "int VAR_9 = 0xcd;", "while ((VAR_6 = getopt(VAR_1, VAR_2, \"bcCfpP:quz\")) != -1) {", "switch (VAR_6) {", "case 'b':\nbflag = true;", "break;", "case 'VAR_6':\ncflag = true;", "break;", "case 'C':\nCflag = true;", "break;", "case 'f':\nVAR_5 |= BDRV_REQ_FUA;", "break;", "case 'p':\nbreak;", "case 'P':\nPflag = true;", "VAR_9 = parse_pattern(optarg);", "if (VAR_9 < 0) {", "return 0;", "}", "break;", "case 'q':\nqflag = true;", "break;", "case 'u':\nVAR_5 |= BDRV_REQ_MAY_UNMAP;", "break;", "case 'z':\nzflag = true;", "break;", "default:\nreturn qemuio_command_usage(&write_cmd);", "}", "}", "if (optind != VAR_1 - 2) {", "return qemuio_command_usage(&write_cmd);", "}", "if (bflag && zflag) {", "printf(\"-b and -z cannot be specified at the same time\\n\");", "return 0;", "}", "if ((VAR_5 & BDRV_REQ_FUA) && (bflag || cflag)) {", "printf(\"-f and -b or -VAR_6 cannot be specified at the same time\\n\");", "return 0;", "}", "if ((VAR_5 & BDRV_REQ_MAY_UNMAP) && !zflag) {", "printf(\"-u requires -z to be specified\\n\");", "return 0;", "}", "if (zflag && Pflag) {", "printf(\"-z and -P cannot be specified at the same time\\n\");", "return 0;", "}", "offset = cvtnum(VAR_2[optind]);", "if (offset < 0) {", "print_cvtnum_err(offset, VAR_2[optind]);", "return 0;", "}", "optind++;", "count = cvtnum(VAR_2[optind]);", "if (count < 0) {", "print_cvtnum_err(count, VAR_2[optind]);", "return 0;", "} else if (count > SIZE_MAX) {", "printf(\"length cannot exceed %\" PRIu64 \", given %s\\n\",\n(uint64_t) SIZE_MAX, VAR_2[optind]);", "return 0;", "}", "if (bflag || cflag) {", "if (offset & 0x1ff) {", "printf(\"offset %\" PRId64 \" is not sector aligned\\n\",\noffset);", "return 0;", "}", "if (count & 0x1ff) {", "printf(\"count %\"PRId64\" is not sector aligned\\n\",\ncount);", "return 0;", "}", "}", "if (!zflag) {", "VAR_8 = qemu_io_alloc(VAR_0, count, VAR_9);", "}", "gettimeofday(&VAR_3, NULL);", "if (bflag) {", "VAR_7 = do_save_vmstate(VAR_0, VAR_8, offset, count, &total);", "} else if (zflag) {", "VAR_7 = do_co_pwrite_zeroes(VAR_0, offset, count, VAR_5, &total);", "} else if (cflag) {", "VAR_7 = do_write_compressed(VAR_0, VAR_8, offset, count, &total);", "} else {", "VAR_7 = do_pwrite(VAR_0, VAR_8, offset, count, VAR_5, &total);", "}", "gettimeofday(&VAR_4, NULL);", "if (VAR_7 < 0) {", "printf(\"write failed: %s\\n\", strerror(-VAR_7));", "goto out;", "}", "if (qflag) {", "goto out;", "}", "VAR_4 = tsub(VAR_4, VAR_3);", "print_report(\"wrote\", &VAR_4, offset, count, total, VAR_7, Cflag);", "out:\nif (!zflag) {", "qemu_io_free(VAR_8);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57, 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177, 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203, 205 ], [ 207 ], [ 209 ], [ 211 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261 ], [ 267 ], [ 269 ], [ 273, 275 ], [ 277 ], [ 279 ], [ 283 ], [ 285 ] ]
12,338
static int parse_audio(DBEContext *s, int start, int end, int seg_id) { int ch, ret, key = parse_key(s); for (ch = start; ch < end; ch++) { if (!s->ch_size[ch]) { s->channels[seg_id][ch].nb_groups = 0; continue; } if ((ret = convert_input(s, s->ch_size[ch], key)) < 0) return ret; if ((ret = parse_channel(s, ch, seg_id)) < 0) { if (s->avctx->err_recognition & AV_EF_EXPLODE) return ret; s->channels[seg_id][ch].nb_groups = 0; } skip_input(s, s->ch_size[ch]); } skip_input(s, 1); return 0; }
true
FFmpeg
5e715b583dab85735660b15a8d217a69164675fe
static int parse_audio(DBEContext *s, int start, int end, int seg_id) { int ch, ret, key = parse_key(s); for (ch = start; ch < end; ch++) { if (!s->ch_size[ch]) { s->channels[seg_id][ch].nb_groups = 0; continue; } if ((ret = convert_input(s, s->ch_size[ch], key)) < 0) return ret; if ((ret = parse_channel(s, ch, seg_id)) < 0) { if (s->avctx->err_recognition & AV_EF_EXPLODE) return ret; s->channels[seg_id][ch].nb_groups = 0; } skip_input(s, s->ch_size[ch]); } skip_input(s, 1); return 0; }
{ "code": [ " return 0;", " int ch, ret, key = parse_key(s);", " skip_input(s, s->ch_size[ch]);", " skip_input(s, 1);", " return 0;" ], "line_no": [ 41, 5, 33, 39, 41 ] }
static int FUNC_0(DBEContext *VAR_0, int VAR_1, int VAR_2, int VAR_3) { int VAR_4, VAR_5, VAR_6 = parse_key(VAR_0); for (VAR_4 = VAR_1; VAR_4 < VAR_2; VAR_4++) { if (!VAR_0->ch_size[VAR_4]) { VAR_0->channels[VAR_3][VAR_4].nb_groups = 0; continue; } if ((VAR_5 = convert_input(VAR_0, VAR_0->ch_size[VAR_4], VAR_6)) < 0) return VAR_5; if ((VAR_5 = parse_channel(VAR_0, VAR_4, VAR_3)) < 0) { if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE) return VAR_5; VAR_0->channels[VAR_3][VAR_4].nb_groups = 0; } skip_input(VAR_0, VAR_0->ch_size[VAR_4]); } skip_input(VAR_0, 1); return 0; }
[ "static int FUNC_0(DBEContext *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5, VAR_6 = parse_key(VAR_0);", "for (VAR_4 = VAR_1; VAR_4 < VAR_2; VAR_4++) {", "if (!VAR_0->ch_size[VAR_4]) {", "VAR_0->channels[VAR_3][VAR_4].nb_groups = 0;", "continue;", "}", "if ((VAR_5 = convert_input(VAR_0, VAR_0->ch_size[VAR_4], VAR_6)) < 0)\nreturn VAR_5;", "if ((VAR_5 = parse_channel(VAR_0, VAR_4, VAR_3)) < 0) {", "if (VAR_0->avctx->err_recognition & AV_EF_EXPLODE)\nreturn VAR_5;", "VAR_0->channels[VAR_3][VAR_4].nb_groups = 0;", "}", "skip_input(VAR_0, VAR_0->ch_size[VAR_4]);", "}", "skip_input(VAR_0, 1);", "return 0;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ] ]
12,339
static void qemu_input_queue_process(void *opaque) { struct QemuInputEventQueueHead *queue = opaque; QemuInputEventQueue *item; g_assert(!QTAILQ_EMPTY(queue)); item = QTAILQ_FIRST(queue); g_assert(item->type == QEMU_INPUT_QUEUE_DELAY); QTAILQ_REMOVE(queue, item, node); g_free(item); while (!QTAILQ_EMPTY(queue)) { item = QTAILQ_FIRST(queue); switch (item->type) { case QEMU_INPUT_QUEUE_DELAY: timer_mod(item->timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + item->delay_ms); return; case QEMU_INPUT_QUEUE_EVENT: qemu_input_event_send(item->src, item->evt); qapi_free_InputEvent(item->evt); break; case QEMU_INPUT_QUEUE_SYNC: qemu_input_event_sync(); break; } QTAILQ_REMOVE(queue, item, node); g_free(item); } }
true
qemu
77b0359bf414ad666d1714dc9888f1017c08e283
static void qemu_input_queue_process(void *opaque) { struct QemuInputEventQueueHead *queue = opaque; QemuInputEventQueue *item; g_assert(!QTAILQ_EMPTY(queue)); item = QTAILQ_FIRST(queue); g_assert(item->type == QEMU_INPUT_QUEUE_DELAY); QTAILQ_REMOVE(queue, item, node); g_free(item); while (!QTAILQ_EMPTY(queue)) { item = QTAILQ_FIRST(queue); switch (item->type) { case QEMU_INPUT_QUEUE_DELAY: timer_mod(item->timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + item->delay_ms); return; case QEMU_INPUT_QUEUE_EVENT: qemu_input_event_send(item->src, item->evt); qapi_free_InputEvent(item->evt); break; case QEMU_INPUT_QUEUE_SYNC: qemu_input_event_sync(); break; } QTAILQ_REMOVE(queue, item, node); g_free(item); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0) { struct QemuInputEventQueueHead *VAR_1 = VAR_0; QemuInputEventQueue *item; g_assert(!QTAILQ_EMPTY(VAR_1)); item = QTAILQ_FIRST(VAR_1); g_assert(item->type == QEMU_INPUT_QUEUE_DELAY); QTAILQ_REMOVE(VAR_1, item, node); g_free(item); while (!QTAILQ_EMPTY(VAR_1)) { item = QTAILQ_FIRST(VAR_1); switch (item->type) { case QEMU_INPUT_QUEUE_DELAY: timer_mod(item->timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + item->delay_ms); return; case QEMU_INPUT_QUEUE_EVENT: qemu_input_event_send(item->src, item->evt); qapi_free_InputEvent(item->evt); break; case QEMU_INPUT_QUEUE_SYNC: qemu_input_event_sync(); break; } QTAILQ_REMOVE(VAR_1, item, node); g_free(item); } }
[ "static void FUNC_0(void *VAR_0)\n{", "struct QemuInputEventQueueHead *VAR_1 = VAR_0;", "QemuInputEventQueue *item;", "g_assert(!QTAILQ_EMPTY(VAR_1));", "item = QTAILQ_FIRST(VAR_1);", "g_assert(item->type == QEMU_INPUT_QUEUE_DELAY);", "QTAILQ_REMOVE(VAR_1, item, node);", "g_free(item);", "while (!QTAILQ_EMPTY(VAR_1)) {", "item = QTAILQ_FIRST(VAR_1);", "switch (item->type) {", "case QEMU_INPUT_QUEUE_DELAY:\ntimer_mod(item->timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL)\n+ item->delay_ms);", "return;", "case QEMU_INPUT_QUEUE_EVENT:\nqemu_input_event_send(item->src, item->evt);", "qapi_free_InputEvent(item->evt);", "break;", "case QEMU_INPUT_QUEUE_SYNC:\nqemu_input_event_sync();", "break;", "}", "QTAILQ_REMOVE(VAR_1, item, node);", "g_free(item);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 20 ], [ 24 ], [ 26 ], [ 28 ], [ 30, 32, 34 ], [ 36 ], [ 38, 40 ], [ 42 ], [ 44 ], [ 46, 48 ], [ 50 ], [ 52 ], [ 54 ], [ 57 ], [ 59 ], [ 61 ] ]
12,340
static void vhost_scsi_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VHostSCSI *s = VHOST_SCSI(dev); migrate_del_blocker(s->migration_blocker); error_free(s->migration_blocker); /* This will stop vhost backend. */ vhost_scsi_set_status(vdev, 0); g_free(s->dev.vqs); virtio_scsi_common_unrealize(dev, errp); }
true
qemu
af103c9310b7ab56a2552965d9d1274b0024f27b
static void vhost_scsi_unrealize(DeviceState *dev, Error **errp) { VirtIODevice *vdev = VIRTIO_DEVICE(dev); VHostSCSI *s = VHOST_SCSI(dev); migrate_del_blocker(s->migration_blocker); error_free(s->migration_blocker); vhost_scsi_set_status(vdev, 0); g_free(s->dev.vqs); virtio_scsi_common_unrealize(dev, errp); }
{ "code": [], "line_no": [] }
static void FUNC_0(DeviceState *VAR_0, Error **VAR_1) { VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0); VHostSCSI *s = VHOST_SCSI(VAR_0); migrate_del_blocker(s->migration_blocker); error_free(s->migration_blocker); vhost_scsi_set_status(vdev, 0); g_free(s->VAR_0.vqs); virtio_scsi_common_unrealize(VAR_0, VAR_1); }
[ "static void FUNC_0(DeviceState *VAR_0, Error **VAR_1)\n{", "VirtIODevice *vdev = VIRTIO_DEVICE(VAR_0);", "VHostSCSI *s = VHOST_SCSI(VAR_0);", "migrate_del_blocker(s->migration_blocker);", "error_free(s->migration_blocker);", "vhost_scsi_set_status(vdev, 0);", "g_free(s->VAR_0.vqs);", "virtio_scsi_common_unrealize(VAR_0, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 19 ], [ 24 ], [ 28 ], [ 30 ] ]