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
8,232
static int parse_picture_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { PGSSubContext *ctx = avctx->priv_data; uint8_t sequence_desc; unsigned int rle_bitmap_len, width, height; uint16_t picture_id; if (buf_size <= 4) return -1; buf_size -= 4; picture_id = bytestream_get_be16(&buf); /* skip 1 unknown byte: Version Number */ buf++; /* Read the Sequence Description to determine if start of RLE data or appended to previous RLE */ sequence_desc = bytestream_get_byte(&buf); if (!(sequence_desc & 0x80)) { /* Additional RLE data */ if (buf_size > ctx->pictures[picture_id].rle_remaining_len) return -1; memcpy(ctx->pictures[picture_id].rle + ctx->pictures[picture_id].rle_data_len, buf, buf_size); ctx->pictures[picture_id].rle_data_len += buf_size; ctx->pictures[picture_id].rle_remaining_len -= buf_size; return 0; } if (buf_size <= 7) return -1; buf_size -= 7; /* Decode rle bitmap length, stored size includes width/height data */ rle_bitmap_len = bytestream_get_be24(&buf) - 2*2; /* Get bitmap dimensions from data */ width = bytestream_get_be16(&buf); height = bytestream_get_be16(&buf); /* Make sure the bitmap is not too large */ if (avctx->width < width || avctx->height < height) { av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions larger than video.\n"); return -1; } if (buf_size > rle_bitmap_len) { av_log(avctx, AV_LOG_ERROR, "too much RLE data\n"); return AVERROR_INVALIDDATA; } ctx->pictures[picture_id].w = width; ctx->pictures[picture_id].h = height; av_fast_malloc(&ctx->pictures[picture_id].rle, &ctx->pictures[picture_id].rle_buffer_size, rle_bitmap_len); if (!ctx->pictures[picture_id].rle) return -1; memcpy(ctx->pictures[picture_id].rle, buf, buf_size); ctx->pictures[picture_id].rle_data_len = buf_size; ctx->pictures[picture_id].rle_remaining_len = rle_bitmap_len - buf_size; return 0; }
true
FFmpeg
1a01dc83434fbdd1f6604c73afc022795bfb4783
static int parse_picture_segment(AVCodecContext *avctx, const uint8_t *buf, int buf_size) { PGSSubContext *ctx = avctx->priv_data; uint8_t sequence_desc; unsigned int rle_bitmap_len, width, height; uint16_t picture_id; if (buf_size <= 4) return -1; buf_size -= 4; picture_id = bytestream_get_be16(&buf); buf++; sequence_desc = bytestream_get_byte(&buf); if (!(sequence_desc & 0x80)) { if (buf_size > ctx->pictures[picture_id].rle_remaining_len) return -1; memcpy(ctx->pictures[picture_id].rle + ctx->pictures[picture_id].rle_data_len, buf, buf_size); ctx->pictures[picture_id].rle_data_len += buf_size; ctx->pictures[picture_id].rle_remaining_len -= buf_size; return 0; } if (buf_size <= 7) return -1; buf_size -= 7; rle_bitmap_len = bytestream_get_be24(&buf) - 2*2; width = bytestream_get_be16(&buf); height = bytestream_get_be16(&buf); if (avctx->width < width || avctx->height < height) { av_log(avctx, AV_LOG_ERROR, "Bitmap dimensions larger than video.\n"); return -1; } if (buf_size > rle_bitmap_len) { av_log(avctx, AV_LOG_ERROR, "too much RLE data\n"); return AVERROR_INVALIDDATA; } ctx->pictures[picture_id].w = width; ctx->pictures[picture_id].h = height; av_fast_malloc(&ctx->pictures[picture_id].rle, &ctx->pictures[picture_id].rle_buffer_size, rle_bitmap_len); if (!ctx->pictures[picture_id].rle) return -1; memcpy(ctx->pictures[picture_id].rle, buf, buf_size); ctx->pictures[picture_id].rle_data_len = buf_size; ctx->pictures[picture_id].rle_remaining_len = rle_bitmap_len - buf_size; return 0; }
{ "code": [ " av_fast_malloc(&ctx->pictures[picture_id].rle, &ctx->pictures[picture_id].rle_buffer_size, rle_bitmap_len);" ], "line_no": [ 117 ] }
static int FUNC_0(AVCodecContext *VAR_0, const uint8_t *VAR_1, int VAR_2) { PGSSubContext *ctx = VAR_0->priv_data; uint8_t sequence_desc; unsigned int VAR_3, VAR_4, VAR_5; uint16_t picture_id; if (VAR_2 <= 4) return -1; VAR_2 -= 4; picture_id = bytestream_get_be16(&VAR_1); VAR_1++; sequence_desc = bytestream_get_byte(&VAR_1); if (!(sequence_desc & 0x80)) { if (VAR_2 > ctx->pictures[picture_id].rle_remaining_len) return -1; memcpy(ctx->pictures[picture_id].rle + ctx->pictures[picture_id].rle_data_len, VAR_1, VAR_2); ctx->pictures[picture_id].rle_data_len += VAR_2; ctx->pictures[picture_id].rle_remaining_len -= VAR_2; return 0; } if (VAR_2 <= 7) return -1; VAR_2 -= 7; VAR_3 = bytestream_get_be24(&VAR_1) - 2*2; VAR_4 = bytestream_get_be16(&VAR_1); VAR_5 = bytestream_get_be16(&VAR_1); if (VAR_0->VAR_4 < VAR_4 || VAR_0->VAR_5 < VAR_5) { av_log(VAR_0, AV_LOG_ERROR, "Bitmap dimensions larger than video.\n"); return -1; } if (VAR_2 > VAR_3) { av_log(VAR_0, AV_LOG_ERROR, "too much RLE data\n"); return AVERROR_INVALIDDATA; } ctx->pictures[picture_id].w = VAR_4; ctx->pictures[picture_id].h = VAR_5; av_fast_malloc(&ctx->pictures[picture_id].rle, &ctx->pictures[picture_id].rle_buffer_size, VAR_3); if (!ctx->pictures[picture_id].rle) return -1; memcpy(ctx->pictures[picture_id].rle, VAR_1, VAR_2); ctx->pictures[picture_id].rle_data_len = VAR_2; ctx->pictures[picture_id].rle_remaining_len = VAR_3 - VAR_2; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0,\nconst uint8_t *VAR_1, int VAR_2)\n{", "PGSSubContext *ctx = VAR_0->priv_data;", "uint8_t sequence_desc;", "unsigned int VAR_3, VAR_4, VAR_5;", "uint16_t picture_id;", "if (VAR_2 <= 4)\nreturn -1;", "VAR_2 -= 4;", "picture_id = bytestream_get_be16(&VAR_1);", "VAR_1++;", "sequence_desc = bytestream_get_byte(&VAR_1);", "if (!(sequence_desc & 0x80)) {", "if (VAR_2 > ctx->pictures[picture_id].rle_remaining_len)\nreturn -1;", "memcpy(ctx->pictures[picture_id].rle + ctx->pictures[picture_id].rle_data_len, VAR_1, VAR_2);", "ctx->pictures[picture_id].rle_data_len += VAR_2;", "ctx->pictures[picture_id].rle_remaining_len -= VAR_2;", "return 0;", "}", "if (VAR_2 <= 7)\nreturn -1;", "VAR_2 -= 7;", "VAR_3 = bytestream_get_be24(&VAR_1) - 2*2;", "VAR_4 = bytestream_get_be16(&VAR_1);", "VAR_5 = bytestream_get_be16(&VAR_1);", "if (VAR_0->VAR_4 < VAR_4 || VAR_0->VAR_5 < VAR_5) {", "av_log(VAR_0, AV_LOG_ERROR, \"Bitmap dimensions larger than video.\\n\");", "return -1;", "}", "if (VAR_2 > VAR_3) {", "av_log(VAR_0, AV_LOG_ERROR, \"too much RLE data\\n\");", "return AVERROR_INVALIDDATA;", "}", "ctx->pictures[picture_id].w = VAR_4;", "ctx->pictures[picture_id].h = VAR_5;", "av_fast_malloc(&ctx->pictures[picture_id].rle, &ctx->pictures[picture_id].rle_buffer_size, VAR_3);", "if (!ctx->pictures[picture_id].rle)\nreturn -1;", "memcpy(ctx->pictures[picture_id].rle, VAR_1, VAR_2);", "ctx->pictures[picture_id].rle_data_len = VAR_2;", "ctx->pictures[picture_id].rle_remaining_len = VAR_3 - VAR_2;", "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, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 33 ], [ 39 ], [ 43 ], [ 47, 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67, 69 ], [ 71 ], [ 77 ], [ 83 ], [ 85 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 117 ], [ 121, 123 ], [ 127 ], [ 129 ], [ 131 ], [ 135 ], [ 137 ] ]
8,234
static void sun4m_fdc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->props = sun4m_fdc_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); }
true
qemu
e4f4fb1eca795e36f363b4647724221e774523c1
static void sun4m_fdc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->props = sun4m_fdc_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->props = sun4m_fdc_properties; set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->props = sun4m_fdc_properties;", "set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 18 ] ]
8,235
static int64_t get_pts(const char *buf, int *duration) { int i, hour, min, sec, hsec; int he, me, se, mse; for (i=0; i<2; i++) { int64_t start, end; if (sscanf(buf, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d", &hour, &min, &sec, &hsec, &he, &me, &se, &mse) == 8) { min += 60*hour; sec += 60*min; start = sec*1000+hsec; me += 60*he; se += 60*me; end = se*1000+mse; *duration = end - start; return start; } buf += strcspn(buf, "\n") + 1; } return AV_NOPTS_VALUE; }
true
FFmpeg
a96b39de622592cb595bf20ae009ed415b98cde9
static int64_t get_pts(const char *buf, int *duration) { int i, hour, min, sec, hsec; int he, me, se, mse; for (i=0; i<2; i++) { int64_t start, end; if (sscanf(buf, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d", &hour, &min, &sec, &hsec, &he, &me, &se, &mse) == 8) { min += 60*hour; sec += 60*min; start = sec*1000+hsec; me += 60*he; se += 60*me; end = se*1000+mse; *duration = end - start; return start; } buf += strcspn(buf, "\n") + 1; } return AV_NOPTS_VALUE; }
{ "code": [ " int i, hour, min, sec, hsec;", " int he, me, se, mse;", " int64_t start, end;", " &hour, &min, &sec, &hsec, &he, &me, &se, &mse) == 8) {", " min += 60*hour;", " sec += 60*min;", " start = sec*1000+hsec;", " me += 60*he;", " se += 60*me;", " end = se*1000+mse;" ], "line_no": [ 5, 7, 13, 17, 19, 21, 23, 25, 27, 29 ] }
static int64_t FUNC_0(const char *buf, int *duration) { int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4; int VAR_5, VAR_6, VAR_7, VAR_8; for (VAR_0=0; VAR_0<2; VAR_0++) { int64_t start, end; if (sscanf(buf, "%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d", &VAR_1, &VAR_2, &VAR_3, &VAR_4, &VAR_5, &VAR_6, &VAR_7, &VAR_8) == 8) { VAR_2 += 60*VAR_1; VAR_3 += 60*VAR_2; start = VAR_3*1000+VAR_4; VAR_6 += 60*VAR_5; VAR_7 += 60*VAR_6; end = VAR_7*1000+VAR_8; *duration = end - start; return start; } buf += strcspn(buf, "\n") + 1; } return AV_NOPTS_VALUE; }
[ "static int64_t FUNC_0(const char *buf, int *duration)\n{", "int VAR_0, VAR_1, VAR_2, VAR_3, VAR_4;", "int VAR_5, VAR_6, VAR_7, VAR_8;", "for (VAR_0=0; VAR_0<2; VAR_0++) {", "int64_t start, end;", "if (sscanf(buf, \"%d:%2d:%2d%*1[,.]%3d --> %d:%2d:%2d%*1[,.]%3d\",\n&VAR_1, &VAR_2, &VAR_3, &VAR_4, &VAR_5, &VAR_6, &VAR_7, &VAR_8) == 8) {", "VAR_2 += 60*VAR_1;", "VAR_3 += 60*VAR_2;", "start = VAR_3*1000+VAR_4;", "VAR_6 += 60*VAR_5;", "VAR_7 += 60*VAR_6;", "end = VAR_7*1000+VAR_8;", "*duration = end - start;", "return start;", "}", "buf += strcspn(buf, \"\\n\") + 1;", "}", "return AV_NOPTS_VALUE;", "}" ]
[ 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 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 ] ]
8,236
void qemu_savevm_state_begin(QEMUFile *f, const MigrationParams *params) { SaveStateEntry *se; int ret; trace_savevm_state_begin(); QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || !se->ops->set_params) { continue; } se->ops->set_params(params, se->opaque); } QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || !se->ops->save_live_setup) { continue; } if (se->ops && se->ops->is_active) { if (!se->ops->is_active(se->opaque)) { continue; } } save_section_header(f, se, QEMU_VM_SECTION_START); ret = se->ops->save_live_setup(f, se->opaque); if (ret < 0) { qemu_file_set_error(f, ret); break; } } }
true
qemu
f68945d42bab700d95b87f62e0898606ce2421ed
void qemu_savevm_state_begin(QEMUFile *f, const MigrationParams *params) { SaveStateEntry *se; int ret; trace_savevm_state_begin(); QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || !se->ops->set_params) { continue; } se->ops->set_params(params, se->opaque); } QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || !se->ops->save_live_setup) { continue; } if (se->ops && se->ops->is_active) { if (!se->ops->is_active(se->opaque)) { continue; } } save_section_header(f, se, QEMU_VM_SECTION_START); ret = se->ops->save_live_setup(f, se->opaque); if (ret < 0) { qemu_file_set_error(f, ret); break; } } }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUFile *VAR_0, const MigrationParams *VAR_1) { SaveStateEntry *se; int VAR_2; trace_savevm_state_begin(); QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || !se->ops->set_params) { continue; } se->ops->set_params(VAR_1, se->opaque); } QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (!se->ops || !se->ops->save_live_setup) { continue; } if (se->ops && se->ops->is_active) { if (!se->ops->is_active(se->opaque)) { continue; } } save_section_header(VAR_0, se, QEMU_VM_SECTION_START); VAR_2 = se->ops->save_live_setup(VAR_0, se->opaque); if (VAR_2 < 0) { qemu_file_set_error(VAR_0, VAR_2); break; } } }
[ "void FUNC_0(QEMUFile *VAR_0,\nconst MigrationParams *VAR_1)\n{", "SaveStateEntry *se;", "int VAR_2;", "trace_savevm_state_begin();", "QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {", "if (!se->ops || !se->ops->set_params) {", "continue;", "}", "se->ops->set_params(VAR_1, se->opaque);", "}", "QTAILQ_FOREACH(se, &savevm_state.handlers, entry) {", "if (!se->ops || !se->ops->save_live_setup) {", "continue;", "}", "if (se->ops && se->ops->is_active) {", "if (!se->ops->is_active(se->opaque)) {", "continue;", "}", "}", "save_section_header(VAR_0, se, QEMU_VM_SECTION_START);", "VAR_2 = se->ops->save_live_setup(VAR_0, se->opaque);", "if (VAR_2 < 0) {", "qemu_file_set_error(VAR_0, VAR_2);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 54 ], [ 56 ], [ 58 ], [ 60 ], [ 62 ], [ 64 ] ]
8,237
static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf, int len) { VirtualConsole *vc = chr->opaque; return vc ? write(vc->fd, buf, len) : len; }
true
qemu
d4370741402a97b8b6d0c38fef18ab38bf25ab22
static int gd_vc_chr_write(CharDriverState *chr, const uint8_t *buf, int len) { VirtualConsole *vc = chr->opaque; return vc ? write(vc->fd, buf, len) : len; }
{ "code": [ " return vc ? write(vc->fd, buf, len) : len;" ], "line_no": [ 9 ] }
static int FUNC_0(CharDriverState *VAR_0, const uint8_t *VAR_1, int VAR_2) { VirtualConsole *vc = VAR_0->opaque; return vc ? write(vc->fd, VAR_1, VAR_2) : VAR_2; }
[ "static int FUNC_0(CharDriverState *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "VirtualConsole *vc = VAR_0->opaque;", "return vc ? write(vc->fd, VAR_1, VAR_2) : VAR_2;", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
8,238
int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx) { if (!strcasecmp(color_string, "random") || !strcasecmp(color_string, "bikeshed")) { int rgba = av_get_random_seed(); rgba_color[0] = rgba >> 24; rgba_color[1] = rgba >> 16; rgba_color[2] = rgba >> 8; rgba_color[3] = rgba; } else if (!strncmp(color_string, "0x", 2)) { char *tail; int len = strlen(color_string); unsigned int rgba = strtoul(color_string, &tail, 16); if (*tail || (len != 8 && len != 10)) { av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string); return AVERROR(EINVAL); } if (len == 10) { rgba_color[3] = rgba; rgba >>= 8; } rgba_color[0] = rgba >> 16; rgba_color[1] = rgba >> 8; rgba_color[2] = rgba; } else { const ColorEntry *entry = bsearch(color_string, color_table, FF_ARRAY_ELEMS(color_table), sizeof(ColorEntry), color_table_compare); if (!entry) { av_log(log_ctx, AV_LOG_ERROR, "Cannot find color '%s'\n", color_string); return AVERROR(EINVAL); } memcpy(rgba_color, entry->rgba_color, 4); } return 0; }
false
FFmpeg
8e094dd6674e3fd503e1fc2f68883fd3f73a5bd1
int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx) { if (!strcasecmp(color_string, "random") || !strcasecmp(color_string, "bikeshed")) { int rgba = av_get_random_seed(); rgba_color[0] = rgba >> 24; rgba_color[1] = rgba >> 16; rgba_color[2] = rgba >> 8; rgba_color[3] = rgba; } else if (!strncmp(color_string, "0x", 2)) { char *tail; int len = strlen(color_string); unsigned int rgba = strtoul(color_string, &tail, 16); if (*tail || (len != 8 && len != 10)) { av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string); return AVERROR(EINVAL); } if (len == 10) { rgba_color[3] = rgba; rgba >>= 8; } rgba_color[0] = rgba >> 16; rgba_color[1] = rgba >> 8; rgba_color[2] = rgba; } else { const ColorEntry *entry = bsearch(color_string, color_table, FF_ARRAY_ELEMS(color_table), sizeof(ColorEntry), color_table_compare); if (!entry) { av_log(log_ctx, AV_LOG_ERROR, "Cannot find color '%s'\n", color_string); return AVERROR(EINVAL); } memcpy(rgba_color, entry->rgba_color, 4); } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(uint8_t *VAR_0, const char *VAR_1, void *VAR_2) { if (!strcasecmp(VAR_1, "random") || !strcasecmp(VAR_1, "bikeshed")) { int VAR_6 = av_get_random_seed(); VAR_0[0] = VAR_6 >> 24; VAR_0[1] = VAR_6 >> 16; VAR_0[2] = VAR_6 >> 8; VAR_0[3] = VAR_6; } else if (!strncmp(VAR_1, "0x", 2)) { char *VAR_4; int VAR_5 = strlen(VAR_1); unsigned int VAR_6 = strtoul(VAR_1, &VAR_4, 16); if (*VAR_4 || (VAR_5 != 8 && VAR_5 != 10)) { av_log(VAR_2, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", VAR_1); return AVERROR(EINVAL); } if (VAR_5 == 10) { VAR_0[3] = VAR_6; VAR_6 >>= 8; } VAR_0[0] = VAR_6 >> 16; VAR_0[1] = VAR_6 >> 8; VAR_0[2] = VAR_6; } else { const ColorEntry *VAR_6 = bsearch(VAR_1, color_table, FF_ARRAY_ELEMS(color_table), sizeof(ColorEntry), color_table_compare); if (!VAR_6) { av_log(VAR_2, AV_LOG_ERROR, "Cannot find color '%s'\n", VAR_1); return AVERROR(EINVAL); } memcpy(VAR_0, VAR_6->VAR_0, 4); } return 0; }
[ "int FUNC_0(uint8_t *VAR_0, const char *VAR_1, void *VAR_2)\n{", "if (!strcasecmp(VAR_1, \"random\") || !strcasecmp(VAR_1, \"bikeshed\")) {", "int VAR_6 = av_get_random_seed();", "VAR_0[0] = VAR_6 >> 24;", "VAR_0[1] = VAR_6 >> 16;", "VAR_0[2] = VAR_6 >> 8;", "VAR_0[3] = VAR_6;", "} else", "if (!strncmp(VAR_1, \"0x\", 2)) {", "char *VAR_4;", "int VAR_5 = strlen(VAR_1);", "unsigned int VAR_6 = strtoul(VAR_1, &VAR_4, 16);", "if (*VAR_4 || (VAR_5 != 8 && VAR_5 != 10)) {", "av_log(VAR_2, AV_LOG_ERROR, \"Invalid 0xRRGGBB[AA] color string: '%s'\\n\", VAR_1);", "return AVERROR(EINVAL);", "}", "if (VAR_5 == 10) {", "VAR_0[3] = VAR_6;", "VAR_6 >>= 8;", "}", "VAR_0[0] = VAR_6 >> 16;", "VAR_0[1] = VAR_6 >> 8;", "VAR_0[2] = VAR_6;", "} else {", "const ColorEntry *VAR_6 = bsearch(VAR_1,\ncolor_table,\nFF_ARRAY_ELEMS(color_table),\nsizeof(ColorEntry),\ncolor_table_compare);", "if (!VAR_6) {", "av_log(VAR_2, AV_LOG_ERROR, \"Cannot find color '%s'\\n\", VAR_1);", "return AVERROR(EINVAL);", "}", "memcpy(VAR_0, VAR_6->VAR_0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 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 ], [ 77 ], [ 79 ] ]
8,239
av_cold int ff_mjpeg_encode_init(MpegEncContext *s) { MJpegContext *m; av_assert0(s->slice_context_count == 1); if (s->width > 65500 || s->height > 65500) { av_log(s, AV_LOG_ERROR, "JPEG does not support resolutions above 65500x65500\n"); return AVERROR(EINVAL); } m = av_malloc(sizeof(MJpegContext)); if (!m) return AVERROR(ENOMEM); s->min_qcoeff=-1023; s->max_qcoeff= 1023; // Build default Huffman tables. // These may be overwritten later with more optimal Huffman tables, but // they are needed at least right now for some processes like trellis. ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance, m->huff_code_dc_luminance, avpriv_mjpeg_bits_dc_luminance, avpriv_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance, m->huff_code_dc_chrominance, avpriv_mjpeg_bits_dc_chrominance, avpriv_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance, m->huff_code_ac_luminance, avpriv_mjpeg_bits_ac_luminance, avpriv_mjpeg_val_ac_luminance); ff_mjpeg_build_huffman_codes(m->huff_size_ac_chrominance, m->huff_code_ac_chrominance, avpriv_mjpeg_bits_ac_chrominance, avpriv_mjpeg_val_ac_chrominance); ff_init_uni_ac_vlc(m->huff_size_ac_luminance, m->uni_ac_vlc_len); ff_init_uni_ac_vlc(m->huff_size_ac_chrominance, m->uni_chroma_ac_vlc_len); s->intra_ac_vlc_length = s->intra_ac_vlc_last_length = m->uni_ac_vlc_len; s->intra_chroma_ac_vlc_length = s->intra_chroma_ac_vlc_last_length = m->uni_chroma_ac_vlc_len; // Buffers start out empty. m->huff_ncode = 0; s->mjpeg_ctx = m; return alloc_huffman(s); }
false
FFmpeg
3e1507a9547ac09b6ff4372123cde09f19218f3d
av_cold int ff_mjpeg_encode_init(MpegEncContext *s) { MJpegContext *m; av_assert0(s->slice_context_count == 1); if (s->width > 65500 || s->height > 65500) { av_log(s, AV_LOG_ERROR, "JPEG does not support resolutions above 65500x65500\n"); return AVERROR(EINVAL); } m = av_malloc(sizeof(MJpegContext)); if (!m) return AVERROR(ENOMEM); s->min_qcoeff=-1023; s->max_qcoeff= 1023; ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance, m->huff_code_dc_luminance, avpriv_mjpeg_bits_dc_luminance, avpriv_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance, m->huff_code_dc_chrominance, avpriv_mjpeg_bits_dc_chrominance, avpriv_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance, m->huff_code_ac_luminance, avpriv_mjpeg_bits_ac_luminance, avpriv_mjpeg_val_ac_luminance); ff_mjpeg_build_huffman_codes(m->huff_size_ac_chrominance, m->huff_code_ac_chrominance, avpriv_mjpeg_bits_ac_chrominance, avpriv_mjpeg_val_ac_chrominance); ff_init_uni_ac_vlc(m->huff_size_ac_luminance, m->uni_ac_vlc_len); ff_init_uni_ac_vlc(m->huff_size_ac_chrominance, m->uni_chroma_ac_vlc_len); s->intra_ac_vlc_length = s->intra_ac_vlc_last_length = m->uni_ac_vlc_len; s->intra_chroma_ac_vlc_length = s->intra_chroma_ac_vlc_last_length = m->uni_chroma_ac_vlc_len; m->huff_ncode = 0; s->mjpeg_ctx = m; return alloc_huffman(s); }
{ "code": [], "line_no": [] }
av_cold int FUNC_0(MpegEncContext *s) { MJpegContext *m; av_assert0(s->slice_context_count == 1); if (s->width > 65500 || s->height > 65500) { av_log(s, AV_LOG_ERROR, "JPEG does not support resolutions above 65500x65500\n"); return AVERROR(EINVAL); } m = av_malloc(sizeof(MJpegContext)); if (!m) return AVERROR(ENOMEM); s->min_qcoeff=-1023; s->max_qcoeff= 1023; ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance, m->huff_code_dc_luminance, avpriv_mjpeg_bits_dc_luminance, avpriv_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance, m->huff_code_dc_chrominance, avpriv_mjpeg_bits_dc_chrominance, avpriv_mjpeg_val_dc); ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance, m->huff_code_ac_luminance, avpriv_mjpeg_bits_ac_luminance, avpriv_mjpeg_val_ac_luminance); ff_mjpeg_build_huffman_codes(m->huff_size_ac_chrominance, m->huff_code_ac_chrominance, avpriv_mjpeg_bits_ac_chrominance, avpriv_mjpeg_val_ac_chrominance); ff_init_uni_ac_vlc(m->huff_size_ac_luminance, m->uni_ac_vlc_len); ff_init_uni_ac_vlc(m->huff_size_ac_chrominance, m->uni_chroma_ac_vlc_len); s->intra_ac_vlc_length = s->intra_ac_vlc_last_length = m->uni_ac_vlc_len; s->intra_chroma_ac_vlc_length = s->intra_chroma_ac_vlc_last_length = m->uni_chroma_ac_vlc_len; m->huff_ncode = 0; s->mjpeg_ctx = m; return alloc_huffman(s); }
[ "av_cold int FUNC_0(MpegEncContext *s)\n{", "MJpegContext *m;", "av_assert0(s->slice_context_count == 1);", "if (s->width > 65500 || s->height > 65500) {", "av_log(s, AV_LOG_ERROR, \"JPEG does not support resolutions above 65500x65500\\n\");", "return AVERROR(EINVAL);", "}", "m = av_malloc(sizeof(MJpegContext));", "if (!m)\nreturn AVERROR(ENOMEM);", "s->min_qcoeff=-1023;", "s->max_qcoeff= 1023;", "ff_mjpeg_build_huffman_codes(m->huff_size_dc_luminance,\nm->huff_code_dc_luminance,\navpriv_mjpeg_bits_dc_luminance,\navpriv_mjpeg_val_dc);", "ff_mjpeg_build_huffman_codes(m->huff_size_dc_chrominance,\nm->huff_code_dc_chrominance,\navpriv_mjpeg_bits_dc_chrominance,\navpriv_mjpeg_val_dc);", "ff_mjpeg_build_huffman_codes(m->huff_size_ac_luminance,\nm->huff_code_ac_luminance,\navpriv_mjpeg_bits_ac_luminance,\navpriv_mjpeg_val_ac_luminance);", "ff_mjpeg_build_huffman_codes(m->huff_size_ac_chrominance,\nm->huff_code_ac_chrominance,\navpriv_mjpeg_bits_ac_chrominance,\navpriv_mjpeg_val_ac_chrominance);", "ff_init_uni_ac_vlc(m->huff_size_ac_luminance, m->uni_ac_vlc_len);", "ff_init_uni_ac_vlc(m->huff_size_ac_chrominance, m->uni_chroma_ac_vlc_len);", "s->intra_ac_vlc_length =\ns->intra_ac_vlc_last_length = m->uni_ac_vlc_len;", "s->intra_chroma_ac_vlc_length =\ns->intra_chroma_ac_vlc_last_length = m->uni_chroma_ac_vlc_len;", "m->huff_ncode = 0;", "s->mjpeg_ctx = m;", "return alloc_huffman(s);", "}" ]
[ 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 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 43, 45, 47, 49 ], [ 51, 53, 55, 57 ], [ 59, 61, 63, 65 ], [ 67, 69, 71, 73 ], [ 77 ], [ 79 ], [ 81, 83 ], [ 85, 87 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ] ]
8,240
void fft_calc_altivec(FFTContext *s, FFTComplex *z) { POWERPC_TBL_DECLARE(altivec_fft_num, s->nbits >= 6); #ifdef ALTIVEC_USE_REFERENCE_C_CODE int ln = s->nbits; int j, np, np2; int nblocks, nloops; register FFTComplex *p, *q; FFTComplex *exptab = s->exptab; int l; FFTSample tmp_re, tmp_im; POWERPC_TBL_START_COUNT(altivec_fft_num, s->nbits >= 6); np = 1 << ln; /* pass 0 */ p=&z[0]; j=(np >> 1); do { BF(p[0].re, p[0].im, p[1].re, p[1].im, p[0].re, p[0].im, p[1].re, p[1].im); p+=2; } while (--j != 0); /* pass 1 */ p=&z[0]; j=np >> 2; if (s->inverse) { do { BF(p[0].re, p[0].im, p[2].re, p[2].im, p[0].re, p[0].im, p[2].re, p[2].im); BF(p[1].re, p[1].im, p[3].re, p[3].im, p[1].re, p[1].im, -p[3].im, p[3].re); p+=4; } while (--j != 0); } else { do { BF(p[0].re, p[0].im, p[2].re, p[2].im, p[0].re, p[0].im, p[2].re, p[2].im); BF(p[1].re, p[1].im, p[3].re, p[3].im, p[1].re, p[1].im, p[3].im, -p[3].re); p+=4; } while (--j != 0); } /* pass 2 .. ln-1 */ nblocks = np >> 3; nloops = 1 << 2; np2 = np >> 1; do { p = z; q = z + nloops; for (j = 0; j < nblocks; ++j) { BF(p->re, p->im, q->re, q->im, p->re, p->im, q->re, q->im); p++; q++; for(l = nblocks; l < np2; l += nblocks) { CMUL(tmp_re, tmp_im, exptab[l].re, exptab[l].im, q->re, q->im); BF(p->re, p->im, q->re, q->im, p->re, p->im, tmp_re, tmp_im); p++; q++; } p += nloops; q += nloops; } nblocks = nblocks >> 1; nloops = nloops << 1; } while (nblocks != 0); POWERPC_TBL_STOP_COUNT(altivec_fft_num, s->nbits >= 6); #else /* ALTIVEC_USE_REFERENCE_C_CODE */ #ifdef CONFIG_DARWIN register const vector float vczero = (const vector float)(0.); #else register const vector float vczero = (const vector float){0.,0.,0.,0.}; #endif int ln = s->nbits; int j, np, np2; int nblocks, nloops; register FFTComplex *p, *q; FFTComplex *cptr, *cptr1; int k; POWERPC_TBL_START_COUNT(altivec_fft_num, s->nbits >= 6); np = 1 << ln; { vector float *r, a, b, a1, c1, c2; r = (vector float *)&z[0]; c1 = vcii(p,p,n,n); if (s->inverse) { c2 = vcii(p,p,n,p); } else { c2 = vcii(p,p,p,n); } j = (np >> 2); do { a = vec_ld(0, r); a1 = vec_ld(sizeof(vector float), r); b = vec_perm(a,a,vcprmle(1,0,3,2)); a = vec_madd(a,c1,b); /* do the pass 0 butterfly */ b = vec_perm(a1,a1,vcprmle(1,0,3,2)); b = vec_madd(a1,c1,b); /* do the pass 0 butterfly */ /* multiply third by -i */ b = vec_perm(b,b,vcprmle(2,3,1,0)); /* do the pass 1 butterfly */ vec_st(vec_madd(b,c2,a), 0, r); vec_st(vec_nmsub(b,c2,a), sizeof(vector float), r); r += 2; } while (--j != 0); } /* pass 2 .. ln-1 */ nblocks = np >> 3; nloops = 1 << 2; np2 = np >> 1; cptr1 = s->exptab1; do { p = z; q = z + nloops; j = nblocks; do { cptr = cptr1; k = nloops >> 1; do { vector float a,b,c,t1; a = vec_ld(0, (float*)p); b = vec_ld(0, (float*)q); /* complex mul */ c = vec_ld(0, (float*)cptr); /* cre*re cim*re */ t1 = vec_madd(c, vec_perm(b,b,vcprmle(2,2,0,0)),vczero); c = vec_ld(sizeof(vector float), (float*)cptr); /* -cim*im cre*im */ b = vec_madd(c, vec_perm(b,b,vcprmle(3,3,1,1)),t1); /* butterfly */ vec_st(vec_add(a,b), 0, (float*)p); vec_st(vec_sub(a,b), 0, (float*)q); p += 2; q += 2; cptr += 4; } while (--k); p += nloops; q += nloops; } while (--j); cptr1 += nloops * 2; nblocks = nblocks >> 1; nloops = nloops << 1; } while (nblocks != 0); POWERPC_TBL_STOP_COUNT(altivec_fft_num, s->nbits >= 6); #endif /* ALTIVEC_USE_REFERENCE_C_CODE */ }
false
FFmpeg
e45a2872fafe631c14aee9f79d0963d68c4fc1fd
void fft_calc_altivec(FFTContext *s, FFTComplex *z) { POWERPC_TBL_DECLARE(altivec_fft_num, s->nbits >= 6); #ifdef ALTIVEC_USE_REFERENCE_C_CODE int ln = s->nbits; int j, np, np2; int nblocks, nloops; register FFTComplex *p, *q; FFTComplex *exptab = s->exptab; int l; FFTSample tmp_re, tmp_im; POWERPC_TBL_START_COUNT(altivec_fft_num, s->nbits >= 6); np = 1 << ln; p=&z[0]; j=(np >> 1); do { BF(p[0].re, p[0].im, p[1].re, p[1].im, p[0].re, p[0].im, p[1].re, p[1].im); p+=2; } while (--j != 0); p=&z[0]; j=np >> 2; if (s->inverse) { do { BF(p[0].re, p[0].im, p[2].re, p[2].im, p[0].re, p[0].im, p[2].re, p[2].im); BF(p[1].re, p[1].im, p[3].re, p[3].im, p[1].re, p[1].im, -p[3].im, p[3].re); p+=4; } while (--j != 0); } else { do { BF(p[0].re, p[0].im, p[2].re, p[2].im, p[0].re, p[0].im, p[2].re, p[2].im); BF(p[1].re, p[1].im, p[3].re, p[3].im, p[1].re, p[1].im, p[3].im, -p[3].re); p+=4; } while (--j != 0); } nblocks = np >> 3; nloops = 1 << 2; np2 = np >> 1; do { p = z; q = z + nloops; for (j = 0; j < nblocks; ++j) { BF(p->re, p->im, q->re, q->im, p->re, p->im, q->re, q->im); p++; q++; for(l = nblocks; l < np2; l += nblocks) { CMUL(tmp_re, tmp_im, exptab[l].re, exptab[l].im, q->re, q->im); BF(p->re, p->im, q->re, q->im, p->re, p->im, tmp_re, tmp_im); p++; q++; } p += nloops; q += nloops; } nblocks = nblocks >> 1; nloops = nloops << 1; } while (nblocks != 0); POWERPC_TBL_STOP_COUNT(altivec_fft_num, s->nbits >= 6); #else #ifdef CONFIG_DARWIN register const vector float vczero = (const vector float)(0.); #else register const vector float vczero = (const vector float){0.,0.,0.,0.}; #endif int ln = s->nbits; int j, np, np2; int nblocks, nloops; register FFTComplex *p, *q; FFTComplex *cptr, *cptr1; int k; POWERPC_TBL_START_COUNT(altivec_fft_num, s->nbits >= 6); np = 1 << ln; { vector float *r, a, b, a1, c1, c2; r = (vector float *)&z[0]; c1 = vcii(p,p,n,n); if (s->inverse) { c2 = vcii(p,p,n,p); } else { c2 = vcii(p,p,p,n); } j = (np >> 2); do { a = vec_ld(0, r); a1 = vec_ld(sizeof(vector float), r); b = vec_perm(a,a,vcprmle(1,0,3,2)); a = vec_madd(a,c1,b); b = vec_perm(a1,a1,vcprmle(1,0,3,2)); b = vec_madd(a1,c1,b); b = vec_perm(b,b,vcprmle(2,3,1,0)); vec_st(vec_madd(b,c2,a), 0, r); vec_st(vec_nmsub(b,c2,a), sizeof(vector float), r); r += 2; } while (--j != 0); } nblocks = np >> 3; nloops = 1 << 2; np2 = np >> 1; cptr1 = s->exptab1; do { p = z; q = z + nloops; j = nblocks; do { cptr = cptr1; k = nloops >> 1; do { vector float a,b,c,t1; a = vec_ld(0, (float*)p); b = vec_ld(0, (float*)q); c = vec_ld(0, (float*)cptr); t1 = vec_madd(c, vec_perm(b,b,vcprmle(2,2,0,0)),vczero); c = vec_ld(sizeof(vector float), (float*)cptr); b = vec_madd(c, vec_perm(b,b,vcprmle(3,3,1,1)),t1); vec_st(vec_add(a,b), 0, (float*)p); vec_st(vec_sub(a,b), 0, (float*)q); p += 2; q += 2; cptr += 4; } while (--k); p += nloops; q += nloops; } while (--j); cptr1 += nloops * 2; nblocks = nblocks >> 1; nloops = nloops << 1; } while (nblocks != 0); POWERPC_TBL_STOP_COUNT(altivec_fft_num, s->nbits >= 6); #endif }
{ "code": [], "line_no": [] }
void FUNC_0(FFTContext *VAR_0, FFTComplex *VAR_1) { POWERPC_TBL_DECLARE(altivec_fft_num, VAR_0->nbits >= 6); #ifdef ALTIVEC_USE_REFERENCE_C_CODE int VAR_3 = VAR_0->nbits; int VAR_4, VAR_5, VAR_6; int VAR_7, VAR_8; register FFTComplex *VAR_9, *q; FFTComplex *exptab = VAR_0->exptab; int l; FFTSample tmp_re, tmp_im; POWERPC_TBL_START_COUNT(altivec_fft_num, VAR_0->nbits >= 6); VAR_5 = 1 << VAR_3; VAR_9=&VAR_1[0]; VAR_4=(VAR_5 >> 1); do { BF(VAR_9[0].re, VAR_9[0].im, VAR_9[1].re, VAR_9[1].im, VAR_9[0].re, VAR_9[0].im, VAR_9[1].re, VAR_9[1].im); VAR_9+=2; } while (--VAR_4 != 0); VAR_9=&VAR_1[0]; VAR_4=VAR_5 >> 2; if (VAR_0->inverse) { do { BF(VAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im, VAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im); BF(VAR_9[1].re, VAR_9[1].im, VAR_9[3].re, VAR_9[3].im, VAR_9[1].re, VAR_9[1].im, -VAR_9[3].im, VAR_9[3].re); VAR_9+=4; } while (--VAR_4 != 0); } else { do { BF(VAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im, VAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im); BF(VAR_9[1].re, VAR_9[1].im, VAR_9[3].re, VAR_9[3].im, VAR_9[1].re, VAR_9[1].im, VAR_9[3].im, -VAR_9[3].re); VAR_9+=4; } while (--VAR_4 != 0); } VAR_7 = VAR_5 >> 3; VAR_8 = 1 << 2; VAR_6 = VAR_5 >> 1; do { VAR_9 = VAR_1; q = VAR_1 + VAR_8; for (VAR_4 = 0; VAR_4 < VAR_7; ++VAR_4) { BF(VAR_9->re, VAR_9->im, q->re, q->im, VAR_9->re, VAR_9->im, q->re, q->im); VAR_9++; q++; for(l = VAR_7; l < VAR_6; l += VAR_7) { CMUL(tmp_re, tmp_im, exptab[l].re, exptab[l].im, q->re, q->im); BF(VAR_9->re, VAR_9->im, q->re, q->im, VAR_9->re, VAR_9->im, tmp_re, tmp_im); VAR_9++; q++; } VAR_9 += VAR_8; q += VAR_8; } VAR_7 = VAR_7 >> 1; VAR_8 = VAR_8 << 1; } while (VAR_7 != 0); POWERPC_TBL_STOP_COUNT(altivec_fft_num, VAR_0->nbits >= 6); #else #ifdef CONFIG_DARWIN register const vector float VAR_2 = (const vector float)(0.); #else register const vector float VAR_2 = (const vector float){0.,0.,0.,0.}; #endif int VAR_3 = VAR_0->nbits; int VAR_4, VAR_5, VAR_6; int VAR_7, VAR_8; register FFTComplex *VAR_9, *q; FFTComplex *cptr, *cptr1; int VAR_10; POWERPC_TBL_START_COUNT(altivec_fft_num, VAR_0->nbits >= 6); VAR_5 = 1 << VAR_3; { vector float *r, a, b, a1, c1, c2; r = (vector float *)&VAR_1[0]; c1 = vcii(VAR_9,VAR_9,n,n); if (VAR_0->inverse) { c2 = vcii(VAR_9,VAR_9,n,VAR_9); } else { c2 = vcii(VAR_9,VAR_9,VAR_9,n); } VAR_4 = (VAR_5 >> 2); do { a = vec_ld(0, r); a1 = vec_ld(sizeof(vector float), r); b = vec_perm(a,a,vcprmle(1,0,3,2)); a = vec_madd(a,c1,b); b = vec_perm(a1,a1,vcprmle(1,0,3,2)); b = vec_madd(a1,c1,b); b = vec_perm(b,b,vcprmle(2,3,1,0)); vec_st(vec_madd(b,c2,a), 0, r); vec_st(vec_nmsub(b,c2,a), sizeof(vector float), r); r += 2; } while (--VAR_4 != 0); } VAR_7 = VAR_5 >> 3; VAR_8 = 1 << 2; VAR_6 = VAR_5 >> 1; cptr1 = VAR_0->exptab1; do { VAR_9 = VAR_1; q = VAR_1 + VAR_8; VAR_4 = VAR_7; do { cptr = cptr1; VAR_10 = VAR_8 >> 1; do { vector float a,b,c,t1; a = vec_ld(0, (float*)VAR_9); b = vec_ld(0, (float*)q); c = vec_ld(0, (float*)cptr); t1 = vec_madd(c, vec_perm(b,b,vcprmle(2,2,0,0)),VAR_2); c = vec_ld(sizeof(vector float), (float*)cptr); b = vec_madd(c, vec_perm(b,b,vcprmle(3,3,1,1)),t1); vec_st(vec_add(a,b), 0, (float*)VAR_9); vec_st(vec_sub(a,b), 0, (float*)q); VAR_9 += 2; q += 2; cptr += 4; } while (--VAR_10); VAR_9 += VAR_8; q += VAR_8; } while (--VAR_4); cptr1 += VAR_8 * 2; VAR_7 = VAR_7 >> 1; VAR_8 = VAR_8 << 1; } while (VAR_7 != 0); POWERPC_TBL_STOP_COUNT(altivec_fft_num, VAR_0->nbits >= 6); #endif }
[ "void FUNC_0(FFTContext *VAR_0, FFTComplex *VAR_1)\n{", "POWERPC_TBL_DECLARE(altivec_fft_num, VAR_0->nbits >= 6);", "#ifdef ALTIVEC_USE_REFERENCE_C_CODE\nint VAR_3 = VAR_0->nbits;", "int\tVAR_4, VAR_5, VAR_6;", "int\tVAR_7, VAR_8;", "register FFTComplex *VAR_9, *q;", "FFTComplex *exptab = VAR_0->exptab;", "int l;", "FFTSample tmp_re, tmp_im;", "POWERPC_TBL_START_COUNT(altivec_fft_num, VAR_0->nbits >= 6);", "VAR_5 = 1 << VAR_3;", "VAR_9=&VAR_1[0];", "VAR_4=(VAR_5 >> 1);", "do {", "BF(VAR_9[0].re, VAR_9[0].im, VAR_9[1].re, VAR_9[1].im,\nVAR_9[0].re, VAR_9[0].im, VAR_9[1].re, VAR_9[1].im);", "VAR_9+=2;", "} while (--VAR_4 != 0);", "VAR_9=&VAR_1[0];", "VAR_4=VAR_5 >> 2;", "if (VAR_0->inverse) {", "do {", "BF(VAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im,\nVAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im);", "BF(VAR_9[1].re, VAR_9[1].im, VAR_9[3].re, VAR_9[3].im,\nVAR_9[1].re, VAR_9[1].im, -VAR_9[3].im, VAR_9[3].re);", "VAR_9+=4;", "} while (--VAR_4 != 0);", "} else {", "do {", "BF(VAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im,\nVAR_9[0].re, VAR_9[0].im, VAR_9[2].re, VAR_9[2].im);", "BF(VAR_9[1].re, VAR_9[1].im, VAR_9[3].re, VAR_9[3].im,\nVAR_9[1].re, VAR_9[1].im, VAR_9[3].im, -VAR_9[3].re);", "VAR_9+=4;", "} while (--VAR_4 != 0);", "}", "VAR_7 = VAR_5 >> 3;", "VAR_8 = 1 << 2;", "VAR_6 = VAR_5 >> 1;", "do {", "VAR_9 = VAR_1;", "q = VAR_1 + VAR_8;", "for (VAR_4 = 0; VAR_4 < VAR_7; ++VAR_4) {", "BF(VAR_9->re, VAR_9->im, q->re, q->im,\nVAR_9->re, VAR_9->im, q->re, q->im);", "VAR_9++;", "q++;", "for(l = VAR_7; l < VAR_6; l += VAR_7) {", "CMUL(tmp_re, tmp_im, exptab[l].re, exptab[l].im, q->re, q->im);", "BF(VAR_9->re, VAR_9->im, q->re, q->im,\nVAR_9->re, VAR_9->im, tmp_re, tmp_im);", "VAR_9++;", "q++;", "}", "VAR_9 += VAR_8;", "q += VAR_8;", "}", "VAR_7 = VAR_7 >> 1;", "VAR_8 = VAR_8 << 1;", "} while (VAR_7 != 0);", "POWERPC_TBL_STOP_COUNT(altivec_fft_num, VAR_0->nbits >= 6);", "#else\n#ifdef CONFIG_DARWIN\nregister const vector float VAR_2 = (const vector float)(0.);", "#else\nregister const vector float VAR_2 = (const vector float){0.,0.,0.,0.};", "#endif\nint VAR_3 = VAR_0->nbits;", "int\tVAR_4, VAR_5, VAR_6;", "int\tVAR_7, VAR_8;", "register FFTComplex *VAR_9, *q;", "FFTComplex *cptr, *cptr1;", "int VAR_10;", "POWERPC_TBL_START_COUNT(altivec_fft_num, VAR_0->nbits >= 6);", "VAR_5 = 1 << VAR_3;", "{", "vector float *r, a, b, a1, c1, c2;", "r = (vector float *)&VAR_1[0];", "c1 = vcii(VAR_9,VAR_9,n,n);", "if (VAR_0->inverse)\n{", "c2 = vcii(VAR_9,VAR_9,n,VAR_9);", "}", "else\n{", "c2 = vcii(VAR_9,VAR_9,VAR_9,n);", "}", "VAR_4 = (VAR_5 >> 2);", "do {", "a = vec_ld(0, r);", "a1 = vec_ld(sizeof(vector float), r);", "b = vec_perm(a,a,vcprmle(1,0,3,2));", "a = vec_madd(a,c1,b);", "b = vec_perm(a1,a1,vcprmle(1,0,3,2));", "b = vec_madd(a1,c1,b);", "b = vec_perm(b,b,vcprmle(2,3,1,0));", "vec_st(vec_madd(b,c2,a), 0, r);", "vec_st(vec_nmsub(b,c2,a), sizeof(vector float), r);", "r += 2;", "} while (--VAR_4 != 0);", "}", "VAR_7 = VAR_5 >> 3;", "VAR_8 = 1 << 2;", "VAR_6 = VAR_5 >> 1;", "cptr1 = VAR_0->exptab1;", "do {", "VAR_9 = VAR_1;", "q = VAR_1 + VAR_8;", "VAR_4 = VAR_7;", "do {", "cptr = cptr1;", "VAR_10 = VAR_8 >> 1;", "do {", "vector float a,b,c,t1;", "a = vec_ld(0, (float*)VAR_9);", "b = vec_ld(0, (float*)q);", "c = vec_ld(0, (float*)cptr);", "t1 = vec_madd(c, vec_perm(b,b,vcprmle(2,2,0,0)),VAR_2);", "c = vec_ld(sizeof(vector float), (float*)cptr);", "b = vec_madd(c, vec_perm(b,b,vcprmle(3,3,1,1)),t1);", "vec_st(vec_add(a,b), 0, (float*)VAR_9);", "vec_st(vec_sub(a,b), 0, (float*)q);", "VAR_9 += 2;", "q += 2;", "cptr += 4;", "} while (--VAR_10);", "VAR_9 += VAR_8;", "q += VAR_8;", "} while (--VAR_4);", "cptr1 += VAR_8 * 2;", "VAR_7 = VAR_7 >> 1;", "VAR_8 = VAR_8 << 1;", "} while (VAR_7 != 0);", "POWERPC_TBL_STOP_COUNT(altivec_fft_num, VAR_0->nbits >= 6);", "#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, 0, 0, 0, 0, 0, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 159, 161, 163 ], [ 165, 167 ], [ 169, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 191 ], [ 195 ], [ 197 ], [ 201 ], [ 205 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 237 ], [ 239 ], [ 245 ], [ 247 ], [ 255 ], [ 261 ], [ 263 ], [ 267 ], [ 269 ], [ 271 ], [ 277 ], [ 279 ], [ 281 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 307 ], [ 309 ], [ 315 ], [ 319 ], [ 321 ], [ 325 ], [ 331 ], [ 333 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 363 ], [ 367, 369 ] ]
8,242
Aml *aml_and(Aml *arg1, Aml *arg2) { Aml *var = aml_opcode(0x7B /* AndOp */); aml_append(var, arg1); aml_append(var, arg2); build_append_byte(var->buf, 0x00 /* NullNameOp */); return var; }
false
qemu
439e2a6e10ed7f5da819bf7dcaa54b8cfdbeab0d
Aml *aml_and(Aml *arg1, Aml *arg2) { Aml *var = aml_opcode(0x7B ); aml_append(var, arg1); aml_append(var, arg2); build_append_byte(var->buf, 0x00 ); return var; }
{ "code": [], "line_no": [] }
Aml *FUNC_0(Aml *arg1, Aml *arg2) { Aml *var = aml_opcode(0x7B ); aml_append(var, arg1); aml_append(var, arg2); build_append_byte(var->buf, 0x00 ); return var; }
[ "Aml *FUNC_0(Aml *arg1, Aml *arg2)\n{", "Aml *var = aml_opcode(0x7B );", "aml_append(var, arg1);", "aml_append(var, arg2);", "build_append_byte(var->buf, 0x00 );", "return var;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
8,243
static QObject *parser_context_peek_token(JSONParserContext *ctxt) { assert(!g_queue_is_empty(ctxt->buf)); return g_queue_peek_head(ctxt->buf); }
false
qemu
9bada8971173345ceb37ed1a47b00a01a4dd48cf
static QObject *parser_context_peek_token(JSONParserContext *ctxt) { assert(!g_queue_is_empty(ctxt->buf)); return g_queue_peek_head(ctxt->buf); }
{ "code": [], "line_no": [] }
static QObject *FUNC_0(JSONParserContext *ctxt) { assert(!g_queue_is_empty(ctxt->buf)); return g_queue_peek_head(ctxt->buf); }
[ "static QObject *FUNC_0(JSONParserContext *ctxt)\n{", "assert(!g_queue_is_empty(ctxt->buf));", "return g_queue_peek_head(ctxt->buf);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
8,244
static int nbd_handle_reply_err(QIOChannel *ioc, nbd_opt_reply *reply, Error **errp) { char *msg = NULL; int result = -1; if (!(reply->type & (1 << 31))) { return 1; } if (reply->length) { if (reply->length > NBD_MAX_BUFFER_SIZE) { error_setg(errp, "server's error message is too long"); goto cleanup; } msg = g_malloc(reply->length + 1); if (read_sync(ioc, msg, reply->length, errp) < 0) { error_prepend(errp, "failed to read option error message"); goto cleanup; } msg[reply->length] = '\0'; } switch (reply->type) { case NBD_REP_ERR_UNSUP: TRACE("server doesn't understand request %" PRIx32 ", attempting fallback", reply->option); result = 0; goto cleanup; case NBD_REP_ERR_POLICY: error_setg(errp, "Denied by server for option %" PRIx32, reply->option); break; case NBD_REP_ERR_INVALID: error_setg(errp, "Invalid data length for option %" PRIx32, reply->option); break; case NBD_REP_ERR_PLATFORM: error_setg(errp, "Server lacks support for option %" PRIx32, reply->option); break; case NBD_REP_ERR_TLS_REQD: error_setg(errp, "TLS negotiation required before option %" PRIx32, reply->option); break; case NBD_REP_ERR_SHUTDOWN: error_setg(errp, "Server shutting down before option %" PRIx32, reply->option); break; default: error_setg(errp, "Unknown error code when asking for option %" PRIx32, reply->option); break; } if (msg) { error_append_hint(errp, "%s\n", msg); } cleanup: g_free(msg); if (result < 0) { nbd_send_opt_abort(ioc); } return result; }
false
qemu
d1fdf257d52822695f5ace6c586e059aa17d4b79
static int nbd_handle_reply_err(QIOChannel *ioc, nbd_opt_reply *reply, Error **errp) { char *msg = NULL; int result = -1; if (!(reply->type & (1 << 31))) { return 1; } if (reply->length) { if (reply->length > NBD_MAX_BUFFER_SIZE) { error_setg(errp, "server's error message is too long"); goto cleanup; } msg = g_malloc(reply->length + 1); if (read_sync(ioc, msg, reply->length, errp) < 0) { error_prepend(errp, "failed to read option error message"); goto cleanup; } msg[reply->length] = '\0'; } switch (reply->type) { case NBD_REP_ERR_UNSUP: TRACE("server doesn't understand request %" PRIx32 ", attempting fallback", reply->option); result = 0; goto cleanup; case NBD_REP_ERR_POLICY: error_setg(errp, "Denied by server for option %" PRIx32, reply->option); break; case NBD_REP_ERR_INVALID: error_setg(errp, "Invalid data length for option %" PRIx32, reply->option); break; case NBD_REP_ERR_PLATFORM: error_setg(errp, "Server lacks support for option %" PRIx32, reply->option); break; case NBD_REP_ERR_TLS_REQD: error_setg(errp, "TLS negotiation required before option %" PRIx32, reply->option); break; case NBD_REP_ERR_SHUTDOWN: error_setg(errp, "Server shutting down before option %" PRIx32, reply->option); break; default: error_setg(errp, "Unknown error code when asking for option %" PRIx32, reply->option); break; } if (msg) { error_append_hint(errp, "%s\n", msg); } cleanup: g_free(msg); if (result < 0) { nbd_send_opt_abort(ioc); } return result; }
{ "code": [], "line_no": [] }
static int FUNC_0(QIOChannel *VAR_0, nbd_opt_reply *VAR_1, Error **VAR_2) { char *VAR_3 = NULL; int VAR_4 = -1; if (!(VAR_1->type & (1 << 31))) { return 1; } if (VAR_1->length) { if (VAR_1->length > NBD_MAX_BUFFER_SIZE) { error_setg(VAR_2, "server's error message is too long"); goto cleanup; } VAR_3 = g_malloc(VAR_1->length + 1); if (read_sync(VAR_0, VAR_3, VAR_1->length, VAR_2) < 0) { error_prepend(VAR_2, "failed to read option error message"); goto cleanup; } VAR_3[VAR_1->length] = '\0'; } switch (VAR_1->type) { case NBD_REP_ERR_UNSUP: TRACE("server doesn't understand request %" PRIx32 ", attempting fallback", VAR_1->option); VAR_4 = 0; goto cleanup; case NBD_REP_ERR_POLICY: error_setg(VAR_2, "Denied by server for option %" PRIx32, VAR_1->option); break; case NBD_REP_ERR_INVALID: error_setg(VAR_2, "Invalid data length for option %" PRIx32, VAR_1->option); break; case NBD_REP_ERR_PLATFORM: error_setg(VAR_2, "Server lacks support for option %" PRIx32, VAR_1->option); break; case NBD_REP_ERR_TLS_REQD: error_setg(VAR_2, "TLS negotiation required before option %" PRIx32, VAR_1->option); break; case NBD_REP_ERR_SHUTDOWN: error_setg(VAR_2, "Server shutting down before option %" PRIx32, VAR_1->option); break; default: error_setg(VAR_2, "Unknown error code when asking for option %" PRIx32, VAR_1->option); break; } if (VAR_3) { error_append_hint(VAR_2, "%s\n", VAR_3); } cleanup: g_free(VAR_3); if (VAR_4 < 0) { nbd_send_opt_abort(VAR_0); } return VAR_4; }
[ "static int FUNC_0(QIOChannel *VAR_0, nbd_opt_reply *VAR_1,\nError **VAR_2)\n{", "char *VAR_3 = NULL;", "int VAR_4 = -1;", "if (!(VAR_1->type & (1 << 31))) {", "return 1;", "}", "if (VAR_1->length) {", "if (VAR_1->length > NBD_MAX_BUFFER_SIZE) {", "error_setg(VAR_2, \"server's error message is too long\");", "goto cleanup;", "}", "VAR_3 = g_malloc(VAR_1->length + 1);", "if (read_sync(VAR_0, VAR_3, VAR_1->length, VAR_2) < 0) {", "error_prepend(VAR_2, \"failed to read option error message\");", "goto cleanup;", "}", "VAR_3[VAR_1->length] = '\\0';", "}", "switch (VAR_1->type) {", "case NBD_REP_ERR_UNSUP:\nTRACE(\"server doesn't understand request %\" PRIx32\n\", attempting fallback\", VAR_1->option);", "VAR_4 = 0;", "goto cleanup;", "case NBD_REP_ERR_POLICY:\nerror_setg(VAR_2, \"Denied by server for option %\" PRIx32,\nVAR_1->option);", "break;", "case NBD_REP_ERR_INVALID:\nerror_setg(VAR_2, \"Invalid data length for option %\" PRIx32,\nVAR_1->option);", "break;", "case NBD_REP_ERR_PLATFORM:\nerror_setg(VAR_2, \"Server lacks support for option %\" PRIx32,\nVAR_1->option);", "break;", "case NBD_REP_ERR_TLS_REQD:\nerror_setg(VAR_2, \"TLS negotiation required before option %\" PRIx32,\nVAR_1->option);", "break;", "case NBD_REP_ERR_SHUTDOWN:\nerror_setg(VAR_2, \"Server shutting down before option %\" PRIx32,\nVAR_1->option);", "break;", "default:\nerror_setg(VAR_2, \"Unknown error code when asking for option %\" PRIx32,\nVAR_1->option);", "break;", "}", "if (VAR_3) {", "error_append_hint(VAR_2, \"%s\\n\", VAR_3);", "}", "cleanup:\ng_free(VAR_3);", "if (VAR_4 < 0) {", "nbd_send_opt_abort(VAR_0);", "}", "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, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49, 51, 53 ], [ 55 ], [ 57 ], [ 61, 63, 65 ], [ 67 ], [ 71, 73, 75 ], [ 77 ], [ 81, 83, 85 ], [ 87 ], [ 91, 93, 95 ], [ 97 ], [ 101, 103, 105 ], [ 107 ], [ 111, 113, 115 ], [ 117 ], [ 119 ], [ 123 ], [ 125 ], [ 127 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ] ]
8,245
static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num) { gen_update_cc_op(s); set_cc_op(s, CC_OP_DYNAMIC); if (s->jmp_opt) { gen_goto_tb(s, tb_num, eip); s->is_jmp = DISAS_TB_JUMP; } else { gen_jmp_im(eip); gen_eob(s); } }
false
qemu
1e39d97af086d525cd0408eaa5d19783ea165906
static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num) { gen_update_cc_op(s); set_cc_op(s, CC_OP_DYNAMIC); if (s->jmp_opt) { gen_goto_tb(s, tb_num, eip); s->is_jmp = DISAS_TB_JUMP; } else { gen_jmp_im(eip); gen_eob(s); } }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0, target_ulong VAR_1, int VAR_2) { gen_update_cc_op(VAR_0); set_cc_op(VAR_0, CC_OP_DYNAMIC); if (VAR_0->jmp_opt) { gen_goto_tb(VAR_0, VAR_2, VAR_1); VAR_0->is_jmp = DISAS_TB_JUMP; } else { gen_jmp_im(VAR_1); gen_eob(VAR_0); } }
[ "static void FUNC_0(DisasContext *VAR_0, target_ulong VAR_1, int VAR_2)\n{", "gen_update_cc_op(VAR_0);", "set_cc_op(VAR_0, CC_OP_DYNAMIC);", "if (VAR_0->jmp_opt) {", "gen_goto_tb(VAR_0, VAR_2, VAR_1);", "VAR_0->is_jmp = DISAS_TB_JUMP;", "} else {", "gen_jmp_im(VAR_1);", "gen_eob(VAR_0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
8,246
void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg) { uint32_t srs; srs = env->pregs[PR_SRS]; srs &= 3; env->sregs[srs][sreg] = env->regs[reg]; #if !defined(CONFIG_USER_ONLY) if (srs == 1 || srs == 2) { if (sreg == 6) { /* Writes to tlb-hi write to mm_cause as a side effect. */ env->sregs[SFR_RW_MM_TLB_HI] = env->regs[reg]; env->sregs[SFR_R_MM_CAUSE] = env->regs[reg]; } else if (sreg == 5) { uint32_t set; uint32_t idx; uint32_t lo, hi; uint32_t vaddr; int tlb_v; idx = set = env->sregs[SFR_RW_MM_TLB_SEL]; set >>= 4; set &= 3; idx &= 15; /* We've just made a write to tlb_lo. */ lo = env->sregs[SFR_RW_MM_TLB_LO]; /* Writes are done via r_mm_cause. */ hi = env->sregs[SFR_R_MM_CAUSE]; vaddr = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].hi, 13, 31); vaddr <<= TARGET_PAGE_BITS; tlb_v = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].lo, 3, 3); env->tlbsets[srs - 1][set][idx].lo = lo; env->tlbsets[srs - 1][set][idx].hi = hi; D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", vaddr, tlb_v, env->pc); tlb_flush_page(env, vaddr); } } #endif }
false
qemu
3e18c6bf7740e4a75503b803ec7d5dc29a531e4f
void helper_movl_sreg_reg (uint32_t sreg, uint32_t reg) { uint32_t srs; srs = env->pregs[PR_SRS]; srs &= 3; env->sregs[srs][sreg] = env->regs[reg]; #if !defined(CONFIG_USER_ONLY) if (srs == 1 || srs == 2) { if (sreg == 6) { env->sregs[SFR_RW_MM_TLB_HI] = env->regs[reg]; env->sregs[SFR_R_MM_CAUSE] = env->regs[reg]; } else if (sreg == 5) { uint32_t set; uint32_t idx; uint32_t lo, hi; uint32_t vaddr; int tlb_v; idx = set = env->sregs[SFR_RW_MM_TLB_SEL]; set >>= 4; set &= 3; idx &= 15; lo = env->sregs[SFR_RW_MM_TLB_LO]; hi = env->sregs[SFR_R_MM_CAUSE]; vaddr = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].hi, 13, 31); vaddr <<= TARGET_PAGE_BITS; tlb_v = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].lo, 3, 3); env->tlbsets[srs - 1][set][idx].lo = lo; env->tlbsets[srs - 1][set][idx].hi = hi; D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", vaddr, tlb_v, env->pc); tlb_flush_page(env, vaddr); } } #endif }
{ "code": [], "line_no": [] }
void FUNC_0 (uint32_t VAR_0, uint32_t VAR_1) { uint32_t srs; srs = env->pregs[PR_SRS]; srs &= 3; env->sregs[srs][VAR_0] = env->regs[VAR_1]; #if !defined(CONFIG_USER_ONLY) if (srs == 1 || srs == 2) { if (VAR_0 == 6) { env->sregs[SFR_RW_MM_TLB_HI] = env->regs[VAR_1]; env->sregs[SFR_R_MM_CAUSE] = env->regs[VAR_1]; } else if (VAR_0 == 5) { uint32_t set; uint32_t idx; uint32_t lo, hi; uint32_t vaddr; int VAR_2; idx = set = env->sregs[SFR_RW_MM_TLB_SEL]; set >>= 4; set &= 3; idx &= 15; lo = env->sregs[SFR_RW_MM_TLB_LO]; hi = env->sregs[SFR_R_MM_CAUSE]; vaddr = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].hi, 13, 31); vaddr <<= TARGET_PAGE_BITS; VAR_2 = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].lo, 3, 3); env->tlbsets[srs - 1][set][idx].lo = lo; env->tlbsets[srs - 1][set][idx].hi = hi; D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", vaddr, VAR_2, env->pc); tlb_flush_page(env, vaddr); } } #endif }
[ "void FUNC_0 (uint32_t VAR_0, uint32_t VAR_1)\n{", "uint32_t srs;", "srs = env->pregs[PR_SRS];", "srs &= 3;", "env->sregs[srs][VAR_0] = env->regs[VAR_1];", "#if !defined(CONFIG_USER_ONLY)\nif (srs == 1 || srs == 2) {", "if (VAR_0 == 6) {", "env->sregs[SFR_RW_MM_TLB_HI] = env->regs[VAR_1];", "env->sregs[SFR_R_MM_CAUSE] = env->regs[VAR_1];", "}", "else if (VAR_0 == 5) {", "uint32_t set;", "uint32_t idx;", "uint32_t lo, hi;", "uint32_t vaddr;", "int VAR_2;", "idx = set = env->sregs[SFR_RW_MM_TLB_SEL];", "set >>= 4;", "set &= 3;", "idx &= 15;", "lo = env->sregs[SFR_RW_MM_TLB_LO];", "hi = env->sregs[SFR_R_MM_CAUSE];", "vaddr = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].hi,\n13, 31);", "vaddr <<= TARGET_PAGE_BITS;", "VAR_2 = EXTRACT_FIELD(env->tlbsets[srs-1][set][idx].lo,\n3, 3);", "env->tlbsets[srs - 1][set][idx].lo = lo;", "env->tlbsets[srs - 1][set][idx].hi = hi;", "D_LOG(\"tlb flush vaddr=%x v=%d pc=%x\\n\",\nvaddr, VAR_2, env->pc);", "tlb_flush_page(env, vaddr);", "}", "}", "#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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57 ], [ 61 ], [ 65, 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 77 ], [ 81, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ] ]
8,248
static inline void gen_intermediate_code_internal(CPUX86State *env, TranslationBlock *tb, int search_pc) { DisasContext dc1, *dc = &dc1; target_ulong pc_ptr; uint16_t *gen_opc_end; CPUBreakpoint *bp; int j, lj; uint64_t flags; target_ulong pc_start; target_ulong cs_base; int num_insns; int max_insns; /* generate intermediate code */ pc_start = tb->pc; cs_base = tb->cs_base; flags = tb->flags; dc->pe = (flags >> HF_PE_SHIFT) & 1; dc->code32 = (flags >> HF_CS32_SHIFT) & 1; dc->ss32 = (flags >> HF_SS32_SHIFT) & 1; dc->addseg = (flags >> HF_ADDSEG_SHIFT) & 1; dc->f_st = 0; dc->vm86 = (flags >> VM_SHIFT) & 1; dc->cpl = (flags >> HF_CPL_SHIFT) & 3; dc->iopl = (flags >> IOPL_SHIFT) & 3; dc->tf = (flags >> TF_SHIFT) & 1; dc->singlestep_enabled = env->singlestep_enabled; dc->cc_op = CC_OP_DYNAMIC; dc->cs_base = cs_base; dc->tb = tb; dc->popl_esp_hack = 0; /* select memory access functions */ dc->mem_index = 0; if (flags & HF_SOFTMMU_MASK) { if (dc->cpl == 3) dc->mem_index = 2 * 4; else dc->mem_index = 1 * 4; } dc->cpuid_features = env->cpuid_features; dc->cpuid_ext_features = env->cpuid_ext_features; dc->cpuid_ext2_features = env->cpuid_ext2_features; dc->cpuid_ext3_features = env->cpuid_ext3_features; #ifdef TARGET_X86_64 dc->lma = (flags >> HF_LMA_SHIFT) & 1; dc->code64 = (flags >> HF_CS64_SHIFT) & 1; #endif dc->flags = flags; dc->jmp_opt = !(dc->tf || env->singlestep_enabled || (flags & HF_INHIBIT_IRQ_MASK) #ifndef CONFIG_SOFTMMU || (flags & HF_SOFTMMU_MASK) #endif ); #if 0 /* check addseg logic */ if (!dc->addseg && (dc->vm86 || !dc->pe || !dc->code32)) printf("ERROR addseg\n"); #endif cpu_T[0] = tcg_temp_new(); cpu_T[1] = tcg_temp_new(); cpu_A0 = tcg_temp_new(); cpu_T3 = tcg_temp_new(); cpu_tmp0 = tcg_temp_new(); cpu_tmp1_i64 = tcg_temp_new_i64(); cpu_tmp2_i32 = tcg_temp_new_i32(); cpu_tmp3_i32 = tcg_temp_new_i32(); cpu_tmp4 = tcg_temp_new(); cpu_tmp5 = tcg_temp_new(); cpu_ptr0 = tcg_temp_new_ptr(); cpu_ptr1 = tcg_temp_new_ptr(); gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; pc_ptr = pc_start; lj = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_icount_start(); for(;;) { if (unlikely(!QTAILQ_EMPTY(&env->breakpoints))) { QTAILQ_FOREACH(bp, &env->breakpoints, entry) { if (bp->pc == pc_ptr && !((bp->flags & BP_CPU) && (tb->flags & HF_RF_MASK))) { gen_debug(dc, pc_ptr - dc->cs_base); break; } } } if (search_pc) { j = gen_opc_ptr - gen_opc_buf; if (lj < j) { lj++; while (lj < j) gen_opc_instr_start[lj++] = 0; } gen_opc_pc[lj] = pc_ptr; gen_opc_cc_op[lj] = dc->cc_op; gen_opc_instr_start[lj] = 1; gen_opc_icount[lj] = num_insns; } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); pc_ptr = disas_insn(dc, pc_ptr); num_insns++; /* stop translation if indicated */ if (dc->is_jmp) break; /* if single step mode, we generate only one instruction and generate an exception */ /* if irq were inhibited with HF_INHIBIT_IRQ_MASK, we clear the flag and abort the translation to give the irqs a change to be happen */ if (dc->tf || dc->singlestep_enabled || (flags & HF_INHIBIT_IRQ_MASK)) { gen_jmp_im(pc_ptr - dc->cs_base); gen_eob(dc); break; } /* if too long translation, stop generation too */ if (gen_opc_ptr >= gen_opc_end || (pc_ptr - pc_start) >= (TARGET_PAGE_SIZE - 32) || num_insns >= max_insns) { gen_jmp_im(pc_ptr - dc->cs_base); gen_eob(dc); break; } if (singlestep) { gen_jmp_im(pc_ptr - dc->cs_base); gen_eob(dc); break; } } if (tb->cflags & CF_LAST_IO) gen_io_end(); gen_icount_end(tb, num_insns); *gen_opc_ptr = INDEX_op_end; /* we don't forget to fill the last values */ if (search_pc) { j = gen_opc_ptr - gen_opc_buf; lj++; while (lj <= j) gen_opc_instr_start[lj++] = 0; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { int disas_flags; qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); #ifdef TARGET_X86_64 if (dc->code64) disas_flags = 2; else #endif disas_flags = !dc->code32; log_target_disas(pc_start, pc_ptr - pc_start, disas_flags); qemu_log("\n"); } #endif if (!search_pc) { tb->size = pc_ptr - pc_start; tb->icount = num_insns; } }
false
qemu
a9321a4d49d65d29c2926a51aedc5b91a01f3591
static inline void gen_intermediate_code_internal(CPUX86State *env, TranslationBlock *tb, int search_pc) { DisasContext dc1, *dc = &dc1; target_ulong pc_ptr; uint16_t *gen_opc_end; CPUBreakpoint *bp; int j, lj; uint64_t flags; target_ulong pc_start; target_ulong cs_base; int num_insns; int max_insns; pc_start = tb->pc; cs_base = tb->cs_base; flags = tb->flags; dc->pe = (flags >> HF_PE_SHIFT) & 1; dc->code32 = (flags >> HF_CS32_SHIFT) & 1; dc->ss32 = (flags >> HF_SS32_SHIFT) & 1; dc->addseg = (flags >> HF_ADDSEG_SHIFT) & 1; dc->f_st = 0; dc->vm86 = (flags >> VM_SHIFT) & 1; dc->cpl = (flags >> HF_CPL_SHIFT) & 3; dc->iopl = (flags >> IOPL_SHIFT) & 3; dc->tf = (flags >> TF_SHIFT) & 1; dc->singlestep_enabled = env->singlestep_enabled; dc->cc_op = CC_OP_DYNAMIC; dc->cs_base = cs_base; dc->tb = tb; dc->popl_esp_hack = 0; dc->mem_index = 0; if (flags & HF_SOFTMMU_MASK) { if (dc->cpl == 3) dc->mem_index = 2 * 4; else dc->mem_index = 1 * 4; } dc->cpuid_features = env->cpuid_features; dc->cpuid_ext_features = env->cpuid_ext_features; dc->cpuid_ext2_features = env->cpuid_ext2_features; dc->cpuid_ext3_features = env->cpuid_ext3_features; #ifdef TARGET_X86_64 dc->lma = (flags >> HF_LMA_SHIFT) & 1; dc->code64 = (flags >> HF_CS64_SHIFT) & 1; #endif dc->flags = flags; dc->jmp_opt = !(dc->tf || env->singlestep_enabled || (flags & HF_INHIBIT_IRQ_MASK) #ifndef CONFIG_SOFTMMU || (flags & HF_SOFTMMU_MASK) #endif ); #if 0 if (!dc->addseg && (dc->vm86 || !dc->pe || !dc->code32)) printf("ERROR addseg\n"); #endif cpu_T[0] = tcg_temp_new(); cpu_T[1] = tcg_temp_new(); cpu_A0 = tcg_temp_new(); cpu_T3 = tcg_temp_new(); cpu_tmp0 = tcg_temp_new(); cpu_tmp1_i64 = tcg_temp_new_i64(); cpu_tmp2_i32 = tcg_temp_new_i32(); cpu_tmp3_i32 = tcg_temp_new_i32(); cpu_tmp4 = tcg_temp_new(); cpu_tmp5 = tcg_temp_new(); cpu_ptr0 = tcg_temp_new_ptr(); cpu_ptr1 = tcg_temp_new_ptr(); gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; pc_ptr = pc_start; lj = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) max_insns = CF_COUNT_MASK; gen_icount_start(); for(;;) { if (unlikely(!QTAILQ_EMPTY(&env->breakpoints))) { QTAILQ_FOREACH(bp, &env->breakpoints, entry) { if (bp->pc == pc_ptr && !((bp->flags & BP_CPU) && (tb->flags & HF_RF_MASK))) { gen_debug(dc, pc_ptr - dc->cs_base); break; } } } if (search_pc) { j = gen_opc_ptr - gen_opc_buf; if (lj < j) { lj++; while (lj < j) gen_opc_instr_start[lj++] = 0; } gen_opc_pc[lj] = pc_ptr; gen_opc_cc_op[lj] = dc->cc_op; gen_opc_instr_start[lj] = 1; gen_opc_icount[lj] = num_insns; } if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) gen_io_start(); pc_ptr = disas_insn(dc, pc_ptr); num_insns++; if (dc->is_jmp) break; if (dc->tf || dc->singlestep_enabled || (flags & HF_INHIBIT_IRQ_MASK)) { gen_jmp_im(pc_ptr - dc->cs_base); gen_eob(dc); break; } if (gen_opc_ptr >= gen_opc_end || (pc_ptr - pc_start) >= (TARGET_PAGE_SIZE - 32) || num_insns >= max_insns) { gen_jmp_im(pc_ptr - dc->cs_base); gen_eob(dc); break; } if (singlestep) { gen_jmp_im(pc_ptr - dc->cs_base); gen_eob(dc); break; } } if (tb->cflags & CF_LAST_IO) gen_io_end(); gen_icount_end(tb, num_insns); *gen_opc_ptr = INDEX_op_end; if (search_pc) { j = gen_opc_ptr - gen_opc_buf; lj++; while (lj <= j) gen_opc_instr_start[lj++] = 0; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { int disas_flags; qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); #ifdef TARGET_X86_64 if (dc->code64) disas_flags = 2; else #endif disas_flags = !dc->code32; log_target_disas(pc_start, pc_ptr - pc_start, disas_flags); qemu_log("\n"); } #endif if (!search_pc) { tb->size = pc_ptr - pc_start; tb->icount = num_insns; } }
{ "code": [], "line_no": [] }
static inline void FUNC_0(CPUX86State *VAR_0, TranslationBlock *VAR_1, int VAR_2) { DisasContext dc1, *dc = &dc1; target_ulong pc_ptr; uint16_t *gen_opc_end; CPUBreakpoint *bp; int VAR_3, VAR_4; uint64_t flags; target_ulong pc_start; target_ulong cs_base; int VAR_5; int VAR_6; pc_start = VAR_1->pc; cs_base = VAR_1->cs_base; flags = VAR_1->flags; dc->pe = (flags >> HF_PE_SHIFT) & 1; dc->code32 = (flags >> HF_CS32_SHIFT) & 1; dc->ss32 = (flags >> HF_SS32_SHIFT) & 1; dc->addseg = (flags >> HF_ADDSEG_SHIFT) & 1; dc->f_st = 0; dc->vm86 = (flags >> VM_SHIFT) & 1; dc->cpl = (flags >> HF_CPL_SHIFT) & 3; dc->iopl = (flags >> IOPL_SHIFT) & 3; dc->tf = (flags >> TF_SHIFT) & 1; dc->singlestep_enabled = VAR_0->singlestep_enabled; dc->cc_op = CC_OP_DYNAMIC; dc->cs_base = cs_base; dc->VAR_1 = VAR_1; dc->popl_esp_hack = 0; dc->mem_index = 0; if (flags & HF_SOFTMMU_MASK) { if (dc->cpl == 3) dc->mem_index = 2 * 4; else dc->mem_index = 1 * 4; } dc->cpuid_features = VAR_0->cpuid_features; dc->cpuid_ext_features = VAR_0->cpuid_ext_features; dc->cpuid_ext2_features = VAR_0->cpuid_ext2_features; dc->cpuid_ext3_features = VAR_0->cpuid_ext3_features; #ifdef TARGET_X86_64 dc->lma = (flags >> HF_LMA_SHIFT) & 1; dc->code64 = (flags >> HF_CS64_SHIFT) & 1; #endif dc->flags = flags; dc->jmp_opt = !(dc->tf || VAR_0->singlestep_enabled || (flags & HF_INHIBIT_IRQ_MASK) #ifndef CONFIG_SOFTMMU || (flags & HF_SOFTMMU_MASK) #endif ); #if 0 if (!dc->addseg && (dc->vm86 || !dc->pe || !dc->code32)) printf("ERROR addseg\n"); #endif cpu_T[0] = tcg_temp_new(); cpu_T[1] = tcg_temp_new(); cpu_A0 = tcg_temp_new(); cpu_T3 = tcg_temp_new(); cpu_tmp0 = tcg_temp_new(); cpu_tmp1_i64 = tcg_temp_new_i64(); cpu_tmp2_i32 = tcg_temp_new_i32(); cpu_tmp3_i32 = tcg_temp_new_i32(); cpu_tmp4 = tcg_temp_new(); cpu_tmp5 = tcg_temp_new(); cpu_ptr0 = tcg_temp_new_ptr(); cpu_ptr1 = tcg_temp_new_ptr(); gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; pc_ptr = pc_start; VAR_4 = -1; VAR_5 = 0; VAR_6 = VAR_1->cflags & CF_COUNT_MASK; if (VAR_6 == 0) VAR_6 = CF_COUNT_MASK; gen_icount_start(); for(;;) { if (unlikely(!QTAILQ_EMPTY(&VAR_0->breakpoints))) { QTAILQ_FOREACH(bp, &VAR_0->breakpoints, entry) { if (bp->pc == pc_ptr && !((bp->flags & BP_CPU) && (VAR_1->flags & HF_RF_MASK))) { gen_debug(dc, pc_ptr - dc->cs_base); break; } } } if (VAR_2) { VAR_3 = gen_opc_ptr - gen_opc_buf; if (VAR_4 < VAR_3) { VAR_4++; while (VAR_4 < VAR_3) gen_opc_instr_start[VAR_4++] = 0; } gen_opc_pc[VAR_4] = pc_ptr; gen_opc_cc_op[VAR_4] = dc->cc_op; gen_opc_instr_start[VAR_4] = 1; gen_opc_icount[VAR_4] = VAR_5; } if (VAR_5 + 1 == VAR_6 && (VAR_1->cflags & CF_LAST_IO)) gen_io_start(); pc_ptr = disas_insn(dc, pc_ptr); VAR_5++; if (dc->is_jmp) break; if (dc->tf || dc->singlestep_enabled || (flags & HF_INHIBIT_IRQ_MASK)) { gen_jmp_im(pc_ptr - dc->cs_base); gen_eob(dc); break; } if (gen_opc_ptr >= gen_opc_end || (pc_ptr - pc_start) >= (TARGET_PAGE_SIZE - 32) || VAR_5 >= VAR_6) { gen_jmp_im(pc_ptr - dc->cs_base); gen_eob(dc); break; } if (singlestep) { gen_jmp_im(pc_ptr - dc->cs_base); gen_eob(dc); break; } } if (VAR_1->cflags & CF_LAST_IO) gen_io_end(); gen_icount_end(VAR_1, VAR_5); *gen_opc_ptr = INDEX_op_end; if (VAR_2) { VAR_3 = gen_opc_ptr - gen_opc_buf; VAR_4++; while (VAR_4 <= VAR_3) gen_opc_instr_start[VAR_4++] = 0; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { int disas_flags; qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); #ifdef TARGET_X86_64 if (dc->code64) disas_flags = 2; else #endif disas_flags = !dc->code32; log_target_disas(pc_start, pc_ptr - pc_start, disas_flags); qemu_log("\n"); } #endif if (!VAR_2) { VAR_1->size = pc_ptr - pc_start; VAR_1->icount = VAR_5; } }
[ "static inline void FUNC_0(CPUX86State *VAR_0,\nTranslationBlock *VAR_1,\nint VAR_2)\n{", "DisasContext dc1, *dc = &dc1;", "target_ulong pc_ptr;", "uint16_t *gen_opc_end;", "CPUBreakpoint *bp;", "int VAR_3, VAR_4;", "uint64_t flags;", "target_ulong pc_start;", "target_ulong cs_base;", "int VAR_5;", "int VAR_6;", "pc_start = VAR_1->pc;", "cs_base = VAR_1->cs_base;", "flags = VAR_1->flags;", "dc->pe = (flags >> HF_PE_SHIFT) & 1;", "dc->code32 = (flags >> HF_CS32_SHIFT) & 1;", "dc->ss32 = (flags >> HF_SS32_SHIFT) & 1;", "dc->addseg = (flags >> HF_ADDSEG_SHIFT) & 1;", "dc->f_st = 0;", "dc->vm86 = (flags >> VM_SHIFT) & 1;", "dc->cpl = (flags >> HF_CPL_SHIFT) & 3;", "dc->iopl = (flags >> IOPL_SHIFT) & 3;", "dc->tf = (flags >> TF_SHIFT) & 1;", "dc->singlestep_enabled = VAR_0->singlestep_enabled;", "dc->cc_op = CC_OP_DYNAMIC;", "dc->cs_base = cs_base;", "dc->VAR_1 = VAR_1;", "dc->popl_esp_hack = 0;", "dc->mem_index = 0;", "if (flags & HF_SOFTMMU_MASK) {", "if (dc->cpl == 3)\ndc->mem_index = 2 * 4;", "else\ndc->mem_index = 1 * 4;", "}", "dc->cpuid_features = VAR_0->cpuid_features;", "dc->cpuid_ext_features = VAR_0->cpuid_ext_features;", "dc->cpuid_ext2_features = VAR_0->cpuid_ext2_features;", "dc->cpuid_ext3_features = VAR_0->cpuid_ext3_features;", "#ifdef TARGET_X86_64\ndc->lma = (flags >> HF_LMA_SHIFT) & 1;", "dc->code64 = (flags >> HF_CS64_SHIFT) & 1;", "#endif\ndc->flags = flags;", "dc->jmp_opt = !(dc->tf || VAR_0->singlestep_enabled ||\n(flags & HF_INHIBIT_IRQ_MASK)\n#ifndef CONFIG_SOFTMMU\n|| (flags & HF_SOFTMMU_MASK)\n#endif\n);", "#if 0\nif (!dc->addseg && (dc->vm86 || !dc->pe || !dc->code32))\nprintf(\"ERROR addseg\\n\");", "#endif\ncpu_T[0] = tcg_temp_new();", "cpu_T[1] = tcg_temp_new();", "cpu_A0 = tcg_temp_new();", "cpu_T3 = tcg_temp_new();", "cpu_tmp0 = tcg_temp_new();", "cpu_tmp1_i64 = tcg_temp_new_i64();", "cpu_tmp2_i32 = tcg_temp_new_i32();", "cpu_tmp3_i32 = tcg_temp_new_i32();", "cpu_tmp4 = tcg_temp_new();", "cpu_tmp5 = tcg_temp_new();", "cpu_ptr0 = tcg_temp_new_ptr();", "cpu_ptr1 = tcg_temp_new_ptr();", "gen_opc_end = gen_opc_buf + OPC_MAX_SIZE;", "dc->is_jmp = DISAS_NEXT;", "pc_ptr = pc_start;", "VAR_4 = -1;", "VAR_5 = 0;", "VAR_6 = VAR_1->cflags & CF_COUNT_MASK;", "if (VAR_6 == 0)\nVAR_6 = CF_COUNT_MASK;", "gen_icount_start();", "for(;;) {", "if (unlikely(!QTAILQ_EMPTY(&VAR_0->breakpoints))) {", "QTAILQ_FOREACH(bp, &VAR_0->breakpoints, entry) {", "if (bp->pc == pc_ptr &&\n!((bp->flags & BP_CPU) && (VAR_1->flags & HF_RF_MASK))) {", "gen_debug(dc, pc_ptr - dc->cs_base);", "break;", "}", "}", "}", "if (VAR_2) {", "VAR_3 = gen_opc_ptr - gen_opc_buf;", "if (VAR_4 < VAR_3) {", "VAR_4++;", "while (VAR_4 < VAR_3)\ngen_opc_instr_start[VAR_4++] = 0;", "}", "gen_opc_pc[VAR_4] = pc_ptr;", "gen_opc_cc_op[VAR_4] = dc->cc_op;", "gen_opc_instr_start[VAR_4] = 1;", "gen_opc_icount[VAR_4] = VAR_5;", "}", "if (VAR_5 + 1 == VAR_6 && (VAR_1->cflags & CF_LAST_IO))\ngen_io_start();", "pc_ptr = disas_insn(dc, pc_ptr);", "VAR_5++;", "if (dc->is_jmp)\nbreak;", "if (dc->tf || dc->singlestep_enabled ||\n(flags & HF_INHIBIT_IRQ_MASK)) {", "gen_jmp_im(pc_ptr - dc->cs_base);", "gen_eob(dc);", "break;", "}", "if (gen_opc_ptr >= gen_opc_end ||\n(pc_ptr - pc_start) >= (TARGET_PAGE_SIZE - 32) ||\nVAR_5 >= VAR_6) {", "gen_jmp_im(pc_ptr - dc->cs_base);", "gen_eob(dc);", "break;", "}", "if (singlestep) {", "gen_jmp_im(pc_ptr - dc->cs_base);", "gen_eob(dc);", "break;", "}", "}", "if (VAR_1->cflags & CF_LAST_IO)\ngen_io_end();", "gen_icount_end(VAR_1, VAR_5);", "*gen_opc_ptr = INDEX_op_end;", "if (VAR_2) {", "VAR_3 = gen_opc_ptr - gen_opc_buf;", "VAR_4++;", "while (VAR_4 <= VAR_3)\ngen_opc_instr_start[VAR_4++] = 0;", "}", "#ifdef DEBUG_DISAS\nif (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {", "int disas_flags;", "qemu_log(\"----------------\\n\");", "qemu_log(\"IN: %s\\n\", lookup_symbol(pc_start));", "#ifdef TARGET_X86_64\nif (dc->code64)\ndisas_flags = 2;", "else\n#endif\ndisas_flags = !dc->code32;", "log_target_disas(pc_start, pc_ptr - pc_start, disas_flags);", "qemu_log(\"\\n\");", "}", "#endif\nif (!VAR_2) {", "VAR_1->size = pc_ptr - pc_start;", "VAR_1->icount = VAR_5;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 35 ], [ 37 ], [ 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, 101 ], [ 103, 105, 107, 109, 111, 113 ], [ 115, 119, 121 ], [ 123, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221, 223 ], [ 227 ], [ 229 ], [ 233, 235 ], [ 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 261, 263, 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287, 289 ], [ 291 ], [ 293 ], [ 297 ], [ 299 ], [ 301 ], [ 303, 305 ], [ 307 ], [ 311, 313 ], [ 315 ], [ 317 ], [ 319 ], [ 321, 323, 325 ], [ 327, 329, 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339, 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ] ]
8,251
static void vfio_probe_nvidia_bar5_quirk(VFIOPCIDevice *vdev, int nr) { VFIOQuirk *quirk; VFIONvidiaBAR5Quirk *bar5; VFIOConfigWindowQuirk *window; if (!vfio_pci_is(vdev, PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID) || !vdev->has_vga || nr != 5) { return; } quirk = g_malloc0(sizeof(*quirk)); quirk->mem = g_new0(MemoryRegion, 4); quirk->nr_mem = 4; bar5 = quirk->data = g_malloc0(sizeof(*bar5) + (sizeof(VFIOConfigWindowMatch) * 2)); window = &bar5->window; window->vdev = vdev; window->address_offset = 0x8; window->data_offset = 0xc; window->nr_matches = 2; window->matches[0].match = 0x1800; window->matches[0].mask = PCI_CONFIG_SPACE_SIZE - 1; window->matches[1].match = 0x88000; window->matches[1].mask = PCIE_CONFIG_SPACE_SIZE - 1; window->bar = nr; window->addr_mem = bar5->addr_mem = &quirk->mem[0]; window->data_mem = bar5->data_mem = &quirk->mem[1]; memory_region_init_io(window->addr_mem, OBJECT(vdev), &vfio_generic_window_address_quirk, window, "vfio-nvidia-bar5-window-address-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, window->address_offset, window->addr_mem, 1); memory_region_set_enabled(window->addr_mem, false); memory_region_init_io(window->data_mem, OBJECT(vdev), &vfio_generic_window_data_quirk, window, "vfio-nvidia-bar5-window-data-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, window->data_offset, window->data_mem, 1); memory_region_set_enabled(window->data_mem, false); memory_region_init_io(&quirk->mem[2], OBJECT(vdev), &vfio_nvidia_bar5_quirk_master, bar5, "vfio-nvidia-bar5-master-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, 0, &quirk->mem[2], 1); memory_region_init_io(&quirk->mem[3], OBJECT(vdev), &vfio_nvidia_bar5_quirk_enable, bar5, "vfio-nvidia-bar5-enable-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, 4, &quirk->mem[3], 1); QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next); trace_vfio_quirk_nvidia_bar5_probe(vdev->vbasedev.name); }
false
qemu
f5793fd9e1fd89808f4adbfe690235b094176a37
static void vfio_probe_nvidia_bar5_quirk(VFIOPCIDevice *vdev, int nr) { VFIOQuirk *quirk; VFIONvidiaBAR5Quirk *bar5; VFIOConfigWindowQuirk *window; if (!vfio_pci_is(vdev, PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID) || !vdev->has_vga || nr != 5) { return; } quirk = g_malloc0(sizeof(*quirk)); quirk->mem = g_new0(MemoryRegion, 4); quirk->nr_mem = 4; bar5 = quirk->data = g_malloc0(sizeof(*bar5) + (sizeof(VFIOConfigWindowMatch) * 2)); window = &bar5->window; window->vdev = vdev; window->address_offset = 0x8; window->data_offset = 0xc; window->nr_matches = 2; window->matches[0].match = 0x1800; window->matches[0].mask = PCI_CONFIG_SPACE_SIZE - 1; window->matches[1].match = 0x88000; window->matches[1].mask = PCIE_CONFIG_SPACE_SIZE - 1; window->bar = nr; window->addr_mem = bar5->addr_mem = &quirk->mem[0]; window->data_mem = bar5->data_mem = &quirk->mem[1]; memory_region_init_io(window->addr_mem, OBJECT(vdev), &vfio_generic_window_address_quirk, window, "vfio-nvidia-bar5-window-address-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, window->address_offset, window->addr_mem, 1); memory_region_set_enabled(window->addr_mem, false); memory_region_init_io(window->data_mem, OBJECT(vdev), &vfio_generic_window_data_quirk, window, "vfio-nvidia-bar5-window-data-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, window->data_offset, window->data_mem, 1); memory_region_set_enabled(window->data_mem, false); memory_region_init_io(&quirk->mem[2], OBJECT(vdev), &vfio_nvidia_bar5_quirk_master, bar5, "vfio-nvidia-bar5-master-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, 0, &quirk->mem[2], 1); memory_region_init_io(&quirk->mem[3], OBJECT(vdev), &vfio_nvidia_bar5_quirk_enable, bar5, "vfio-nvidia-bar5-enable-quirk", 4); memory_region_add_subregion_overlap(&vdev->bars[nr].region.mem, 4, &quirk->mem[3], 1); QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next); trace_vfio_quirk_nvidia_bar5_probe(vdev->vbasedev.name); }
{ "code": [], "line_no": [] }
static void FUNC_0(VFIOPCIDevice *VAR_0, int VAR_1) { VFIOQuirk *quirk; VFIONvidiaBAR5Quirk *bar5; VFIOConfigWindowQuirk *window; if (!vfio_pci_is(VAR_0, PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID) || !VAR_0->has_vga || VAR_1 != 5) { return; } quirk = g_malloc0(sizeof(*quirk)); quirk->mem = g_new0(MemoryRegion, 4); quirk->nr_mem = 4; bar5 = quirk->data = g_malloc0(sizeof(*bar5) + (sizeof(VFIOConfigWindowMatch) * 2)); window = &bar5->window; window->VAR_0 = VAR_0; window->address_offset = 0x8; window->data_offset = 0xc; window->nr_matches = 2; window->matches[0].match = 0x1800; window->matches[0].mask = PCI_CONFIG_SPACE_SIZE - 1; window->matches[1].match = 0x88000; window->matches[1].mask = PCIE_CONFIG_SPACE_SIZE - 1; window->bar = VAR_1; window->addr_mem = bar5->addr_mem = &quirk->mem[0]; window->data_mem = bar5->data_mem = &quirk->mem[1]; memory_region_init_io(window->addr_mem, OBJECT(VAR_0), &vfio_generic_window_address_quirk, window, "vfio-nvidia-bar5-window-address-quirk", 4); memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem, window->address_offset, window->addr_mem, 1); memory_region_set_enabled(window->addr_mem, false); memory_region_init_io(window->data_mem, OBJECT(VAR_0), &vfio_generic_window_data_quirk, window, "vfio-nvidia-bar5-window-data-quirk", 4); memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem, window->data_offset, window->data_mem, 1); memory_region_set_enabled(window->data_mem, false); memory_region_init_io(&quirk->mem[2], OBJECT(VAR_0), &vfio_nvidia_bar5_quirk_master, bar5, "vfio-nvidia-bar5-master-quirk", 4); memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem, 0, &quirk->mem[2], 1); memory_region_init_io(&quirk->mem[3], OBJECT(VAR_0), &vfio_nvidia_bar5_quirk_enable, bar5, "vfio-nvidia-bar5-enable-quirk", 4); memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem, 4, &quirk->mem[3], 1); QLIST_INSERT_HEAD(&VAR_0->bars[VAR_1].quirks, quirk, next); trace_vfio_quirk_nvidia_bar5_probe(VAR_0->vbasedev.name); }
[ "static void FUNC_0(VFIOPCIDevice *VAR_0, int VAR_1)\n{", "VFIOQuirk *quirk;", "VFIONvidiaBAR5Quirk *bar5;", "VFIOConfigWindowQuirk *window;", "if (!vfio_pci_is(VAR_0, PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID) ||\n!VAR_0->has_vga || VAR_1 != 5) {", "return;", "}", "quirk = g_malloc0(sizeof(*quirk));", "quirk->mem = g_new0(MemoryRegion, 4);", "quirk->nr_mem = 4;", "bar5 = quirk->data = g_malloc0(sizeof(*bar5) +\n(sizeof(VFIOConfigWindowMatch) * 2));", "window = &bar5->window;", "window->VAR_0 = VAR_0;", "window->address_offset = 0x8;", "window->data_offset = 0xc;", "window->nr_matches = 2;", "window->matches[0].match = 0x1800;", "window->matches[0].mask = PCI_CONFIG_SPACE_SIZE - 1;", "window->matches[1].match = 0x88000;", "window->matches[1].mask = PCIE_CONFIG_SPACE_SIZE - 1;", "window->bar = VAR_1;", "window->addr_mem = bar5->addr_mem = &quirk->mem[0];", "window->data_mem = bar5->data_mem = &quirk->mem[1];", "memory_region_init_io(window->addr_mem, OBJECT(VAR_0),\n&vfio_generic_window_address_quirk, window,\n\"vfio-nvidia-bar5-window-address-quirk\", 4);", "memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem,\nwindow->address_offset,\nwindow->addr_mem, 1);", "memory_region_set_enabled(window->addr_mem, false);", "memory_region_init_io(window->data_mem, OBJECT(VAR_0),\n&vfio_generic_window_data_quirk, window,\n\"vfio-nvidia-bar5-window-data-quirk\", 4);", "memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem,\nwindow->data_offset,\nwindow->data_mem, 1);", "memory_region_set_enabled(window->data_mem, false);", "memory_region_init_io(&quirk->mem[2], OBJECT(VAR_0),\n&vfio_nvidia_bar5_quirk_master, bar5,\n\"vfio-nvidia-bar5-master-quirk\", 4);", "memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem,\n0, &quirk->mem[2], 1);", "memory_region_init_io(&quirk->mem[3], OBJECT(VAR_0),\n&vfio_nvidia_bar5_quirk_enable, bar5,\n\"vfio-nvidia-bar5-enable-quirk\", 4);", "memory_region_add_subregion_overlap(&VAR_0->bars[VAR_1].region.mem,\n4, &quirk->mem[3], 1);", "QLIST_INSERT_HEAD(&VAR_0->bars[VAR_1].quirks, quirk, next);", "trace_vfio_quirk_nvidia_bar5_probe(VAR_0->vbasedev.name);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61, 63, 65 ], [ 67, 69, 71 ], [ 73 ], [ 77, 79, 81 ], [ 83, 85, 87 ], [ 89 ], [ 93, 95, 97 ], [ 99, 101 ], [ 105, 107, 109 ], [ 111, 113 ], [ 117 ], [ 121 ], [ 123 ] ]
8,252
static void RENAME(lumRangeToJpeg)(int16_t *dst, int width) { int i; for (i = 0; i < width; i++) dst[i] = (FFMIN(dst[i],30189)*19077 - 39057361)>>14; }
false
FFmpeg
d1adad3cca407f493c3637e20ecd4f7124e69212
static void RENAME(lumRangeToJpeg)(int16_t *dst, int width) { int i; for (i = 0; i < width; i++) dst[i] = (FFMIN(dst[i],30189)*19077 - 39057361)>>14; }
{ "code": [], "line_no": [] }
static void FUNC_0(lumRangeToJpeg)(int16_t *dst, int width) { int VAR_0; for (VAR_0 = 0; VAR_0 < width; VAR_0++) dst[VAR_0] = (FFMIN(dst[VAR_0],30189)*19077 - 39057361)>>14; }
[ "static void FUNC_0(lumRangeToJpeg)(int16_t *dst, int width)\n{", "int VAR_0;", "for (VAR_0 = 0; VAR_0 < width; VAR_0++)", "dst[VAR_0] = (FFMIN(dst[VAR_0],30189)*19077 - 39057361)>>14;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
8,253
Coroutine *qemu_coroutine_create(CoroutineEntry *entry) { Coroutine *co; co = QSLIST_FIRST(&pool); if (co) { QSLIST_REMOVE_HEAD(&pool, pool_next); pool_size--; } else { co = qemu_coroutine_new(); } co->entry = entry; return co; }
false
qemu
b84c4586234b26ccc875595713f6f4491e5b3385
Coroutine *qemu_coroutine_create(CoroutineEntry *entry) { Coroutine *co; co = QSLIST_FIRST(&pool); if (co) { QSLIST_REMOVE_HEAD(&pool, pool_next); pool_size--; } else { co = qemu_coroutine_new(); } co->entry = entry; return co; }
{ "code": [], "line_no": [] }
Coroutine *FUNC_0(CoroutineEntry *entry) { Coroutine *co; co = QSLIST_FIRST(&pool); if (co) { QSLIST_REMOVE_HEAD(&pool, pool_next); pool_size--; } else { co = qemu_coroutine_new(); } co->entry = entry; return co; }
[ "Coroutine *FUNC_0(CoroutineEntry *entry)\n{", "Coroutine *co;", "co = QSLIST_FIRST(&pool);", "if (co) {", "QSLIST_REMOVE_HEAD(&pool, pool_next);", "pool_size--;", "} else {", "co = qemu_coroutine_new();", "}", "co->entry = entry;", "return co;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ] ]
8,256
static size_t write_to_port(VirtIOSerialPort *port, const uint8_t *buf, size_t size) { VirtQueueElement elem; VirtQueue *vq; size_t offset = 0; size_t len = 0; vq = port->ivq; if (!virtio_queue_ready(vq)) { return 0; } if (!size) { return 0; } while (offset < size) { int i; if (!virtqueue_pop(vq, &elem)) { break; } for (i = 0; offset < size && i < elem.in_num; i++) { len = MIN(elem.in_sg[i].iov_len, size - offset); memcpy(elem.in_sg[i].iov_base, buf + offset, len); offset += len; } virtqueue_push(vq, &elem, len); } virtio_notify(&port->vser->vdev, vq); return offset; }
false
qemu
e30f328c7429d4e891ce6da26af95c607f392739
static size_t write_to_port(VirtIOSerialPort *port, const uint8_t *buf, size_t size) { VirtQueueElement elem; VirtQueue *vq; size_t offset = 0; size_t len = 0; vq = port->ivq; if (!virtio_queue_ready(vq)) { return 0; } if (!size) { return 0; } while (offset < size) { int i; if (!virtqueue_pop(vq, &elem)) { break; } for (i = 0; offset < size && i < elem.in_num; i++) { len = MIN(elem.in_sg[i].iov_len, size - offset); memcpy(elem.in_sg[i].iov_base, buf + offset, len); offset += len; } virtqueue_push(vq, &elem, len); } virtio_notify(&port->vser->vdev, vq); return offset; }
{ "code": [], "line_no": [] }
static size_t FUNC_0(VirtIOSerialPort *port, const uint8_t *buf, size_t size) { VirtQueueElement elem; VirtQueue *vq; size_t offset = 0; size_t len = 0; vq = port->ivq; if (!virtio_queue_ready(vq)) { return 0; } if (!size) { return 0; } while (offset < size) { int VAR_0; if (!virtqueue_pop(vq, &elem)) { break; } for (VAR_0 = 0; offset < size && VAR_0 < elem.in_num; VAR_0++) { len = MIN(elem.in_sg[VAR_0].iov_len, size - offset); memcpy(elem.in_sg[VAR_0].iov_base, buf + offset, len); offset += len; } virtqueue_push(vq, &elem, len); } virtio_notify(&port->vser->vdev, vq); return offset; }
[ "static size_t FUNC_0(VirtIOSerialPort *port,\nconst uint8_t *buf, size_t size)\n{", "VirtQueueElement elem;", "VirtQueue *vq;", "size_t offset = 0;", "size_t len = 0;", "vq = port->ivq;", "if (!virtio_queue_ready(vq)) {", "return 0;", "}", "if (!size) {", "return 0;", "}", "while (offset < size) {", "int VAR_0;", "if (!virtqueue_pop(vq, &elem)) {", "break;", "}", "for (VAR_0 = 0; offset < size && VAR_0 < elem.in_num; VAR_0++) {", "len = MIN(elem.in_sg[VAR_0].iov_len, size - offset);", "memcpy(elem.in_sg[VAR_0].iov_base, buf + offset, len);", "offset += len;", "}", "virtqueue_push(vq, &elem, len);", "}", "virtio_notify(&port->vser->vdev, vq);", "return offset;", "}" ]
[ 0, 0, 0, 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 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ] ]
8,257
static char *tcg_get_arg_str_idx(TCGContext *s, char *buf, int buf_size, int idx) { TCGTemp *ts; assert(idx >= 0 && idx < s->nb_temps); ts = &s->temps[idx]; assert(ts); if (idx < s->nb_globals) { pstrcpy(buf, buf_size, ts->name); } else { if (ts->temp_local) snprintf(buf, buf_size, "loc%d", idx - s->nb_globals); else snprintf(buf, buf_size, "tmp%d", idx - s->nb_globals); } return buf; }
false
qemu
9a8a5ae69d3a436e51a7eb2edafe254572f60823
static char *tcg_get_arg_str_idx(TCGContext *s, char *buf, int buf_size, int idx) { TCGTemp *ts; assert(idx >= 0 && idx < s->nb_temps); ts = &s->temps[idx]; assert(ts); if (idx < s->nb_globals) { pstrcpy(buf, buf_size, ts->name); } else { if (ts->temp_local) snprintf(buf, buf_size, "loc%d", idx - s->nb_globals); else snprintf(buf, buf_size, "tmp%d", idx - s->nb_globals); } return buf; }
{ "code": [], "line_no": [] }
static char *FUNC_0(TCGContext *VAR_0, char *VAR_1, int VAR_2, int VAR_3) { TCGTemp *ts; assert(VAR_3 >= 0 && VAR_3 < VAR_0->nb_temps); ts = &VAR_0->temps[VAR_3]; assert(ts); if (VAR_3 < VAR_0->nb_globals) { pstrcpy(VAR_1, VAR_2, ts->name); } else { if (ts->temp_local) snprintf(VAR_1, VAR_2, "loc%d", VAR_3 - VAR_0->nb_globals); else snprintf(VAR_1, VAR_2, "tmp%d", VAR_3 - VAR_0->nb_globals); } return VAR_1; }
[ "static char *FUNC_0(TCGContext *VAR_0, char *VAR_1, int VAR_2,\nint VAR_3)\n{", "TCGTemp *ts;", "assert(VAR_3 >= 0 && VAR_3 < VAR_0->nb_temps);", "ts = &VAR_0->temps[VAR_3];", "assert(ts);", "if (VAR_3 < VAR_0->nb_globals) {", "pstrcpy(VAR_1, VAR_2, ts->name);", "} else {", "if (ts->temp_local)\nsnprintf(VAR_1, VAR_2, \"loc%d\", VAR_3 - VAR_0->nb_globals);", "else\nsnprintf(VAR_1, VAR_2, \"tmp%d\", VAR_3 - VAR_0->nb_globals);", "}", "return VAR_1;", "}" ]
[ 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 ] ]
8,258
static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs) { BDRVQcow2State *s = bs->opaque; ImageInfoSpecific *spec_info = g_new(ImageInfoSpecific, 1); *spec_info = (ImageInfoSpecific){ .kind = IMAGE_INFO_SPECIFIC_KIND_QCOW2, { .qcow2 = g_new(ImageInfoSpecificQCow2, 1), }, }; if (s->qcow_version == 2) { *spec_info->qcow2 = (ImageInfoSpecificQCow2){ .compat = g_strdup("0.10"), .refcount_bits = s->refcount_bits, }; } else if (s->qcow_version == 3) { *spec_info->qcow2 = (ImageInfoSpecificQCow2){ .compat = g_strdup("1.1"), .lazy_refcounts = s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS, .has_lazy_refcounts = true, .corrupt = s->incompatible_features & QCOW2_INCOMPAT_CORRUPT, .has_corrupt = true, .refcount_bits = s->refcount_bits, }; } return spec_info; }
false
qemu
6a8f9661dc3c088ed0d2f5b41d940190407cbdc5
static ImageInfoSpecific *qcow2_get_specific_info(BlockDriverState *bs) { BDRVQcow2State *s = bs->opaque; ImageInfoSpecific *spec_info = g_new(ImageInfoSpecific, 1); *spec_info = (ImageInfoSpecific){ .kind = IMAGE_INFO_SPECIFIC_KIND_QCOW2, { .qcow2 = g_new(ImageInfoSpecificQCow2, 1), }, }; if (s->qcow_version == 2) { *spec_info->qcow2 = (ImageInfoSpecificQCow2){ .compat = g_strdup("0.10"), .refcount_bits = s->refcount_bits, }; } else if (s->qcow_version == 3) { *spec_info->qcow2 = (ImageInfoSpecificQCow2){ .compat = g_strdup("1.1"), .lazy_refcounts = s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS, .has_lazy_refcounts = true, .corrupt = s->incompatible_features & QCOW2_INCOMPAT_CORRUPT, .has_corrupt = true, .refcount_bits = s->refcount_bits, }; } return spec_info; }
{ "code": [], "line_no": [] }
static ImageInfoSpecific *FUNC_0(BlockDriverState *bs) { BDRVQcow2State *s = bs->opaque; ImageInfoSpecific *spec_info = g_new(ImageInfoSpecific, 1); *spec_info = (ImageInfoSpecific){ .kind = IMAGE_INFO_SPECIFIC_KIND_QCOW2, { .qcow2 = g_new(ImageInfoSpecificQCow2, 1), }, }; if (s->qcow_version == 2) { *spec_info->qcow2 = (ImageInfoSpecificQCow2){ .compat = g_strdup("0.10"), .refcount_bits = s->refcount_bits, }; } else if (s->qcow_version == 3) { *spec_info->qcow2 = (ImageInfoSpecificQCow2){ .compat = g_strdup("1.1"), .lazy_refcounts = s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS, .has_lazy_refcounts = true, .corrupt = s->incompatible_features & QCOW2_INCOMPAT_CORRUPT, .has_corrupt = true, .refcount_bits = s->refcount_bits, }; } return spec_info; }
[ "static ImageInfoSpecific *FUNC_0(BlockDriverState *bs)\n{", "BDRVQcow2State *s = bs->opaque;", "ImageInfoSpecific *spec_info = g_new(ImageInfoSpecific, 1);", "*spec_info = (ImageInfoSpecific){", ".kind = IMAGE_INFO_SPECIFIC_KIND_QCOW2,\n{", ".qcow2 = g_new(ImageInfoSpecificQCow2, 1),\n},", "};", "if (s->qcow_version == 2) {", "*spec_info->qcow2 = (ImageInfoSpecificQCow2){", ".compat = g_strdup(\"0.10\"),\n.refcount_bits = s->refcount_bits,\n};", "} else if (s->qcow_version == 3) {", "*spec_info->qcow2 = (ImageInfoSpecificQCow2){", ".compat = g_strdup(\"1.1\"),\n.lazy_refcounts = s->compatible_features &\nQCOW2_COMPAT_LAZY_REFCOUNTS,\n.has_lazy_refcounts = true,\n.corrupt = s->incompatible_features &\nQCOW2_INCOMPAT_CORRUPT,\n.has_corrupt = true,\n.refcount_bits = s->refcount_bits,\n};", "}", "return spec_info;", "}" ]
[ 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 ], [ 59 ], [ 61 ] ]
8,259
static void kvm_cpu_fill_host(x86_def_t *x86_cpu_def) { uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; assert(kvm_enabled()); x86_cpu_def->name = "host"; host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx); x86_cpu_def->level = eax; x86_cpu_def->vendor1 = ebx; x86_cpu_def->vendor2 = edx; x86_cpu_def->vendor3 = ecx; host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx); x86_cpu_def->family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF); x86_cpu_def->model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12); x86_cpu_def->stepping = eax & 0x0F; x86_cpu_def->ext_features = ecx; x86_cpu_def->features = edx; if (x86_cpu_def->level >= 7) { x86_cpu_def->cpuid_7_0_ebx_features = kvm_arch_get_supported_cpuid(kvm_state, 0x7, 0, R_EBX); } else { x86_cpu_def->cpuid_7_0_ebx_features = 0; } host_cpuid(0x80000000, 0, &eax, &ebx, &ecx, &edx); x86_cpu_def->xlevel = eax; host_cpuid(0x80000001, 0, &eax, &ebx, &ecx, &edx); x86_cpu_def->ext2_features = edx; x86_cpu_def->ext3_features = ecx; cpu_x86_fill_model_id(x86_cpu_def->model_id); x86_cpu_def->vendor_override = 0; /* Call Centaur's CPUID instruction. */ if (x86_cpu_def->vendor1 == CPUID_VENDOR_VIA_1 && x86_cpu_def->vendor2 == CPUID_VENDOR_VIA_2 && x86_cpu_def->vendor3 == CPUID_VENDOR_VIA_3) { host_cpuid(0xC0000000, 0, &eax, &ebx, &ecx, &edx); if (eax >= 0xC0000001) { /* Support VIA max extended level */ x86_cpu_def->xlevel2 = eax; host_cpuid(0xC0000001, 0, &eax, &ebx, &ecx, &edx); x86_cpu_def->ext4_features = edx; } } /* * Every SVM feature requires emulation support in KVM - so we can't just * read the host features here. KVM might even support SVM features not * available on the host hardware. Just set all bits and mask out the * unsupported ones later. */ x86_cpu_def->svm_features = -1; }
false
qemu
12869995ea4f436ab76af5059fd2e9ae83c6cf9d
static void kvm_cpu_fill_host(x86_def_t *x86_cpu_def) { uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; assert(kvm_enabled()); x86_cpu_def->name = "host"; host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx); x86_cpu_def->level = eax; x86_cpu_def->vendor1 = ebx; x86_cpu_def->vendor2 = edx; x86_cpu_def->vendor3 = ecx; host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx); x86_cpu_def->family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF); x86_cpu_def->model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12); x86_cpu_def->stepping = eax & 0x0F; x86_cpu_def->ext_features = ecx; x86_cpu_def->features = edx; if (x86_cpu_def->level >= 7) { x86_cpu_def->cpuid_7_0_ebx_features = kvm_arch_get_supported_cpuid(kvm_state, 0x7, 0, R_EBX); } else { x86_cpu_def->cpuid_7_0_ebx_features = 0; } host_cpuid(0x80000000, 0, &eax, &ebx, &ecx, &edx); x86_cpu_def->xlevel = eax; host_cpuid(0x80000001, 0, &eax, &ebx, &ecx, &edx); x86_cpu_def->ext2_features = edx; x86_cpu_def->ext3_features = ecx; cpu_x86_fill_model_id(x86_cpu_def->model_id); x86_cpu_def->vendor_override = 0; if (x86_cpu_def->vendor1 == CPUID_VENDOR_VIA_1 && x86_cpu_def->vendor2 == CPUID_VENDOR_VIA_2 && x86_cpu_def->vendor3 == CPUID_VENDOR_VIA_3) { host_cpuid(0xC0000000, 0, &eax, &ebx, &ecx, &edx); if (eax >= 0xC0000001) { x86_cpu_def->xlevel2 = eax; host_cpuid(0xC0000001, 0, &eax, &ebx, &ecx, &edx); x86_cpu_def->ext4_features = edx; } } x86_cpu_def->svm_features = -1; }
{ "code": [], "line_no": [] }
static void FUNC_0(x86_def_t *VAR_0) { uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0; assert(kvm_enabled()); VAR_0->name = "host"; host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx); VAR_0->level = eax; VAR_0->vendor1 = ebx; VAR_0->vendor2 = edx; VAR_0->vendor3 = ecx; host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx); VAR_0->family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF); VAR_0->model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12); VAR_0->stepping = eax & 0x0F; VAR_0->ext_features = ecx; VAR_0->features = edx; if (VAR_0->level >= 7) { VAR_0->cpuid_7_0_ebx_features = kvm_arch_get_supported_cpuid(kvm_state, 0x7, 0, R_EBX); } else { VAR_0->cpuid_7_0_ebx_features = 0; } host_cpuid(0x80000000, 0, &eax, &ebx, &ecx, &edx); VAR_0->xlevel = eax; host_cpuid(0x80000001, 0, &eax, &ebx, &ecx, &edx); VAR_0->ext2_features = edx; VAR_0->ext3_features = ecx; cpu_x86_fill_model_id(VAR_0->model_id); VAR_0->vendor_override = 0; if (VAR_0->vendor1 == CPUID_VENDOR_VIA_1 && VAR_0->vendor2 == CPUID_VENDOR_VIA_2 && VAR_0->vendor3 == CPUID_VENDOR_VIA_3) { host_cpuid(0xC0000000, 0, &eax, &ebx, &ecx, &edx); if (eax >= 0xC0000001) { VAR_0->xlevel2 = eax; host_cpuid(0xC0000001, 0, &eax, &ebx, &ecx, &edx); VAR_0->ext4_features = edx; } } VAR_0->svm_features = -1; }
[ "static void FUNC_0(x86_def_t *VAR_0)\n{", "uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;", "assert(kvm_enabled());", "VAR_0->name = \"host\";", "host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx);", "VAR_0->level = eax;", "VAR_0->vendor1 = ebx;", "VAR_0->vendor2 = edx;", "VAR_0->vendor3 = ecx;", "host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx);", "VAR_0->family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF);", "VAR_0->model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12);", "VAR_0->stepping = eax & 0x0F;", "VAR_0->ext_features = ecx;", "VAR_0->features = edx;", "if (VAR_0->level >= 7) {", "VAR_0->cpuid_7_0_ebx_features = kvm_arch_get_supported_cpuid(kvm_state, 0x7, 0, R_EBX);", "} else {", "VAR_0->cpuid_7_0_ebx_features = 0;", "}", "host_cpuid(0x80000000, 0, &eax, &ebx, &ecx, &edx);", "VAR_0->xlevel = eax;", "host_cpuid(0x80000001, 0, &eax, &ebx, &ecx, &edx);", "VAR_0->ext2_features = edx;", "VAR_0->ext3_features = ecx;", "cpu_x86_fill_model_id(VAR_0->model_id);", "VAR_0->vendor_override = 0;", "if (VAR_0->vendor1 == CPUID_VENDOR_VIA_1 &&\nVAR_0->vendor2 == CPUID_VENDOR_VIA_2 &&\nVAR_0->vendor3 == CPUID_VENDOR_VIA_3) {", "host_cpuid(0xC0000000, 0, &eax, &ebx, &ecx, &edx);", "if (eax >= 0xC0000001) {", "VAR_0->xlevel2 = eax;", "host_cpuid(0xC0000001, 0, &eax, &ebx, &ecx, &edx);", "VAR_0->ext4_features = edx;", "}", "}", "VAR_0->svm_features = -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 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 73, 75, 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 109 ], [ 111 ] ]
8,260
static uint32_t scsi_init_iovec(SCSIDiskReq *r, size_t size) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); if (!r->iov.iov_base) { r->buflen = size; r->iov.iov_base = qemu_blockalign(s->qdev.conf.bs, r->buflen); } r->iov.iov_len = MIN(r->sector_count * 512, r->buflen); qemu_iovec_init_external(&r->qiov, &r->iov, 1); return r->qiov.size / 512; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static uint32_t scsi_init_iovec(SCSIDiskReq *r, size_t size) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); if (!r->iov.iov_base) { r->buflen = size; r->iov.iov_base = qemu_blockalign(s->qdev.conf.bs, r->buflen); } r->iov.iov_len = MIN(r->sector_count * 512, r->buflen); qemu_iovec_init_external(&r->qiov, &r->iov, 1); return r->qiov.size / 512; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(SCSIDiskReq *r, size_t size) { SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); if (!r->iov.iov_base) { r->buflen = size; r->iov.iov_base = qemu_blockalign(s->qdev.conf.bs, r->buflen); } r->iov.iov_len = MIN(r->sector_count * 512, r->buflen); qemu_iovec_init_external(&r->qiov, &r->iov, 1); return r->qiov.size / 512; }
[ "static uint32_t FUNC_0(SCSIDiskReq *r, size_t size)\n{", "SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev);", "if (!r->iov.iov_base) {", "r->buflen = size;", "r->iov.iov_base = qemu_blockalign(s->qdev.conf.bs, r->buflen);", "}", "r->iov.iov_len = MIN(r->sector_count * 512, r->buflen);", "qemu_iovec_init_external(&r->qiov, &r->iov, 1);", "return r->qiov.size / 512;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
8,261
static void hax_process_section(MemoryRegionSection *section, uint8_t flags) { MemoryRegion *mr = section->mr; hwaddr start_pa = section->offset_within_address_space; ram_addr_t size = int128_get64(section->size); unsigned int delta; uint64_t host_va; /* We only care about RAM and ROM regions */ if (!memory_region_is_ram(mr)) { if (memory_region_is_romd(mr)) { /* HAXM kernel module does not support ROMD yet */ fprintf(stderr, "%s: Warning: Ignoring ROMD region 0x%016" PRIx64 "->0x%016" PRIx64 "\n", __func__, start_pa, start_pa + size); } return; } /* Adjust start_pa and size so that they are page-aligned. (Cf * kvm_set_phys_mem() in kvm-all.c). */ delta = qemu_real_host_page_size - (start_pa & ~qemu_real_host_page_mask); delta &= ~qemu_real_host_page_mask; if (delta > size) { return; } start_pa += delta; size -= delta; size &= qemu_real_host_page_mask; if (!size || (start_pa & ~qemu_real_host_page_mask)) { return; } host_va = (uintptr_t)memory_region_get_ram_ptr(mr) + section->offset_within_region + delta; if (memory_region_is_rom(section->mr)) { flags |= HAX_RAM_INFO_ROM; } /* the kernel module interface uses 32-bit sizes (but we could split...) */ g_assert(size <= UINT32_MAX); hax_update_mapping(start_pa, size, host_va, flags); }
false
qemu
8297be80f7cf71e09617669a8bd8b2836dcfd4c3
static void hax_process_section(MemoryRegionSection *section, uint8_t flags) { MemoryRegion *mr = section->mr; hwaddr start_pa = section->offset_within_address_space; ram_addr_t size = int128_get64(section->size); unsigned int delta; uint64_t host_va; if (!memory_region_is_ram(mr)) { if (memory_region_is_romd(mr)) { fprintf(stderr, "%s: Warning: Ignoring ROMD region 0x%016" PRIx64 "->0x%016" PRIx64 "\n", __func__, start_pa, start_pa + size); } return; } delta = qemu_real_host_page_size - (start_pa & ~qemu_real_host_page_mask); delta &= ~qemu_real_host_page_mask; if (delta > size) { return; } start_pa += delta; size -= delta; size &= qemu_real_host_page_mask; if (!size || (start_pa & ~qemu_real_host_page_mask)) { return; } host_va = (uintptr_t)memory_region_get_ram_ptr(mr) + section->offset_within_region + delta; if (memory_region_is_rom(section->mr)) { flags |= HAX_RAM_INFO_ROM; } g_assert(size <= UINT32_MAX); hax_update_mapping(start_pa, size, host_va, flags); }
{ "code": [], "line_no": [] }
static void FUNC_0(MemoryRegionSection *VAR_0, uint8_t VAR_1) { MemoryRegion *mr = VAR_0->mr; hwaddr start_pa = VAR_0->offset_within_address_space; ram_addr_t size = int128_get64(VAR_0->size); unsigned int VAR_2; uint64_t host_va; if (!memory_region_is_ram(mr)) { if (memory_region_is_romd(mr)) { fprintf(stderr, "%s: Warning: Ignoring ROMD region 0x%016" PRIx64 "->0x%016" PRIx64 "\n", __func__, start_pa, start_pa + size); } return; } VAR_2 = qemu_real_host_page_size - (start_pa & ~qemu_real_host_page_mask); VAR_2 &= ~qemu_real_host_page_mask; if (VAR_2 > size) { return; } start_pa += VAR_2; size -= VAR_2; size &= qemu_real_host_page_mask; if (!size || (start_pa & ~qemu_real_host_page_mask)) { return; } host_va = (uintptr_t)memory_region_get_ram_ptr(mr) + VAR_0->offset_within_region + VAR_2; if (memory_region_is_rom(VAR_0->mr)) { VAR_1 |= HAX_RAM_INFO_ROM; } g_assert(size <= UINT32_MAX); hax_update_mapping(start_pa, size, host_va, VAR_1); }
[ "static void FUNC_0(MemoryRegionSection *VAR_0, uint8_t VAR_1)\n{", "MemoryRegion *mr = VAR_0->mr;", "hwaddr start_pa = VAR_0->offset_within_address_space;", "ram_addr_t size = int128_get64(VAR_0->size);", "unsigned int VAR_2;", "uint64_t host_va;", "if (!memory_region_is_ram(mr)) {", "if (memory_region_is_romd(mr)) {", "fprintf(stderr, \"%s: Warning: Ignoring ROMD region 0x%016\" PRIx64\n\"->0x%016\" PRIx64 \"\\n\", __func__, start_pa,\nstart_pa + size);", "}", "return;", "}", "VAR_2 = qemu_real_host_page_size - (start_pa & ~qemu_real_host_page_mask);", "VAR_2 &= ~qemu_real_host_page_mask;", "if (VAR_2 > size) {", "return;", "}", "start_pa += VAR_2;", "size -= VAR_2;", "size &= qemu_real_host_page_mask;", "if (!size || (start_pa & ~qemu_real_host_page_mask)) {", "return;", "}", "host_va = (uintptr_t)memory_region_get_ram_ptr(mr)\n+ VAR_0->offset_within_region + VAR_2;", "if (memory_region_is_rom(VAR_0->mr)) {", "VAR_1 |= HAX_RAM_INFO_ROM;", "}", "g_assert(size <= UINT32_MAX);", "hax_update_mapping(start_pa, size, host_va, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 19 ], [ 21 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 83 ], [ 87 ], [ 89 ] ]
8,263
void avcodec_get_context_defaults(AVCodecContext *s){ memset(s, 0, sizeof(AVCodecContext)); s->av_class= &av_codec_context_class; s->bit_rate= 800*1000; s->bit_rate_tolerance= s->bit_rate*10; s->qmin= 2; s->qmax= 31; s->mb_qmin= 2; s->mb_qmax= 31; s->rc_eq= "tex^qComp"; s->qcompress= 0.5; s->max_qdiff= 3; s->b_quant_factor=1.25; s->b_quant_offset=1.25; s->i_quant_factor=-0.8; s->i_quant_offset=0.0; s->error_concealment= 3; s->error_resilience= 1; s->workaround_bugs= FF_BUG_AUTODETECT; s->frame_rate_base= 1; s->frame_rate = 25; s->gop_size= 50; s->me_method= ME_EPZS; s->get_buffer= avcodec_default_get_buffer; s->release_buffer= avcodec_default_release_buffer; s->get_format= avcodec_default_get_format; s->execute= avcodec_default_execute; s->thread_count=1; s->me_subpel_quality=8; s->lmin= FF_QP2LAMBDA * s->qmin; s->lmax= FF_QP2LAMBDA * s->qmax; s->sample_aspect_ratio= (AVRational){0,1}; s->ildct_cmp= FF_CMP_VSAD; s->profile= FF_PROFILE_UNKNOWN; s->level= FF_LEVEL_UNKNOWN; s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS; s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS; s->palctrl = NULL; s->reget_buffer= avcodec_default_reget_buffer; }
false
FFmpeg
6e0d8c06c7af61859e8d7bc2351a607d8abeab75
void avcodec_get_context_defaults(AVCodecContext *s){ memset(s, 0, sizeof(AVCodecContext)); s->av_class= &av_codec_context_class; s->bit_rate= 800*1000; s->bit_rate_tolerance= s->bit_rate*10; s->qmin= 2; s->qmax= 31; s->mb_qmin= 2; s->mb_qmax= 31; s->rc_eq= "tex^qComp"; s->qcompress= 0.5; s->max_qdiff= 3; s->b_quant_factor=1.25; s->b_quant_offset=1.25; s->i_quant_factor=-0.8; s->i_quant_offset=0.0; s->error_concealment= 3; s->error_resilience= 1; s->workaround_bugs= FF_BUG_AUTODETECT; s->frame_rate_base= 1; s->frame_rate = 25; s->gop_size= 50; s->me_method= ME_EPZS; s->get_buffer= avcodec_default_get_buffer; s->release_buffer= avcodec_default_release_buffer; s->get_format= avcodec_default_get_format; s->execute= avcodec_default_execute; s->thread_count=1; s->me_subpel_quality=8; s->lmin= FF_QP2LAMBDA * s->qmin; s->lmax= FF_QP2LAMBDA * s->qmax; s->sample_aspect_ratio= (AVRational){0,1}; s->ildct_cmp= FF_CMP_VSAD; s->profile= FF_PROFILE_UNKNOWN; s->level= FF_LEVEL_UNKNOWN; s->intra_quant_bias= FF_DEFAULT_QUANT_BIAS; s->inter_quant_bias= FF_DEFAULT_QUANT_BIAS; s->palctrl = NULL; s->reget_buffer= avcodec_default_reget_buffer; }
{ "code": [], "line_no": [] }
void FUNC_0(AVCodecContext *VAR_0){ memset(VAR_0, 0, sizeof(AVCodecContext)); VAR_0->av_class= &av_codec_context_class; VAR_0->bit_rate= 800*1000; VAR_0->bit_rate_tolerance= VAR_0->bit_rate*10; VAR_0->qmin= 2; VAR_0->qmax= 31; VAR_0->mb_qmin= 2; VAR_0->mb_qmax= 31; VAR_0->rc_eq= "tex^qComp"; VAR_0->qcompress= 0.5; VAR_0->max_qdiff= 3; VAR_0->b_quant_factor=1.25; VAR_0->b_quant_offset=1.25; VAR_0->i_quant_factor=-0.8; VAR_0->i_quant_offset=0.0; VAR_0->error_concealment= 3; VAR_0->error_resilience= 1; VAR_0->workaround_bugs= FF_BUG_AUTODETECT; VAR_0->frame_rate_base= 1; VAR_0->frame_rate = 25; VAR_0->gop_size= 50; VAR_0->me_method= ME_EPZS; VAR_0->get_buffer= avcodec_default_get_buffer; VAR_0->release_buffer= avcodec_default_release_buffer; VAR_0->get_format= avcodec_default_get_format; VAR_0->execute= avcodec_default_execute; VAR_0->thread_count=1; VAR_0->me_subpel_quality=8; VAR_0->lmin= FF_QP2LAMBDA * VAR_0->qmin; VAR_0->lmax= FF_QP2LAMBDA * VAR_0->qmax; VAR_0->sample_aspect_ratio= (AVRational){0,1}; VAR_0->ildct_cmp= FF_CMP_VSAD; VAR_0->profile= FF_PROFILE_UNKNOWN; VAR_0->level= FF_LEVEL_UNKNOWN; VAR_0->intra_quant_bias= FF_DEFAULT_QUANT_BIAS; VAR_0->inter_quant_bias= FF_DEFAULT_QUANT_BIAS; VAR_0->palctrl = NULL; VAR_0->reget_buffer= avcodec_default_reget_buffer; }
[ "void FUNC_0(AVCodecContext *VAR_0){", "memset(VAR_0, 0, sizeof(AVCodecContext));", "VAR_0->av_class= &av_codec_context_class;", "VAR_0->bit_rate= 800*1000;", "VAR_0->bit_rate_tolerance= VAR_0->bit_rate*10;", "VAR_0->qmin= 2;", "VAR_0->qmax= 31;", "VAR_0->mb_qmin= 2;", "VAR_0->mb_qmax= 31;", "VAR_0->rc_eq= \"tex^qComp\";", "VAR_0->qcompress= 0.5;", "VAR_0->max_qdiff= 3;", "VAR_0->b_quant_factor=1.25;", "VAR_0->b_quant_offset=1.25;", "VAR_0->i_quant_factor=-0.8;", "VAR_0->i_quant_offset=0.0;", "VAR_0->error_concealment= 3;", "VAR_0->error_resilience= 1;", "VAR_0->workaround_bugs= FF_BUG_AUTODETECT;", "VAR_0->frame_rate_base= 1;", "VAR_0->frame_rate = 25;", "VAR_0->gop_size= 50;", "VAR_0->me_method= ME_EPZS;", "VAR_0->get_buffer= avcodec_default_get_buffer;", "VAR_0->release_buffer= avcodec_default_release_buffer;", "VAR_0->get_format= avcodec_default_get_format;", "VAR_0->execute= avcodec_default_execute;", "VAR_0->thread_count=1;", "VAR_0->me_subpel_quality=8;", "VAR_0->lmin= FF_QP2LAMBDA * VAR_0->qmin;", "VAR_0->lmax= FF_QP2LAMBDA * VAR_0->qmax;", "VAR_0->sample_aspect_ratio= (AVRational){0,1};", "VAR_0->ildct_cmp= FF_CMP_VSAD;", "VAR_0->profile= FF_PROFILE_UNKNOWN;", "VAR_0->level= FF_LEVEL_UNKNOWN;", "VAR_0->intra_quant_bias= FF_DEFAULT_QUANT_BIAS;", "VAR_0->inter_quant_bias= FF_DEFAULT_QUANT_BIAS;", "VAR_0->palctrl = NULL;", "VAR_0->reget_buffer= avcodec_default_reget_buffer;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 7 ], [ 9 ], [ 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 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ] ]
8,264
static void gen_sraiq(DisasContext *ctx) { int sh = SH(ctx->opcode); int l1 = gen_new_label(); TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); tcg_gen_shri_tl(t0, cpu_gpr[rS(ctx->opcode)], sh); tcg_gen_shli_tl(t1, cpu_gpr[rS(ctx->opcode)], 32 - sh); tcg_gen_or_tl(t0, t0, t1); gen_store_spr(SPR_MQ, t0); tcg_gen_movi_tl(cpu_ca, 0); tcg_gen_brcondi_tl(TCG_COND_EQ, t1, 0, l1); tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rS(ctx->opcode)], 0, l1); tcg_gen_movi_tl(cpu_ca, 1); gen_set_label(l1); tcg_gen_sari_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], sh); tcg_temp_free(t0); tcg_temp_free(t1); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); }
false
qemu
42a268c241183877192c376d03bd9b6d527407c7
static void gen_sraiq(DisasContext *ctx) { int sh = SH(ctx->opcode); int l1 = gen_new_label(); TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); tcg_gen_shri_tl(t0, cpu_gpr[rS(ctx->opcode)], sh); tcg_gen_shli_tl(t1, cpu_gpr[rS(ctx->opcode)], 32 - sh); tcg_gen_or_tl(t0, t0, t1); gen_store_spr(SPR_MQ, t0); tcg_gen_movi_tl(cpu_ca, 0); tcg_gen_brcondi_tl(TCG_COND_EQ, t1, 0, l1); tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rS(ctx->opcode)], 0, l1); tcg_gen_movi_tl(cpu_ca, 1); gen_set_label(l1); tcg_gen_sari_tl(cpu_gpr[rA(ctx->opcode)], cpu_gpr[rS(ctx->opcode)], sh); tcg_temp_free(t0); tcg_temp_free(t1); if (unlikely(Rc(ctx->opcode) != 0)) gen_set_Rc0(ctx, cpu_gpr[rA(ctx->opcode)]); }
{ "code": [], "line_no": [] }
static void FUNC_0(DisasContext *VAR_0) { int VAR_1 = SH(VAR_0->opcode); int VAR_2 = gen_new_label(); TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); tcg_gen_shri_tl(t0, cpu_gpr[rS(VAR_0->opcode)], VAR_1); tcg_gen_shli_tl(t1, cpu_gpr[rS(VAR_0->opcode)], 32 - VAR_1); tcg_gen_or_tl(t0, t0, t1); gen_store_spr(SPR_MQ, t0); tcg_gen_movi_tl(cpu_ca, 0); tcg_gen_brcondi_tl(TCG_COND_EQ, t1, 0, VAR_2); tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rS(VAR_0->opcode)], 0, VAR_2); tcg_gen_movi_tl(cpu_ca, 1); gen_set_label(VAR_2); tcg_gen_sari_tl(cpu_gpr[rA(VAR_0->opcode)], cpu_gpr[rS(VAR_0->opcode)], VAR_1); tcg_temp_free(t0); tcg_temp_free(t1); if (unlikely(Rc(VAR_0->opcode) != 0)) gen_set_Rc0(VAR_0, cpu_gpr[rA(VAR_0->opcode)]); }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "int VAR_1 = SH(VAR_0->opcode);", "int VAR_2 = gen_new_label();", "TCGv t0 = tcg_temp_new();", "TCGv t1 = tcg_temp_new();", "tcg_gen_shri_tl(t0, cpu_gpr[rS(VAR_0->opcode)], VAR_1);", "tcg_gen_shli_tl(t1, cpu_gpr[rS(VAR_0->opcode)], 32 - VAR_1);", "tcg_gen_or_tl(t0, t0, t1);", "gen_store_spr(SPR_MQ, t0);", "tcg_gen_movi_tl(cpu_ca, 0);", "tcg_gen_brcondi_tl(TCG_COND_EQ, t1, 0, VAR_2);", "tcg_gen_brcondi_tl(TCG_COND_GE, cpu_gpr[rS(VAR_0->opcode)], 0, VAR_2);", "tcg_gen_movi_tl(cpu_ca, 1);", "gen_set_label(VAR_2);", "tcg_gen_sari_tl(cpu_gpr[rA(VAR_0->opcode)], cpu_gpr[rS(VAR_0->opcode)], VAR_1);", "tcg_temp_free(t0);", "tcg_temp_free(t1);", "if (unlikely(Rc(VAR_0->opcode) != 0))\ngen_set_Rc0(VAR_0, cpu_gpr[rA(VAR_0->opcode)]);", "}" ]
[ 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 ] ]
8,265
static const mon_cmd_t *monitor_parse_command(Monitor *mon, const char *cmdline, int start, mon_cmd_t *table, QDict *qdict) { const char *p, *typestr; int c; const mon_cmd_t *cmd; char cmdname[256]; char buf[1024]; char *key; /* extract the command name */ p = get_command_name(cmdline + start, cmdname, sizeof(cmdname)); if (!p) return NULL; cmd = search_dispatch_table(table, cmdname); if (!cmd) { monitor_printf(mon, "unknown command: '%.*s'\n", (int)(p - cmdline), cmdline); return NULL; } /* filter out following useless space */ while (qemu_isspace(*p)) { p++; } /* search sub command */ if (cmd->sub_table != NULL) { /* check if user set additional command */ if (*p == '\0') { return cmd; } return monitor_parse_command(mon, cmdline, p - cmdline, cmd->sub_table, qdict); } /* parse the parameters */ typestr = cmd->args_type; for(;;) { typestr = key_get_info(typestr, &key); if (!typestr) break; c = *typestr; typestr++; switch(c) { case 'F': case 'B': case 's': { int ret; while (qemu_isspace(*p)) p++; if (*typestr == '?') { typestr++; if (*p == '\0') { /* no optional string: NULL argument */ break; } } ret = get_str(buf, sizeof(buf), &p); if (ret < 0) { switch(c) { case 'F': monitor_printf(mon, "%s: filename expected\n", cmdname); break; case 'B': monitor_printf(mon, "%s: block device name expected\n", cmdname); break; default: monitor_printf(mon, "%s: string expected\n", cmdname); break; } goto fail; } qdict_put(qdict, key, qstring_from_str(buf)); } break; case 'O': { QemuOptsList *opts_list; QemuOpts *opts; opts_list = qemu_find_opts(key); if (!opts_list || opts_list->desc->name) { goto bad_type; } while (qemu_isspace(*p)) { p++; } if (!*p) break; if (get_str(buf, sizeof(buf), &p) < 0) { goto fail; } opts = qemu_opts_parse(opts_list, buf, 1); if (!opts) { goto fail; } qemu_opts_to_qdict(opts, qdict); qemu_opts_del(opts); } break; case '/': { int count, format, size; while (qemu_isspace(*p)) p++; if (*p == '/') { /* format found */ p++; count = 1; if (qemu_isdigit(*p)) { count = 0; while (qemu_isdigit(*p)) { count = count * 10 + (*p - '0'); p++; } } size = -1; format = -1; for(;;) { switch(*p) { case 'o': case 'd': case 'u': case 'x': case 'i': case 'c': format = *p++; break; case 'b': size = 1; p++; break; case 'h': size = 2; p++; break; case 'w': size = 4; p++; break; case 'g': case 'L': size = 8; p++; break; default: goto next; } } next: if (*p != '\0' && !qemu_isspace(*p)) { monitor_printf(mon, "invalid char in format: '%c'\n", *p); goto fail; } if (format < 0) format = default_fmt_format; if (format != 'i') { /* for 'i', not specifying a size gives -1 as size */ if (size < 0) size = default_fmt_size; default_fmt_size = size; } default_fmt_format = format; } else { count = 1; format = default_fmt_format; if (format != 'i') { size = default_fmt_size; } else { size = -1; } } qdict_put(qdict, "count", qint_from_int(count)); qdict_put(qdict, "format", qint_from_int(format)); qdict_put(qdict, "size", qint_from_int(size)); } break; case 'i': case 'l': case 'M': { int64_t val; while (qemu_isspace(*p)) p++; if (*typestr == '?' || *typestr == '.') { if (*typestr == '?') { if (*p == '\0') { typestr++; break; } } else { if (*p == '.') { p++; while (qemu_isspace(*p)) p++; } else { typestr++; break; } } typestr++; } if (get_expr(mon, &val, &p)) goto fail; /* Check if 'i' is greater than 32-bit */ if ((c == 'i') && ((val >> 32) & 0xffffffff)) { monitor_printf(mon, "\'%s\' has failed: ", cmdname); monitor_printf(mon, "integer is for 32-bit values\n"); goto fail; } else if (c == 'M') { if (val < 0) { monitor_printf(mon, "enter a positive value\n"); goto fail; } val <<= 20; } qdict_put(qdict, key, qint_from_int(val)); } break; case 'o': { int64_t val; char *end; while (qemu_isspace(*p)) { p++; } if (*typestr == '?') { typestr++; if (*p == '\0') { break; } } val = strtosz(p, &end); if (val < 0) { monitor_printf(mon, "invalid size\n"); goto fail; } qdict_put(qdict, key, qint_from_int(val)); p = end; } break; case 'T': { double val; while (qemu_isspace(*p)) p++; if (*typestr == '?') { typestr++; if (*p == '\0') { break; } } if (get_double(mon, &val, &p) < 0) { goto fail; } if (p[0] && p[1] == 's') { switch (*p) { case 'm': val /= 1e3; p += 2; break; case 'u': val /= 1e6; p += 2; break; case 'n': val /= 1e9; p += 2; break; } } if (*p && !qemu_isspace(*p)) { monitor_printf(mon, "Unknown unit suffix\n"); goto fail; } qdict_put(qdict, key, qfloat_from_double(val)); } break; case 'b': { const char *beg; bool val; while (qemu_isspace(*p)) { p++; } beg = p; while (qemu_isgraph(*p)) { p++; } if (p - beg == 2 && !memcmp(beg, "on", p - beg)) { val = true; } else if (p - beg == 3 && !memcmp(beg, "off", p - beg)) { val = false; } else { monitor_printf(mon, "Expected 'on' or 'off'\n"); goto fail; } qdict_put(qdict, key, qbool_from_bool(val)); } break; case '-': { const char *tmp = p; int skip_key = 0; /* option */ c = *typestr++; if (c == '\0') goto bad_type; while (qemu_isspace(*p)) p++; if (*p == '-') { p++; if(c != *p) { if(!is_valid_option(p, typestr)) { monitor_printf(mon, "%s: unsupported option -%c\n", cmdname, *p); goto fail; } else { skip_key = 1; } } if(skip_key) { p = tmp; } else { /* has option */ p++; qdict_put(qdict, key, qbool_from_bool(true)); } } } break; case 'S': { /* package all remaining string */ int len; while (qemu_isspace(*p)) { p++; } if (*typestr == '?') { typestr++; if (*p == '\0') { /* no remaining string: NULL argument */ break; } } len = strlen(p); if (len <= 0) { monitor_printf(mon, "%s: string expected\n", cmdname); break; } qdict_put(qdict, key, qstring_from_str(p)); p += len; } break; default: bad_type: monitor_printf(mon, "%s: unknown type '%c'\n", cmdname, c); goto fail; } g_free(key); key = NULL; } /* check that all arguments were parsed */ while (qemu_isspace(*p)) p++; if (*p != '\0') { monitor_printf(mon, "%s: extraneous characters at the end of line\n", cmdname); goto fail; } return cmd; fail: g_free(key); return NULL; }
false
qemu
ae50212ff717f3d295ebff352eb7d6cc08332b7e
static const mon_cmd_t *monitor_parse_command(Monitor *mon, const char *cmdline, int start, mon_cmd_t *table, QDict *qdict) { const char *p, *typestr; int c; const mon_cmd_t *cmd; char cmdname[256]; char buf[1024]; char *key; p = get_command_name(cmdline + start, cmdname, sizeof(cmdname)); if (!p) return NULL; cmd = search_dispatch_table(table, cmdname); if (!cmd) { monitor_printf(mon, "unknown command: '%.*s'\n", (int)(p - cmdline), cmdline); return NULL; } while (qemu_isspace(*p)) { p++; } if (cmd->sub_table != NULL) { if (*p == '\0') { return cmd; } return monitor_parse_command(mon, cmdline, p - cmdline, cmd->sub_table, qdict); } typestr = cmd->args_type; for(;;) { typestr = key_get_info(typestr, &key); if (!typestr) break; c = *typestr; typestr++; switch(c) { case 'F': case 'B': case 's': { int ret; while (qemu_isspace(*p)) p++; if (*typestr == '?') { typestr++; if (*p == '\0') { break; } } ret = get_str(buf, sizeof(buf), &p); if (ret < 0) { switch(c) { case 'F': monitor_printf(mon, "%s: filename expected\n", cmdname); break; case 'B': monitor_printf(mon, "%s: block device name expected\n", cmdname); break; default: monitor_printf(mon, "%s: string expected\n", cmdname); break; } goto fail; } qdict_put(qdict, key, qstring_from_str(buf)); } break; case 'O': { QemuOptsList *opts_list; QemuOpts *opts; opts_list = qemu_find_opts(key); if (!opts_list || opts_list->desc->name) { goto bad_type; } while (qemu_isspace(*p)) { p++; } if (!*p) break; if (get_str(buf, sizeof(buf), &p) < 0) { goto fail; } opts = qemu_opts_parse(opts_list, buf, 1); if (!opts) { goto fail; } qemu_opts_to_qdict(opts, qdict); qemu_opts_del(opts); } break; case '/': { int count, format, size; while (qemu_isspace(*p)) p++; if (*p == '/') { p++; count = 1; if (qemu_isdigit(*p)) { count = 0; while (qemu_isdigit(*p)) { count = count * 10 + (*p - '0'); p++; } } size = -1; format = -1; for(;;) { switch(*p) { case 'o': case 'd': case 'u': case 'x': case 'i': case 'c': format = *p++; break; case 'b': size = 1; p++; break; case 'h': size = 2; p++; break; case 'w': size = 4; p++; break; case 'g': case 'L': size = 8; p++; break; default: goto next; } } next: if (*p != '\0' && !qemu_isspace(*p)) { monitor_printf(mon, "invalid char in format: '%c'\n", *p); goto fail; } if (format < 0) format = default_fmt_format; if (format != 'i') { if (size < 0) size = default_fmt_size; default_fmt_size = size; } default_fmt_format = format; } else { count = 1; format = default_fmt_format; if (format != 'i') { size = default_fmt_size; } else { size = -1; } } qdict_put(qdict, "count", qint_from_int(count)); qdict_put(qdict, "format", qint_from_int(format)); qdict_put(qdict, "size", qint_from_int(size)); } break; case 'i': case 'l': case 'M': { int64_t val; while (qemu_isspace(*p)) p++; if (*typestr == '?' || *typestr == '.') { if (*typestr == '?') { if (*p == '\0') { typestr++; break; } } else { if (*p == '.') { p++; while (qemu_isspace(*p)) p++; } else { typestr++; break; } } typestr++; } if (get_expr(mon, &val, &p)) goto fail; if ((c == 'i') && ((val >> 32) & 0xffffffff)) { monitor_printf(mon, "\'%s\' has failed: ", cmdname); monitor_printf(mon, "integer is for 32-bit values\n"); goto fail; } else if (c == 'M') { if (val < 0) { monitor_printf(mon, "enter a positive value\n"); goto fail; } val <<= 20; } qdict_put(qdict, key, qint_from_int(val)); } break; case 'o': { int64_t val; char *end; while (qemu_isspace(*p)) { p++; } if (*typestr == '?') { typestr++; if (*p == '\0') { break; } } val = strtosz(p, &end); if (val < 0) { monitor_printf(mon, "invalid size\n"); goto fail; } qdict_put(qdict, key, qint_from_int(val)); p = end; } break; case 'T': { double val; while (qemu_isspace(*p)) p++; if (*typestr == '?') { typestr++; if (*p == '\0') { break; } } if (get_double(mon, &val, &p) < 0) { goto fail; } if (p[0] && p[1] == 's') { switch (*p) { case 'm': val /= 1e3; p += 2; break; case 'u': val /= 1e6; p += 2; break; case 'n': val /= 1e9; p += 2; break; } } if (*p && !qemu_isspace(*p)) { monitor_printf(mon, "Unknown unit suffix\n"); goto fail; } qdict_put(qdict, key, qfloat_from_double(val)); } break; case 'b': { const char *beg; bool val; while (qemu_isspace(*p)) { p++; } beg = p; while (qemu_isgraph(*p)) { p++; } if (p - beg == 2 && !memcmp(beg, "on", p - beg)) { val = true; } else if (p - beg == 3 && !memcmp(beg, "off", p - beg)) { val = false; } else { monitor_printf(mon, "Expected 'on' or 'off'\n"); goto fail; } qdict_put(qdict, key, qbool_from_bool(val)); } break; case '-': { const char *tmp = p; int skip_key = 0; c = *typestr++; if (c == '\0') goto bad_type; while (qemu_isspace(*p)) p++; if (*p == '-') { p++; if(c != *p) { if(!is_valid_option(p, typestr)) { monitor_printf(mon, "%s: unsupported option -%c\n", cmdname, *p); goto fail; } else { skip_key = 1; } } if(skip_key) { p = tmp; } else { p++; qdict_put(qdict, key, qbool_from_bool(true)); } } } break; case 'S': { int len; while (qemu_isspace(*p)) { p++; } if (*typestr == '?') { typestr++; if (*p == '\0') { break; } } len = strlen(p); if (len <= 0) { monitor_printf(mon, "%s: string expected\n", cmdname); break; } qdict_put(qdict, key, qstring_from_str(p)); p += len; } break; default: bad_type: monitor_printf(mon, "%s: unknown type '%c'\n", cmdname, c); goto fail; } g_free(key); key = NULL; } while (qemu_isspace(*p)) p++; if (*p != '\0') { monitor_printf(mon, "%s: extraneous characters at the end of line\n", cmdname); goto fail; } return cmd; fail: g_free(key); return NULL; }
{ "code": [], "line_no": [] }
static const mon_cmd_t *FUNC_0(Monitor *mon, const char *cmdline, int start, mon_cmd_t *table, QDict *qdict) { const char *VAR_0, *VAR_1; int VAR_2; const mon_cmd_t *VAR_3; char VAR_4[256]; char VAR_5[1024]; char *VAR_6; VAR_0 = get_command_name(cmdline + start, VAR_4, sizeof(VAR_4)); if (!VAR_0) return NULL; VAR_3 = search_dispatch_table(table, VAR_4); if (!VAR_3) { monitor_printf(mon, "unknown command: '%.*s'\n", (int)(VAR_0 - cmdline), cmdline); return NULL; } while (qemu_isspace(*VAR_0)) { VAR_0++; } if (VAR_3->sub_table != NULL) { if (*VAR_0 == '\0') { return VAR_3; } return FUNC_0(mon, cmdline, VAR_0 - cmdline, VAR_3->sub_table, qdict); } VAR_1 = VAR_3->args_type; for(;;) { VAR_1 = key_get_info(VAR_1, &VAR_6); if (!VAR_1) break; VAR_2 = *VAR_1; VAR_1++; switch(VAR_2) { case 'F': case 'B': case 's': { int VAR_7; while (qemu_isspace(*VAR_0)) VAR_0++; if (*VAR_1 == '?') { VAR_1++; if (*VAR_0 == '\0') { break; } } VAR_7 = get_str(VAR_5, sizeof(VAR_5), &VAR_0); if (VAR_7 < 0) { switch(VAR_2) { case 'F': monitor_printf(mon, "%s: filename expected\n", VAR_4); break; case 'B': monitor_printf(mon, "%s: block device name expected\n", VAR_4); break; default: monitor_printf(mon, "%s: string expected\n", VAR_4); break; } goto fail; } qdict_put(qdict, VAR_6, qstring_from_str(VAR_5)); } break; case 'O': { QemuOptsList *opts_list; QemuOpts *opts; opts_list = qemu_find_opts(VAR_6); if (!opts_list || opts_list->desc->name) { goto bad_type; } while (qemu_isspace(*VAR_0)) { VAR_0++; } if (!*VAR_0) break; if (get_str(VAR_5, sizeof(VAR_5), &VAR_0) < 0) { goto fail; } opts = qemu_opts_parse(opts_list, VAR_5, 1); if (!opts) { goto fail; } qemu_opts_to_qdict(opts, qdict); qemu_opts_del(opts); } break; case '/': { int VAR_8, VAR_9, VAR_10; while (qemu_isspace(*VAR_0)) VAR_0++; if (*VAR_0 == '/') { VAR_0++; VAR_8 = 1; if (qemu_isdigit(*VAR_0)) { VAR_8 = 0; while (qemu_isdigit(*VAR_0)) { VAR_8 = VAR_8 * 10 + (*VAR_0 - '0'); VAR_0++; } } VAR_10 = -1; VAR_9 = -1; for(;;) { switch(*VAR_0) { case 'o': case 'd': case 'u': case 'x': case 'i': case 'VAR_2': VAR_9 = *VAR_0++; break; case 'b': VAR_10 = 1; VAR_0++; break; case 'h': VAR_10 = 2; VAR_0++; break; case 'w': VAR_10 = 4; VAR_0++; break; case 'g': case 'L': VAR_10 = 8; VAR_0++; break; default: goto next; } } next: if (*VAR_0 != '\0' && !qemu_isspace(*VAR_0)) { monitor_printf(mon, "invalid char in VAR_9: '%VAR_2'\n", *VAR_0); goto fail; } if (VAR_9 < 0) VAR_9 = default_fmt_format; if (VAR_9 != 'i') { if (VAR_10 < 0) VAR_10 = default_fmt_size; default_fmt_size = VAR_10; } default_fmt_format = VAR_9; } else { VAR_8 = 1; VAR_9 = default_fmt_format; if (VAR_9 != 'i') { VAR_10 = default_fmt_size; } else { VAR_10 = -1; } } qdict_put(qdict, "VAR_8", qint_from_int(VAR_8)); qdict_put(qdict, "VAR_9", qint_from_int(VAR_9)); qdict_put(qdict, "VAR_10", qint_from_int(VAR_10)); } break; case 'i': case 'l': case 'M': { int64_t VAR_12; while (qemu_isspace(*VAR_0)) VAR_0++; if (*VAR_1 == '?' || *VAR_1 == '.') { if (*VAR_1 == '?') { if (*VAR_0 == '\0') { VAR_1++; break; } } else { if (*VAR_0 == '.') { VAR_0++; while (qemu_isspace(*VAR_0)) VAR_0++; } else { VAR_1++; break; } } VAR_1++; } if (get_expr(mon, &VAR_12, &VAR_0)) goto fail; if ((VAR_2 == 'i') && ((VAR_12 >> 32) & 0xffffffff)) { monitor_printf(mon, "\'%s\' has failed: ", VAR_4); monitor_printf(mon, "integer is for 32-bit values\n"); goto fail; } else if (VAR_2 == 'M') { if (VAR_12 < 0) { monitor_printf(mon, "enter a positive value\n"); goto fail; } VAR_12 <<= 20; } qdict_put(qdict, VAR_6, qint_from_int(VAR_12)); } break; case 'o': { int64_t VAR_12; char *VAR_11; while (qemu_isspace(*VAR_0)) { VAR_0++; } if (*VAR_1 == '?') { VAR_1++; if (*VAR_0 == '\0') { break; } } VAR_12 = strtosz(VAR_0, &VAR_11); if (VAR_12 < 0) { monitor_printf(mon, "invalid VAR_10\n"); goto fail; } qdict_put(qdict, VAR_6, qint_from_int(VAR_12)); VAR_0 = VAR_11; } break; case 'T': { double VAR_12; while (qemu_isspace(*VAR_0)) VAR_0++; if (*VAR_1 == '?') { VAR_1++; if (*VAR_0 == '\0') { break; } } if (get_double(mon, &VAR_12, &VAR_0) < 0) { goto fail; } if (VAR_0[0] && VAR_0[1] == 's') { switch (*VAR_0) { case 'm': VAR_12 /= 1e3; VAR_0 += 2; break; case 'u': VAR_12 /= 1e6; VAR_0 += 2; break; case 'n': VAR_12 /= 1e9; VAR_0 += 2; break; } } if (*VAR_0 && !qemu_isspace(*VAR_0)) { monitor_printf(mon, "Unknown unit suffix\n"); goto fail; } qdict_put(qdict, VAR_6, qfloat_from_double(VAR_12)); } break; case 'b': { const char *VAR_13; bool VAR_12; while (qemu_isspace(*VAR_0)) { VAR_0++; } VAR_13 = VAR_0; while (qemu_isgraph(*VAR_0)) { VAR_0++; } if (VAR_0 - VAR_13 == 2 && !memcmp(VAR_13, "on", VAR_0 - VAR_13)) { VAR_12 = true; } else if (VAR_0 - VAR_13 == 3 && !memcmp(VAR_13, "off", VAR_0 - VAR_13)) { VAR_12 = false; } else { monitor_printf(mon, "Expected 'on' or 'off'\n"); goto fail; } qdict_put(qdict, VAR_6, qbool_from_bool(VAR_12)); } break; case '-': { const char *VAR_14 = VAR_0; int VAR_15 = 0; VAR_2 = *VAR_1++; if (VAR_2 == '\0') goto bad_type; while (qemu_isspace(*VAR_0)) VAR_0++; if (*VAR_0 == '-') { VAR_0++; if(VAR_2 != *VAR_0) { if(!is_valid_option(VAR_0, VAR_1)) { monitor_printf(mon, "%s: unsupported option -%VAR_2\n", VAR_4, *VAR_0); goto fail; } else { VAR_15 = 1; } } if(VAR_15) { VAR_0 = VAR_14; } else { VAR_0++; qdict_put(qdict, VAR_6, qbool_from_bool(true)); } } } break; case 'S': { int VAR_16; while (qemu_isspace(*VAR_0)) { VAR_0++; } if (*VAR_1 == '?') { VAR_1++; if (*VAR_0 == '\0') { break; } } VAR_16 = strlen(VAR_0); if (VAR_16 <= 0) { monitor_printf(mon, "%s: string expected\n", VAR_4); break; } qdict_put(qdict, VAR_6, qstring_from_str(VAR_0)); VAR_0 += VAR_16; } break; default: bad_type: monitor_printf(mon, "%s: unknown type '%VAR_2'\n", VAR_4, VAR_2); goto fail; } g_free(VAR_6); VAR_6 = NULL; } while (qemu_isspace(*VAR_0)) VAR_0++; if (*VAR_0 != '\0') { monitor_printf(mon, "%s: extraneous characters at the VAR_11 of line\n", VAR_4); goto fail; } return VAR_3; fail: g_free(VAR_6); return NULL; }
[ "static const mon_cmd_t *FUNC_0(Monitor *mon,\nconst char *cmdline,\nint start,\nmon_cmd_t *table,\nQDict *qdict)\n{", "const char *VAR_0, *VAR_1;", "int VAR_2;", "const mon_cmd_t *VAR_3;", "char VAR_4[256];", "char VAR_5[1024];", "char *VAR_6;", "VAR_0 = get_command_name(cmdline + start, VAR_4, sizeof(VAR_4));", "if (!VAR_0)\nreturn NULL;", "VAR_3 = search_dispatch_table(table, VAR_4);", "if (!VAR_3) {", "monitor_printf(mon, \"unknown command: '%.*s'\\n\",\n(int)(VAR_0 - cmdline), cmdline);", "return NULL;", "}", "while (qemu_isspace(*VAR_0)) {", "VAR_0++;", "}", "if (VAR_3->sub_table != NULL) {", "if (*VAR_0 == '\\0') {", "return VAR_3;", "}", "return FUNC_0(mon, cmdline, VAR_0 - cmdline,\nVAR_3->sub_table, qdict);", "}", "VAR_1 = VAR_3->args_type;", "for(;;) {", "VAR_1 = key_get_info(VAR_1, &VAR_6);", "if (!VAR_1)\nbreak;", "VAR_2 = *VAR_1;", "VAR_1++;", "switch(VAR_2) {", "case 'F':\ncase 'B':\ncase 's':\n{", "int VAR_7;", "while (qemu_isspace(*VAR_0))\nVAR_0++;", "if (*VAR_1 == '?') {", "VAR_1++;", "if (*VAR_0 == '\\0') {", "break;", "}", "}", "VAR_7 = get_str(VAR_5, sizeof(VAR_5), &VAR_0);", "if (VAR_7 < 0) {", "switch(VAR_2) {", "case 'F':\nmonitor_printf(mon, \"%s: filename expected\\n\",\nVAR_4);", "break;", "case 'B':\nmonitor_printf(mon, \"%s: block device name expected\\n\",\nVAR_4);", "break;", "default:\nmonitor_printf(mon, \"%s: string expected\\n\", VAR_4);", "break;", "}", "goto fail;", "}", "qdict_put(qdict, VAR_6, qstring_from_str(VAR_5));", "}", "break;", "case 'O':\n{", "QemuOptsList *opts_list;", "QemuOpts *opts;", "opts_list = qemu_find_opts(VAR_6);", "if (!opts_list || opts_list->desc->name) {", "goto bad_type;", "}", "while (qemu_isspace(*VAR_0)) {", "VAR_0++;", "}", "if (!*VAR_0)\nbreak;", "if (get_str(VAR_5, sizeof(VAR_5), &VAR_0) < 0) {", "goto fail;", "}", "opts = qemu_opts_parse(opts_list, VAR_5, 1);", "if (!opts) {", "goto fail;", "}", "qemu_opts_to_qdict(opts, qdict);", "qemu_opts_del(opts);", "}", "break;", "case '/':\n{", "int VAR_8, VAR_9, VAR_10;", "while (qemu_isspace(*VAR_0))\nVAR_0++;", "if (*VAR_0 == '/') {", "VAR_0++;", "VAR_8 = 1;", "if (qemu_isdigit(*VAR_0)) {", "VAR_8 = 0;", "while (qemu_isdigit(*VAR_0)) {", "VAR_8 = VAR_8 * 10 + (*VAR_0 - '0');", "VAR_0++;", "}", "}", "VAR_10 = -1;", "VAR_9 = -1;", "for(;;) {", "switch(*VAR_0) {", "case 'o':\ncase 'd':\ncase 'u':\ncase 'x':\ncase 'i':\ncase 'VAR_2':\nVAR_9 = *VAR_0++;", "break;", "case 'b':\nVAR_10 = 1;", "VAR_0++;", "break;", "case 'h':\nVAR_10 = 2;", "VAR_0++;", "break;", "case 'w':\nVAR_10 = 4;", "VAR_0++;", "break;", "case 'g':\ncase 'L':\nVAR_10 = 8;", "VAR_0++;", "break;", "default:\ngoto next;", "}", "}", "next:\nif (*VAR_0 != '\\0' && !qemu_isspace(*VAR_0)) {", "monitor_printf(mon, \"invalid char in VAR_9: '%VAR_2'\\n\",\n*VAR_0);", "goto fail;", "}", "if (VAR_9 < 0)\nVAR_9 = default_fmt_format;", "if (VAR_9 != 'i') {", "if (VAR_10 < 0)\nVAR_10 = default_fmt_size;", "default_fmt_size = VAR_10;", "}", "default_fmt_format = VAR_9;", "} else {", "VAR_8 = 1;", "VAR_9 = default_fmt_format;", "if (VAR_9 != 'i') {", "VAR_10 = default_fmt_size;", "} else {", "VAR_10 = -1;", "}", "}", "qdict_put(qdict, \"VAR_8\", qint_from_int(VAR_8));", "qdict_put(qdict, \"VAR_9\", qint_from_int(VAR_9));", "qdict_put(qdict, \"VAR_10\", qint_from_int(VAR_10));", "}", "break;", "case 'i':\ncase 'l':\ncase 'M':\n{", "int64_t VAR_12;", "while (qemu_isspace(*VAR_0))\nVAR_0++;", "if (*VAR_1 == '?' || *VAR_1 == '.') {", "if (*VAR_1 == '?') {", "if (*VAR_0 == '\\0') {", "VAR_1++;", "break;", "}", "} else {", "if (*VAR_0 == '.') {", "VAR_0++;", "while (qemu_isspace(*VAR_0))\nVAR_0++;", "} else {", "VAR_1++;", "break;", "}", "}", "VAR_1++;", "}", "if (get_expr(mon, &VAR_12, &VAR_0))\ngoto fail;", "if ((VAR_2 == 'i') && ((VAR_12 >> 32) & 0xffffffff)) {", "monitor_printf(mon, \"\\'%s\\' has failed: \", VAR_4);", "monitor_printf(mon, \"integer is for 32-bit values\\n\");", "goto fail;", "} else if (VAR_2 == 'M') {", "if (VAR_12 < 0) {", "monitor_printf(mon, \"enter a positive value\\n\");", "goto fail;", "}", "VAR_12 <<= 20;", "}", "qdict_put(qdict, VAR_6, qint_from_int(VAR_12));", "}", "break;", "case 'o':\n{", "int64_t VAR_12;", "char *VAR_11;", "while (qemu_isspace(*VAR_0)) {", "VAR_0++;", "}", "if (*VAR_1 == '?') {", "VAR_1++;", "if (*VAR_0 == '\\0') {", "break;", "}", "}", "VAR_12 = strtosz(VAR_0, &VAR_11);", "if (VAR_12 < 0) {", "monitor_printf(mon, \"invalid VAR_10\\n\");", "goto fail;", "}", "qdict_put(qdict, VAR_6, qint_from_int(VAR_12));", "VAR_0 = VAR_11;", "}", "break;", "case 'T':\n{", "double VAR_12;", "while (qemu_isspace(*VAR_0))\nVAR_0++;", "if (*VAR_1 == '?') {", "VAR_1++;", "if (*VAR_0 == '\\0') {", "break;", "}", "}", "if (get_double(mon, &VAR_12, &VAR_0) < 0) {", "goto fail;", "}", "if (VAR_0[0] && VAR_0[1] == 's') {", "switch (*VAR_0) {", "case 'm':\nVAR_12 /= 1e3; VAR_0 += 2; break;", "case 'u':\nVAR_12 /= 1e6; VAR_0 += 2; break;", "case 'n':\nVAR_12 /= 1e9; VAR_0 += 2; break;", "}", "}", "if (*VAR_0 && !qemu_isspace(*VAR_0)) {", "monitor_printf(mon, \"Unknown unit suffix\\n\");", "goto fail;", "}", "qdict_put(qdict, VAR_6, qfloat_from_double(VAR_12));", "}", "break;", "case 'b':\n{", "const char *VAR_13;", "bool VAR_12;", "while (qemu_isspace(*VAR_0)) {", "VAR_0++;", "}", "VAR_13 = VAR_0;", "while (qemu_isgraph(*VAR_0)) {", "VAR_0++;", "}", "if (VAR_0 - VAR_13 == 2 && !memcmp(VAR_13, \"on\", VAR_0 - VAR_13)) {", "VAR_12 = true;", "} else if (VAR_0 - VAR_13 == 3 && !memcmp(VAR_13, \"off\", VAR_0 - VAR_13)) {", "VAR_12 = false;", "} else {", "monitor_printf(mon, \"Expected 'on' or 'off'\\n\");", "goto fail;", "}", "qdict_put(qdict, VAR_6, qbool_from_bool(VAR_12));", "}", "break;", "case '-':\n{", "const char *VAR_14 = VAR_0;", "int VAR_15 = 0;", "VAR_2 = *VAR_1++;", "if (VAR_2 == '\\0')\ngoto bad_type;", "while (qemu_isspace(*VAR_0))\nVAR_0++;", "if (*VAR_0 == '-') {", "VAR_0++;", "if(VAR_2 != *VAR_0) {", "if(!is_valid_option(VAR_0, VAR_1)) {", "monitor_printf(mon, \"%s: unsupported option -%VAR_2\\n\",\nVAR_4, *VAR_0);", "goto fail;", "} else {", "VAR_15 = 1;", "}", "}", "if(VAR_15) {", "VAR_0 = VAR_14;", "} else {", "VAR_0++;", "qdict_put(qdict, VAR_6, qbool_from_bool(true));", "}", "}", "}", "break;", "case 'S':\n{", "int VAR_16;", "while (qemu_isspace(*VAR_0)) {", "VAR_0++;", "}", "if (*VAR_1 == '?') {", "VAR_1++;", "if (*VAR_0 == '\\0') {", "break;", "}", "}", "VAR_16 = strlen(VAR_0);", "if (VAR_16 <= 0) {", "monitor_printf(mon, \"%s: string expected\\n\",\nVAR_4);", "break;", "}", "qdict_put(qdict, VAR_6, qstring_from_str(VAR_0));", "VAR_0 += VAR_16;", "}", "break;", "default:\nbad_type:\nmonitor_printf(mon, \"%s: unknown type '%VAR_2'\\n\", VAR_4, VAR_2);", "goto fail;", "}", "g_free(VAR_6);", "VAR_6 = NULL;", "}", "while (qemu_isspace(*VAR_0))\nVAR_0++;", "if (*VAR_0 != '\\0') {", "monitor_printf(mon, \"%s: extraneous characters at the VAR_11 of line\\n\",\nVAR_4);", "goto fail;", "}", "return VAR_3;", "fail:\ng_free(VAR_6);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31, 33 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99, 101, 103 ], [ 105 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 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 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217, 219 ], [ 221 ], [ 225, 227 ], [ 229 ], [ 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 ], [ 337, 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375, 377, 379, 381 ], [ 383 ], [ 387, 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 399 ], [ 401 ], [ 403 ], [ 405 ], [ 407 ], [ 409, 411 ], [ 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427, 429 ], [ 433 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461, 463 ], [ 465 ], [ 467 ], [ 471 ], [ 473 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 483 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 507, 509 ], [ 511 ], [ 515, 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ], [ 529 ], [ 531 ], [ 533 ], [ 535 ], [ 537 ], [ 539 ], [ 541, 543 ], [ 545, 547 ], [ 549, 551 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 561 ], [ 563 ], [ 565 ], [ 567 ], [ 569 ], [ 571, 573 ], [ 575 ], [ 577 ], [ 581 ], [ 583 ], [ 585 ], [ 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 605 ], [ 607 ], [ 609 ], [ 611 ], [ 613 ], [ 615 ], [ 617, 619 ], [ 621 ], [ 623 ], [ 629 ], [ 631, 633 ], [ 635, 637 ], [ 639 ], [ 641 ], [ 643 ], [ 645 ], [ 649, 651 ], [ 653 ], [ 655 ], [ 657 ], [ 659 ], [ 661 ], [ 663 ], [ 665 ], [ 667 ], [ 671 ], [ 673 ], [ 675 ], [ 677 ], [ 679 ], [ 681 ], [ 683, 685 ], [ 689 ], [ 693 ], [ 695 ], [ 697 ], [ 699 ], [ 701 ], [ 703 ], [ 707 ], [ 709 ], [ 711 ], [ 713 ], [ 715 ], [ 717, 719 ], [ 721 ], [ 723 ], [ 725 ], [ 727 ], [ 729 ], [ 731 ], [ 733, 735, 737 ], [ 739 ], [ 741 ], [ 743 ], [ 745 ], [ 747 ], [ 751, 753 ], [ 755 ], [ 757, 759 ], [ 761 ], [ 763 ], [ 767 ], [ 771, 773 ], [ 775 ], [ 777 ] ]
8,266
opts_start_struct(Visitor *v, void **obj, const char *kind, const char *name, size_t size, Error **errp) { OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v); const QemuOpt *opt; *obj = g_malloc0(size > 0 ? size : 1); if (ov->depth++ > 0) { return; } ov->unprocessed_opts = g_hash_table_new_full(&g_str_hash, &g_str_equal, NULL, &destroy_list); QTAILQ_FOREACH(opt, &ov->opts_root->head, next) { /* ensured by qemu-option.c::opts_do_parse() */ assert(strcmp(opt->name, "id") != 0); opts_visitor_insert(ov->unprocessed_opts, opt); } if (ov->opts_root->id != NULL) { ov->fake_id_opt = g_malloc0(sizeof *ov->fake_id_opt); ov->fake_id_opt->name = "id"; ov->fake_id_opt->str = ov->opts_root->id; opts_visitor_insert(ov->unprocessed_opts, ov->fake_id_opt); } }
false
qemu
b774539743c52ef605c6e2cbac19376c2757cb86
opts_start_struct(Visitor *v, void **obj, const char *kind, const char *name, size_t size, Error **errp) { OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v); const QemuOpt *opt; *obj = g_malloc0(size > 0 ? size : 1); if (ov->depth++ > 0) { return; } ov->unprocessed_opts = g_hash_table_new_full(&g_str_hash, &g_str_equal, NULL, &destroy_list); QTAILQ_FOREACH(opt, &ov->opts_root->head, next) { assert(strcmp(opt->name, "id") != 0); opts_visitor_insert(ov->unprocessed_opts, opt); } if (ov->opts_root->id != NULL) { ov->fake_id_opt = g_malloc0(sizeof *ov->fake_id_opt); ov->fake_id_opt->name = "id"; ov->fake_id_opt->str = ov->opts_root->id; opts_visitor_insert(ov->unprocessed_opts, ov->fake_id_opt); } }
{ "code": [], "line_no": [] }
FUNC_0(Visitor *VAR_0, void **VAR_1, const char *VAR_2, const char *VAR_3, size_t VAR_4, Error **VAR_5) { OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, VAR_0); const QemuOpt *VAR_6; *VAR_1 = g_malloc0(VAR_4 > 0 ? VAR_4 : 1); if (ov->depth++ > 0) { return; } ov->unprocessed_opts = g_hash_table_new_full(&g_str_hash, &g_str_equal, NULL, &destroy_list); QTAILQ_FOREACH(VAR_6, &ov->opts_root->head, next) { assert(strcmp(VAR_6->VAR_3, "id") != 0); opts_visitor_insert(ov->unprocessed_opts, VAR_6); } if (ov->opts_root->id != NULL) { ov->fake_id_opt = g_malloc0(sizeof *ov->fake_id_opt); ov->fake_id_opt->VAR_3 = "id"; ov->fake_id_opt->str = ov->opts_root->id; opts_visitor_insert(ov->unprocessed_opts, ov->fake_id_opt); } }
[ "FUNC_0(Visitor *VAR_0, void **VAR_1, const char *VAR_2,\nconst char *VAR_3, size_t VAR_4, Error **VAR_5)\n{", "OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, VAR_0);", "const QemuOpt *VAR_6;", "*VAR_1 = g_malloc0(VAR_4 > 0 ? VAR_4 : 1);", "if (ov->depth++ > 0) {", "return;", "}", "ov->unprocessed_opts = g_hash_table_new_full(&g_str_hash, &g_str_equal,\nNULL, &destroy_list);", "QTAILQ_FOREACH(VAR_6, &ov->opts_root->head, next) {", "assert(strcmp(VAR_6->VAR_3, \"id\") != 0);", "opts_visitor_insert(ov->unprocessed_opts, VAR_6);", "}", "if (ov->opts_root->id != NULL) {", "ov->fake_id_opt = g_malloc0(sizeof *ov->fake_id_opt);", "ov->fake_id_opt->VAR_3 = \"id\";", "ov->fake_id_opt->str = ov->opts_root->id;", "opts_visitor_insert(ov->unprocessed_opts, ov->fake_id_opt);", "}", "}" ]
[ 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 ], [ 23, 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ] ]
8,267
static UserDefTwo *nested_struct_create(void) { UserDefTwo *udnp = g_malloc0(sizeof(*udnp)); udnp->string0 = strdup("test_string0"); udnp->dict1 = g_malloc0(sizeof(*udnp->dict1)); udnp->dict1->string1 = strdup("test_string1"); udnp->dict1->dict2 = g_malloc0(sizeof(*udnp->dict1->dict2)); udnp->dict1->dict2->userdef = g_new0(UserDefOne, 1); udnp->dict1->dict2->userdef->base = g_new0(UserDefZero, 1); udnp->dict1->dict2->userdef->base->integer = 42; udnp->dict1->dict2->userdef->string = strdup("test_string"); udnp->dict1->dict2->string = strdup("test_string2"); udnp->dict1->dict3 = g_malloc0(sizeof(*udnp->dict1->dict3)); udnp->dict1->has_dict3 = true; udnp->dict1->dict3->userdef = g_new0(UserDefOne, 1); udnp->dict1->dict3->userdef->base = g_new0(UserDefZero, 1); udnp->dict1->dict3->userdef->base->integer = 43; udnp->dict1->dict3->userdef->string = strdup("test_string"); udnp->dict1->dict3->string = strdup("test_string3"); return udnp; }
false
qemu
ddf21908961073199f3d186204da4810f2ea150b
static UserDefTwo *nested_struct_create(void) { UserDefTwo *udnp = g_malloc0(sizeof(*udnp)); udnp->string0 = strdup("test_string0"); udnp->dict1 = g_malloc0(sizeof(*udnp->dict1)); udnp->dict1->string1 = strdup("test_string1"); udnp->dict1->dict2 = g_malloc0(sizeof(*udnp->dict1->dict2)); udnp->dict1->dict2->userdef = g_new0(UserDefOne, 1); udnp->dict1->dict2->userdef->base = g_new0(UserDefZero, 1); udnp->dict1->dict2->userdef->base->integer = 42; udnp->dict1->dict2->userdef->string = strdup("test_string"); udnp->dict1->dict2->string = strdup("test_string2"); udnp->dict1->dict3 = g_malloc0(sizeof(*udnp->dict1->dict3)); udnp->dict1->has_dict3 = true; udnp->dict1->dict3->userdef = g_new0(UserDefOne, 1); udnp->dict1->dict3->userdef->base = g_new0(UserDefZero, 1); udnp->dict1->dict3->userdef->base->integer = 43; udnp->dict1->dict3->userdef->string = strdup("test_string"); udnp->dict1->dict3->string = strdup("test_string3"); return udnp; }
{ "code": [], "line_no": [] }
static UserDefTwo *FUNC_0(void) { UserDefTwo *udnp = g_malloc0(sizeof(*udnp)); udnp->string0 = strdup("test_string0"); udnp->dict1 = g_malloc0(sizeof(*udnp->dict1)); udnp->dict1->string1 = strdup("test_string1"); udnp->dict1->dict2 = g_malloc0(sizeof(*udnp->dict1->dict2)); udnp->dict1->dict2->userdef = g_new0(UserDefOne, 1); udnp->dict1->dict2->userdef->base = g_new0(UserDefZero, 1); udnp->dict1->dict2->userdef->base->integer = 42; udnp->dict1->dict2->userdef->string = strdup("test_string"); udnp->dict1->dict2->string = strdup("test_string2"); udnp->dict1->dict3 = g_malloc0(sizeof(*udnp->dict1->dict3)); udnp->dict1->has_dict3 = true; udnp->dict1->dict3->userdef = g_new0(UserDefOne, 1); udnp->dict1->dict3->userdef->base = g_new0(UserDefZero, 1); udnp->dict1->dict3->userdef->base->integer = 43; udnp->dict1->dict3->userdef->string = strdup("test_string"); udnp->dict1->dict3->string = strdup("test_string3"); return udnp; }
[ "static UserDefTwo *FUNC_0(void)\n{", "UserDefTwo *udnp = g_malloc0(sizeof(*udnp));", "udnp->string0 = strdup(\"test_string0\");", "udnp->dict1 = g_malloc0(sizeof(*udnp->dict1));", "udnp->dict1->string1 = strdup(\"test_string1\");", "udnp->dict1->dict2 = g_malloc0(sizeof(*udnp->dict1->dict2));", "udnp->dict1->dict2->userdef = g_new0(UserDefOne, 1);", "udnp->dict1->dict2->userdef->base = g_new0(UserDefZero, 1);", "udnp->dict1->dict2->userdef->base->integer = 42;", "udnp->dict1->dict2->userdef->string = strdup(\"test_string\");", "udnp->dict1->dict2->string = strdup(\"test_string2\");", "udnp->dict1->dict3 = g_malloc0(sizeof(*udnp->dict1->dict3));", "udnp->dict1->has_dict3 = true;", "udnp->dict1->dict3->userdef = g_new0(UserDefOne, 1);", "udnp->dict1->dict3->userdef->base = g_new0(UserDefZero, 1);", "udnp->dict1->dict3->userdef->base->integer = 43;", "udnp->dict1->dict3->userdef->string = strdup(\"test_string\");", "udnp->dict1->dict3->string = strdup(\"test_string3\");", "return udnp;", "}" ]
[ 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 ] ]
8,268
static void gem_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) { GemState *s = (GemState *)opaque; uint32_t readonly; DB_PRINT("offset: 0x%04x write: 0x%08x ", (unsigned)offset, (unsigned)val); offset >>= 2; /* Squash bits which are read only in write value */ val &= ~(s->regs_ro[offset]); /* Preserve (only) bits which are read only and wtc in register */ readonly = s->regs[offset] & (s->regs_ro[offset] | s->regs_w1c[offset]); /* Copy register write to backing store */ s->regs[offset] = (val & ~s->regs_w1c[offset]) | readonly; /* do w1c */ s->regs[offset] &= ~(s->regs_w1c[offset] & val); /* Handle register write side effects */ switch (offset) { case GEM_NWCTRL: if (val & GEM_NWCTRL_RXENA) { gem_get_rx_desc(s); } if (val & GEM_NWCTRL_TXSTART) { gem_transmit(s); } if (!(val & GEM_NWCTRL_TXENA)) { /* Reset to start of Q when transmit disabled. */ s->tx_desc_addr = s->regs[GEM_TXQBASE]; } if (val & GEM_NWCTRL_RXENA) { qemu_flush_queued_packets(qemu_get_queue(s->nic)); } break; case GEM_TXSTATUS: gem_update_int_status(s); break; case GEM_RXQBASE: s->rx_desc_addr = val; break; case GEM_TXQBASE: s->tx_desc_addr = val; break; case GEM_RXSTATUS: gem_update_int_status(s); break; case GEM_IER: s->regs[GEM_IMR] &= ~val; gem_update_int_status(s); break; case GEM_IDR: s->regs[GEM_IMR] |= val; gem_update_int_status(s); break; case GEM_SPADDR1LO: case GEM_SPADDR2LO: case GEM_SPADDR3LO: case GEM_SPADDR4LO: s->sar_active[(offset - GEM_SPADDR1LO) / 2] = false; break; case GEM_SPADDR1HI: case GEM_SPADDR2HI: case GEM_SPADDR3HI: case GEM_SPADDR4HI: s->sar_active[(offset - GEM_SPADDR1HI) / 2] = true; break; case GEM_PHYMNTNC: if (val & GEM_PHYMNTNC_OP_W) { uint32_t phy_addr, reg_num; phy_addr = (val & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT; if (phy_addr == BOARD_PHY_ADDRESS) { reg_num = (val & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT; gem_phy_write(s, reg_num, val); } } break; } DB_PRINT("newval: 0x%08x\n", s->regs[offset]); }
false
qemu
8202aa539135a44906c38f82a469234ec65e0ef7
static void gem_write(void *opaque, hwaddr offset, uint64_t val, unsigned size) { GemState *s = (GemState *)opaque; uint32_t readonly; DB_PRINT("offset: 0x%04x write: 0x%08x ", (unsigned)offset, (unsigned)val); offset >>= 2; val &= ~(s->regs_ro[offset]); readonly = s->regs[offset] & (s->regs_ro[offset] | s->regs_w1c[offset]); s->regs[offset] = (val & ~s->regs_w1c[offset]) | readonly; s->regs[offset] &= ~(s->regs_w1c[offset] & val); switch (offset) { case GEM_NWCTRL: if (val & GEM_NWCTRL_RXENA) { gem_get_rx_desc(s); } if (val & GEM_NWCTRL_TXSTART) { gem_transmit(s); } if (!(val & GEM_NWCTRL_TXENA)) { s->tx_desc_addr = s->regs[GEM_TXQBASE]; } if (val & GEM_NWCTRL_RXENA) { qemu_flush_queued_packets(qemu_get_queue(s->nic)); } break; case GEM_TXSTATUS: gem_update_int_status(s); break; case GEM_RXQBASE: s->rx_desc_addr = val; break; case GEM_TXQBASE: s->tx_desc_addr = val; break; case GEM_RXSTATUS: gem_update_int_status(s); break; case GEM_IER: s->regs[GEM_IMR] &= ~val; gem_update_int_status(s); break; case GEM_IDR: s->regs[GEM_IMR] |= val; gem_update_int_status(s); break; case GEM_SPADDR1LO: case GEM_SPADDR2LO: case GEM_SPADDR3LO: case GEM_SPADDR4LO: s->sar_active[(offset - GEM_SPADDR1LO) / 2] = false; break; case GEM_SPADDR1HI: case GEM_SPADDR2HI: case GEM_SPADDR3HI: case GEM_SPADDR4HI: s->sar_active[(offset - GEM_SPADDR1HI) / 2] = true; break; case GEM_PHYMNTNC: if (val & GEM_PHYMNTNC_OP_W) { uint32_t phy_addr, reg_num; phy_addr = (val & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT; if (phy_addr == BOARD_PHY_ADDRESS) { reg_num = (val & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT; gem_phy_write(s, reg_num, val); } } break; } DB_PRINT("newval: 0x%08x\n", s->regs[offset]); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { GemState *s = (GemState *)VAR_0; uint32_t readonly; DB_PRINT("VAR_1: 0x%04x write: 0x%08x ", (unsigned)VAR_1, (unsigned)VAR_2); VAR_1 >>= 2; VAR_2 &= ~(s->regs_ro[VAR_1]); readonly = s->regs[VAR_1] & (s->regs_ro[VAR_1] | s->regs_w1c[VAR_1]); s->regs[VAR_1] = (VAR_2 & ~s->regs_w1c[VAR_1]) | readonly; s->regs[VAR_1] &= ~(s->regs_w1c[VAR_1] & VAR_2); switch (VAR_1) { case GEM_NWCTRL: if (VAR_2 & GEM_NWCTRL_RXENA) { gem_get_rx_desc(s); } if (VAR_2 & GEM_NWCTRL_TXSTART) { gem_transmit(s); } if (!(VAR_2 & GEM_NWCTRL_TXENA)) { s->tx_desc_addr = s->regs[GEM_TXQBASE]; } if (VAR_2 & GEM_NWCTRL_RXENA) { qemu_flush_queued_packets(qemu_get_queue(s->nic)); } break; case GEM_TXSTATUS: gem_update_int_status(s); break; case GEM_RXQBASE: s->rx_desc_addr = VAR_2; break; case GEM_TXQBASE: s->tx_desc_addr = VAR_2; break; case GEM_RXSTATUS: gem_update_int_status(s); break; case GEM_IER: s->regs[GEM_IMR] &= ~VAR_2; gem_update_int_status(s); break; case GEM_IDR: s->regs[GEM_IMR] |= VAR_2; gem_update_int_status(s); break; case GEM_SPADDR1LO: case GEM_SPADDR2LO: case GEM_SPADDR3LO: case GEM_SPADDR4LO: s->sar_active[(VAR_1 - GEM_SPADDR1LO) / 2] = false; break; case GEM_SPADDR1HI: case GEM_SPADDR2HI: case GEM_SPADDR3HI: case GEM_SPADDR4HI: s->sar_active[(VAR_1 - GEM_SPADDR1HI) / 2] = true; break; case GEM_PHYMNTNC: if (VAR_2 & GEM_PHYMNTNC_OP_W) { uint32_t phy_addr, reg_num; phy_addr = (VAR_2 & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT; if (phy_addr == BOARD_PHY_ADDRESS) { reg_num = (VAR_2 & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT; gem_phy_write(s, reg_num, VAR_2); } } break; } DB_PRINT("newval: 0x%08x\n", s->regs[VAR_1]); }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2,\nunsigned VAR_3)\n{", "GemState *s = (GemState *)VAR_0;", "uint32_t readonly;", "DB_PRINT(\"VAR_1: 0x%04x write: 0x%08x \", (unsigned)VAR_1, (unsigned)VAR_2);", "VAR_1 >>= 2;", "VAR_2 &= ~(s->regs_ro[VAR_1]);", "readonly = s->regs[VAR_1] & (s->regs_ro[VAR_1] | s->regs_w1c[VAR_1]);", "s->regs[VAR_1] = (VAR_2 & ~s->regs_w1c[VAR_1]) | readonly;", "s->regs[VAR_1] &= ~(s->regs_w1c[VAR_1] & VAR_2);", "switch (VAR_1) {", "case GEM_NWCTRL:\nif (VAR_2 & GEM_NWCTRL_RXENA) {", "gem_get_rx_desc(s);", "}", "if (VAR_2 & GEM_NWCTRL_TXSTART) {", "gem_transmit(s);", "}", "if (!(VAR_2 & GEM_NWCTRL_TXENA)) {", "s->tx_desc_addr = s->regs[GEM_TXQBASE];", "}", "if (VAR_2 & GEM_NWCTRL_RXENA) {", "qemu_flush_queued_packets(qemu_get_queue(s->nic));", "}", "break;", "case GEM_TXSTATUS:\ngem_update_int_status(s);", "break;", "case GEM_RXQBASE:\ns->rx_desc_addr = VAR_2;", "break;", "case GEM_TXQBASE:\ns->tx_desc_addr = VAR_2;", "break;", "case GEM_RXSTATUS:\ngem_update_int_status(s);", "break;", "case GEM_IER:\ns->regs[GEM_IMR] &= ~VAR_2;", "gem_update_int_status(s);", "break;", "case GEM_IDR:\ns->regs[GEM_IMR] |= VAR_2;", "gem_update_int_status(s);", "break;", "case GEM_SPADDR1LO:\ncase GEM_SPADDR2LO:\ncase GEM_SPADDR3LO:\ncase GEM_SPADDR4LO:\ns->sar_active[(VAR_1 - GEM_SPADDR1LO) / 2] = false;", "break;", "case GEM_SPADDR1HI:\ncase GEM_SPADDR2HI:\ncase GEM_SPADDR3HI:\ncase GEM_SPADDR4HI:\ns->sar_active[(VAR_1 - GEM_SPADDR1HI) / 2] = true;", "break;", "case GEM_PHYMNTNC:\nif (VAR_2 & GEM_PHYMNTNC_OP_W) {", "uint32_t phy_addr, reg_num;", "phy_addr = (VAR_2 & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT;", "if (phy_addr == BOARD_PHY_ADDRESS) {", "reg_num = (VAR_2 & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT;", "gem_phy_write(s, reg_num, VAR_2);", "}", "}", "break;", "}", "DB_PRINT(\"newval: 0x%08x\\n\", s->regs[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, 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 ], [ 21 ], [ 25 ], [ 31 ], [ 37 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 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 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ] ]
8,269
uint32_t cpu_ppc_load_decr (CPUState *env) { ppc_tb_t *tb_env = env->tb_env; uint32_t decr; decr = muldiv64(tb_env->decr_next - qemu_get_clock(vm_clock), tb_env->tb_freq, ticks_per_sec); #if defined(DEBUG_TB) printf("%s: 0x%08x\n", __func__, decr); #endif return decr; }
false
qemu
4e588a4d0e1683488282658c057d4b44976d77d8
uint32_t cpu_ppc_load_decr (CPUState *env) { ppc_tb_t *tb_env = env->tb_env; uint32_t decr; decr = muldiv64(tb_env->decr_next - qemu_get_clock(vm_clock), tb_env->tb_freq, ticks_per_sec); #if defined(DEBUG_TB) printf("%s: 0x%08x\n", __func__, decr); #endif return decr; }
{ "code": [], "line_no": [] }
uint32_t FUNC_0 (CPUState *env) { ppc_tb_t *tb_env = env->tb_env; uint32_t decr; decr = muldiv64(tb_env->decr_next - qemu_get_clock(vm_clock), tb_env->tb_freq, ticks_per_sec); #if defined(DEBUG_TB) printf("%s: 0x%08x\n", __func__, decr); #endif return decr; }
[ "uint32_t FUNC_0 (CPUState *env)\n{", "ppc_tb_t *tb_env = env->tb_env;", "uint32_t decr;", "decr = muldiv64(tb_env->decr_next - qemu_get_clock(vm_clock),\ntb_env->tb_freq, ticks_per_sec);", "#if defined(DEBUG_TB)\nprintf(\"%s: 0x%08x\\n\", __func__, decr);", "#endif\nreturn decr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13 ], [ 15, 17 ], [ 19, 23 ], [ 25 ] ]
8,270
static int wm8750_event(I2CSlave *i2c, enum i2c_event event) { WM8750State *s = WM8750(i2c); switch (event) { case I2C_START_SEND: s->i2c_len = 0; break; case I2C_FINISH: #ifdef VERBOSE if (s->i2c_len < 2) printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->i2c_len); #endif break; default: break; } return 0; }
false
qemu
a89f364ae8740dfc31b321eed9ee454e996dc3c1
static int wm8750_event(I2CSlave *i2c, enum i2c_event event) { WM8750State *s = WM8750(i2c); switch (event) { case I2C_START_SEND: s->i2c_len = 0; break; case I2C_FINISH: #ifdef VERBOSE if (s->i2c_len < 2) printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->i2c_len); #endif break; default: break; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(I2CSlave *VAR_0, enum i2c_event VAR_1) { WM8750State *s = WM8750(VAR_0); switch (VAR_1) { case I2C_START_SEND: s->i2c_len = 0; break; case I2C_FINISH: #ifdef VERBOSE if (s->i2c_len < 2) printf("%s: message too short (%i bytes)\n", __FUNCTION__, s->i2c_len); #endif break; default: break; } return 0; }
[ "static int FUNC_0(I2CSlave *VAR_0, enum i2c_event VAR_1)\n{", "WM8750State *s = WM8750(VAR_0);", "switch (VAR_1) {", "case I2C_START_SEND:\ns->i2c_len = 0;", "break;", "case I2C_FINISH:\n#ifdef VERBOSE\nif (s->i2c_len < 2)\nprintf(\"%s: message too short (%i bytes)\\n\",\n__FUNCTION__, s->i2c_len);", "#endif\nbreak;", "default:\nbreak;", "}", "return 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 ], [ 39 ], [ 41 ] ]
8,272
static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { AMRWBContext *s = avctx->priv_data; const int16_t *samples = (const int16_t *)frame->data[0]; int size, ret; if ((ret = ff_alloc_packet2(avctx, avpkt, MAX_PACKET_SIZE))) return ret; if (s->last_bitrate != avctx->bit_rate) { s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); s->last_bitrate = avctx->bit_rate; } size = E_IF_encode(s->state, s->mode, samples, avpkt->data, s->allow_dtx); if (size <= 0 || size > MAX_PACKET_SIZE) { av_log(avctx, AV_LOG_ERROR, "Error encoding frame\n"); return AVERROR(EINVAL); } if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); avpkt->size = size; *got_packet_ptr = 1; return 0; }
false
FFmpeg
bcaf64b605442e1622d16da89d4ec0e7730b8a8c
static int amr_wb_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { AMRWBContext *s = avctx->priv_data; const int16_t *samples = (const int16_t *)frame->data[0]; int size, ret; if ((ret = ff_alloc_packet2(avctx, avpkt, MAX_PACKET_SIZE))) return ret; if (s->last_bitrate != avctx->bit_rate) { s->mode = get_wb_bitrate_mode(avctx->bit_rate, avctx); s->last_bitrate = avctx->bit_rate; } size = E_IF_encode(s->state, s->mode, samples, avpkt->data, s->allow_dtx); if (size <= 0 || size > MAX_PACKET_SIZE) { av_log(avctx, AV_LOG_ERROR, "Error encoding frame\n"); return AVERROR(EINVAL); } if (frame->pts != AV_NOPTS_VALUE) avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay); avpkt->size = size; *got_packet_ptr = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { AMRWBContext *s = VAR_0->priv_data; const int16_t *VAR_4 = (const int16_t *)VAR_2->data[0]; int VAR_5, VAR_6; if ((VAR_6 = ff_alloc_packet2(VAR_0, VAR_1, MAX_PACKET_SIZE))) return VAR_6; if (s->last_bitrate != VAR_0->bit_rate) { s->mode = get_wb_bitrate_mode(VAR_0->bit_rate, VAR_0); s->last_bitrate = VAR_0->bit_rate; } VAR_5 = E_IF_encode(s->state, s->mode, VAR_4, VAR_1->data, s->allow_dtx); if (VAR_5 <= 0 || VAR_5 > MAX_PACKET_SIZE) { av_log(VAR_0, AV_LOG_ERROR, "Error encoding VAR_2\n"); return AVERROR(EINVAL); } if (VAR_2->pts != AV_NOPTS_VALUE) VAR_1->pts = VAR_2->pts - ff_samples_to_time_base(VAR_0, VAR_0->delay); VAR_1->VAR_5 = VAR_5; *VAR_3 = 1; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "AMRWBContext *s = VAR_0->priv_data;", "const int16_t *VAR_4 = (const int16_t *)VAR_2->data[0];", "int VAR_5, VAR_6;", "if ((VAR_6 = ff_alloc_packet2(VAR_0, VAR_1, MAX_PACKET_SIZE)))\nreturn VAR_6;", "if (s->last_bitrate != VAR_0->bit_rate) {", "s->mode = get_wb_bitrate_mode(VAR_0->bit_rate, VAR_0);", "s->last_bitrate = VAR_0->bit_rate;", "}", "VAR_5 = E_IF_encode(s->state, s->mode, VAR_4, VAR_1->data, s->allow_dtx);", "if (VAR_5 <= 0 || VAR_5 > MAX_PACKET_SIZE) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error encoding VAR_2\\n\");", "return AVERROR(EINVAL);", "}", "if (VAR_2->pts != AV_NOPTS_VALUE)\nVAR_1->pts = VAR_2->pts - ff_samples_to_time_base(VAR_0, VAR_0->delay);", "VAR_1->VAR_5 = VAR_5;", "*VAR_3 = 1;", "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 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ] ]
8,275
static int decode_2(SANMVideoContext *ctx) { int cx, cy, ret; for (cy = 0; cy != ctx->aligned_height; cy += 8) { for (cx = 0; cx != ctx->aligned_width; cx += 8) { if (ret = codec2subblock(ctx, cx, cy, 8)) return ret; } } return 0; }
false
FFmpeg
3b9dd906d18f4cd801ceedd20d800a7e53074be9
static int decode_2(SANMVideoContext *ctx) { int cx, cy, ret; for (cy = 0; cy != ctx->aligned_height; cy += 8) { for (cx = 0; cx != ctx->aligned_width; cx += 8) { if (ret = codec2subblock(ctx, cx, cy, 8)) return ret; } } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(SANMVideoContext *VAR_0) { int VAR_1, VAR_2, VAR_3; for (VAR_2 = 0; VAR_2 != VAR_0->aligned_height; VAR_2 += 8) { for (VAR_1 = 0; VAR_1 != VAR_0->aligned_width; VAR_1 += 8) { if (VAR_3 = codec2subblock(VAR_0, VAR_1, VAR_2, 8)) return VAR_3; } } return 0; }
[ "static int FUNC_0(SANMVideoContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3;", "for (VAR_2 = 0; VAR_2 != VAR_0->aligned_height; VAR_2 += 8) {", "for (VAR_1 = 0; VAR_1 != VAR_0->aligned_width; VAR_1 += 8) {", "if (VAR_3 = codec2subblock(VAR_0, VAR_1, VAR_2, 8))\nreturn VAR_3;", "}", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
8,277
static bool cmd_write_pio(IDEState *s, uint8_t cmd) { bool lba48 = (cmd == WIN_WRITE_EXT); if (!s->bs) { ide_abort_command(s); return true; } ide_cmd_lba48_transform(s, lba48); s->req_nb_sectors = 1; s->status = SEEK_STAT | READY_STAT; ide_transfer_start(s, s->io_buffer, 512, ide_sector_write); s->media_changed = 1; return false; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static bool cmd_write_pio(IDEState *s, uint8_t cmd) { bool lba48 = (cmd == WIN_WRITE_EXT); if (!s->bs) { ide_abort_command(s); return true; } ide_cmd_lba48_transform(s, lba48); s->req_nb_sectors = 1; s->status = SEEK_STAT | READY_STAT; ide_transfer_start(s, s->io_buffer, 512, ide_sector_write); s->media_changed = 1; return false; }
{ "code": [], "line_no": [] }
static bool FUNC_0(IDEState *s, uint8_t cmd) { bool lba48 = (cmd == WIN_WRITE_EXT); if (!s->bs) { ide_abort_command(s); return true; } ide_cmd_lba48_transform(s, lba48); s->req_nb_sectors = 1; s->status = SEEK_STAT | READY_STAT; ide_transfer_start(s, s->io_buffer, 512, ide_sector_write); s->media_changed = 1; return false; }
[ "static bool FUNC_0(IDEState *s, uint8_t cmd)\n{", "bool lba48 = (cmd == WIN_WRITE_EXT);", "if (!s->bs) {", "ide_abort_command(s);", "return true;", "}", "ide_cmd_lba48_transform(s, lba48);", "s->req_nb_sectors = 1;", "s->status = SEEK_STAT | READY_STAT;", "ide_transfer_start(s, s->io_buffer, 512, ide_sector_write);", "s->media_changed = 1;", "return false;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ] ]
8,278
static uint64_t cirrus_mmio_read(void *opaque, target_phys_addr_t addr, unsigned size) { CirrusVGAState *s = opaque; if (addr >= 0x100) { return cirrus_mmio_blt_read(s, addr - 0x100); } else { return cirrus_vga_ioport_read(s, addr + 0x3c0); } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static uint64_t cirrus_mmio_read(void *opaque, target_phys_addr_t addr, unsigned size) { CirrusVGAState *s = opaque; if (addr >= 0x100) { return cirrus_mmio_blt_read(s, addr - 0x100); } else { return cirrus_vga_ioport_read(s, addr + 0x3c0); } }
{ "code": [], "line_no": [] }
static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr, unsigned size) { CirrusVGAState *s = opaque; if (addr >= 0x100) { return cirrus_mmio_blt_read(s, addr - 0x100); } else { return cirrus_vga_ioport_read(s, addr + 0x3c0); } }
[ "static uint64_t FUNC_0(void *opaque, target_phys_addr_t addr,\nunsigned size)\n{", "CirrusVGAState *s = opaque;", "if (addr >= 0x100) {", "return cirrus_mmio_blt_read(s, addr - 0x100);", "} else {", "return cirrus_vga_ioport_read(s, addr + 0x3c0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
8,279
static int ffv1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { FFV1Context *f = avctx->priv_data; RangeCoder *const c = &f->slice_context[0]->c; int used_count = 0; uint8_t keystate = 128; uint8_t *buf_p; int i, ret; f->frame = pict; if ((ret = ff_alloc_packet(pkt, avctx->width * avctx->height * ((8 * 2 + 1 + 1) * 4) / 8 + AV_INPUT_BUFFER_MIN_SIZE)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } ff_init_range_encoder(c, pkt->data, pkt->size); ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8); if (avctx->gop_size == 0 || f->picture_number % avctx->gop_size == 0) { put_rac(c, &keystate, 1); f->key_frame = 1; f->gob_count++; write_header(f); } else { put_rac(c, &keystate, 0); f->key_frame = 0; } if (f->ac > 1) { int i; for (i = 1; i < 256; i++) { c->one_state[i] = f->state_transition[i]; c->zero_state[256 - i] = 256 - c->one_state[i]; } } for (i = 1; i < f->slice_count; i++) { FFV1Context *fs = f->slice_context[i]; uint8_t *start = pkt->data + (pkt->size - used_count) * (int64_t)i / f->slice_count; int len = pkt->size / f->slice_count; ff_init_range_encoder(&fs->c, start, len); } avctx->execute(avctx, encode_slice, &f->slice_context[0], NULL, f->slice_count, sizeof(void *)); buf_p = pkt->data; for (i = 0; i < f->slice_count; i++) { FFV1Context *fs = f->slice_context[i]; int bytes; if (fs->ac) { uint8_t state = 129; put_rac(&fs->c, &state, 0); bytes = ff_rac_terminate(&fs->c); } else { flush_put_bits(&fs->pb); // FIXME: nicer padding bytes = fs->ac_byte_count + (put_bits_count(&fs->pb) + 7) / 8; } if (i > 0 || f->version > 2) { av_assert0(bytes < pkt->size / f->slice_count); memmove(buf_p, fs->c.bytestream_start, bytes); av_assert0(bytes < (1 << 24)); AV_WB24(buf_p + bytes, bytes); bytes += 3; } if (f->ec) { unsigned v; buf_p[bytes++] = 0; v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, buf_p, bytes); AV_WL32(buf_p + bytes, v); bytes += 4; } buf_p += bytes; } if ((avctx->flags & AV_CODEC_FLAG_PASS1) && (f->picture_number & 31) == 0) { int j, k, m; char *p = avctx->stats_out; char *end = p + STATS_OUT_SIZE; memset(f->rc_stat, 0, sizeof(f->rc_stat)); for (i = 0; i < f->quant_table_count; i++) memset(f->rc_stat2[i], 0, f->context_count[i] * sizeof(*f->rc_stat2[i])); for (j = 0; j < f->slice_count; j++) { FFV1Context *fs = f->slice_context[j]; for (i = 0; i < 256; i++) { f->rc_stat[i][0] += fs->rc_stat[i][0]; f->rc_stat[i][1] += fs->rc_stat[i][1]; } for (i = 0; i < f->quant_table_count; i++) { for (k = 0; k < f->context_count[i]; k++) for (m = 0; m < 32; m++) { f->rc_stat2[i][k][m][0] += fs->rc_stat2[i][k][m][0]; f->rc_stat2[i][k][m][1] += fs->rc_stat2[i][k][m][1]; } } } for (j = 0; j < 256; j++) { snprintf(p, end - p, "%" PRIu64 " %" PRIu64 " ", f->rc_stat[j][0], f->rc_stat[j][1]); p += strlen(p); } snprintf(p, end - p, "\n"); for (i = 0; i < f->quant_table_count; i++) { for (j = 0; j < f->context_count[i]; j++) for (m = 0; m < 32; m++) { snprintf(p, end - p, "%" PRIu64 " %" PRIu64 " ", f->rc_stat2[i][j][m][0], f->rc_stat2[i][j][m][1]); p += strlen(p); } } snprintf(p, end - p, "%d\n", f->gob_count); } else if (avctx->flags & AV_CODEC_FLAG_PASS1) avctx->stats_out[0] = '\0'; #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS avctx->coded_frame->key_frame = f->key_frame; FF_ENABLE_DEPRECATION_WARNINGS #endif f->picture_number++; pkt->size = buf_p - pkt->data; pkt->flags |= AV_PKT_FLAG_KEY * f->key_frame; *got_packet = 1; return 0; }
false
FFmpeg
4bb1070c154e49d35805fbcdac9c9e92f702ef96
static int ffv1_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { FFV1Context *f = avctx->priv_data; RangeCoder *const c = &f->slice_context[0]->c; int used_count = 0; uint8_t keystate = 128; uint8_t *buf_p; int i, ret; f->frame = pict; if ((ret = ff_alloc_packet(pkt, avctx->width * avctx->height * ((8 * 2 + 1 + 1) * 4) / 8 + AV_INPUT_BUFFER_MIN_SIZE)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n"); return ret; } ff_init_range_encoder(c, pkt->data, pkt->size); ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8); if (avctx->gop_size == 0 || f->picture_number % avctx->gop_size == 0) { put_rac(c, &keystate, 1); f->key_frame = 1; f->gob_count++; write_header(f); } else { put_rac(c, &keystate, 0); f->key_frame = 0; } if (f->ac > 1) { int i; for (i = 1; i < 256; i++) { c->one_state[i] = f->state_transition[i]; c->zero_state[256 - i] = 256 - c->one_state[i]; } } for (i = 1; i < f->slice_count; i++) { FFV1Context *fs = f->slice_context[i]; uint8_t *start = pkt->data + (pkt->size - used_count) * (int64_t)i / f->slice_count; int len = pkt->size / f->slice_count; ff_init_range_encoder(&fs->c, start, len); } avctx->execute(avctx, encode_slice, &f->slice_context[0], NULL, f->slice_count, sizeof(void *)); buf_p = pkt->data; for (i = 0; i < f->slice_count; i++) { FFV1Context *fs = f->slice_context[i]; int bytes; if (fs->ac) { uint8_t state = 129; put_rac(&fs->c, &state, 0); bytes = ff_rac_terminate(&fs->c); } else { flush_put_bits(&fs->pb); bytes = fs->ac_byte_count + (put_bits_count(&fs->pb) + 7) / 8; } if (i > 0 || f->version > 2) { av_assert0(bytes < pkt->size / f->slice_count); memmove(buf_p, fs->c.bytestream_start, bytes); av_assert0(bytes < (1 << 24)); AV_WB24(buf_p + bytes, bytes); bytes += 3; } if (f->ec) { unsigned v; buf_p[bytes++] = 0; v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, buf_p, bytes); AV_WL32(buf_p + bytes, v); bytes += 4; } buf_p += bytes; } if ((avctx->flags & AV_CODEC_FLAG_PASS1) && (f->picture_number & 31) == 0) { int j, k, m; char *p = avctx->stats_out; char *end = p + STATS_OUT_SIZE; memset(f->rc_stat, 0, sizeof(f->rc_stat)); for (i = 0; i < f->quant_table_count; i++) memset(f->rc_stat2[i], 0, f->context_count[i] * sizeof(*f->rc_stat2[i])); for (j = 0; j < f->slice_count; j++) { FFV1Context *fs = f->slice_context[j]; for (i = 0; i < 256; i++) { f->rc_stat[i][0] += fs->rc_stat[i][0]; f->rc_stat[i][1] += fs->rc_stat[i][1]; } for (i = 0; i < f->quant_table_count; i++) { for (k = 0; k < f->context_count[i]; k++) for (m = 0; m < 32; m++) { f->rc_stat2[i][k][m][0] += fs->rc_stat2[i][k][m][0]; f->rc_stat2[i][k][m][1] += fs->rc_stat2[i][k][m][1]; } } } for (j = 0; j < 256; j++) { snprintf(p, end - p, "%" PRIu64 " %" PRIu64 " ", f->rc_stat[j][0], f->rc_stat[j][1]); p += strlen(p); } snprintf(p, end - p, "\n"); for (i = 0; i < f->quant_table_count; i++) { for (j = 0; j < f->context_count[i]; j++) for (m = 0; m < 32; m++) { snprintf(p, end - p, "%" PRIu64 " %" PRIu64 " ", f->rc_stat2[i][j][m][0], f->rc_stat2[i][j][m][1]); p += strlen(p); } } snprintf(p, end - p, "%d\n", f->gob_count); } else if (avctx->flags & AV_CODEC_FLAG_PASS1) avctx->stats_out[0] = '\0'; #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS avctx->coded_frame->key_frame = f->key_frame; FF_ENABLE_DEPRECATION_WARNINGS #endif f->picture_number++; pkt->size = buf_p - pkt->data; pkt->flags |= AV_PKT_FLAG_KEY * f->key_frame; *got_packet = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { FFV1Context *f = VAR_0->priv_data; RangeCoder *const c = &f->slice_context[0]->c; int VAR_4 = 0; uint8_t keystate = 128; uint8_t *buf_p; int VAR_7, VAR_6; f->frame = VAR_2; if ((VAR_6 = ff_alloc_packet(VAR_1, VAR_0->width * VAR_0->height * ((8 * 2 + 1 + 1) * 4) / 8 + AV_INPUT_BUFFER_MIN_SIZE)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "Error getting output packet.\n"); return VAR_6; } ff_init_range_encoder(c, VAR_1->data, VAR_1->size); ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8); if (VAR_0->gop_size == 0 || f->picture_number % VAR_0->gop_size == 0) { put_rac(c, &keystate, 1); f->key_frame = 1; f->gob_count++; write_header(f); } else { put_rac(c, &keystate, 0); f->key_frame = 0; } if (f->ac > 1) { int VAR_7; for (VAR_7 = 1; VAR_7 < 256; VAR_7++) { c->one_state[VAR_7] = f->state_transition[VAR_7]; c->zero_state[256 - VAR_7] = 256 - c->one_state[VAR_7]; } } for (VAR_7 = 1; VAR_7 < f->slice_count; VAR_7++) { FFV1Context *fs = f->slice_context[VAR_7]; uint8_t *start = VAR_1->data + (VAR_1->size - VAR_4) * (int64_t)VAR_7 / f->slice_count; int len = VAR_1->size / f->slice_count; ff_init_range_encoder(&fs->c, start, len); } VAR_0->execute(VAR_0, encode_slice, &f->slice_context[0], NULL, f->slice_count, sizeof(void *)); buf_p = VAR_1->data; for (VAR_7 = 0; VAR_7 < f->slice_count; VAR_7++) { FFV1Context *fs = f->slice_context[VAR_7]; int bytes; if (fs->ac) { uint8_t state = 129; put_rac(&fs->c, &state, 0); bytes = ff_rac_terminate(&fs->c); } else { flush_put_bits(&fs->pb); bytes = fs->ac_byte_count + (put_bits_count(&fs->pb) + 7) / 8; } if (VAR_7 > 0 || f->version > 2) { av_assert0(bytes < VAR_1->size / f->slice_count); memmove(buf_p, fs->c.bytestream_start, bytes); av_assert0(bytes < (1 << 24)); AV_WB24(buf_p + bytes, bytes); bytes += 3; } if (f->ec) { unsigned v; buf_p[bytes++] = 0; v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, buf_p, bytes); AV_WL32(buf_p + bytes, v); bytes += 4; } buf_p += bytes; } if ((VAR_0->flags & AV_CODEC_FLAG_PASS1) && (f->picture_number & 31) == 0) { int VAR_7, VAR_8, VAR_9; char *VAR_10 = VAR_0->stats_out; char *VAR_11 = VAR_10 + STATS_OUT_SIZE; memset(f->rc_stat, 0, sizeof(f->rc_stat)); for (VAR_7 = 0; VAR_7 < f->quant_table_count; VAR_7++) memset(f->rc_stat2[VAR_7], 0, f->context_count[VAR_7] * sizeof(*f->rc_stat2[VAR_7])); for (VAR_7 = 0; VAR_7 < f->slice_count; VAR_7++) { FFV1Context *fs = f->slice_context[VAR_7]; for (VAR_7 = 0; VAR_7 < 256; VAR_7++) { f->rc_stat[VAR_7][0] += fs->rc_stat[VAR_7][0]; f->rc_stat[VAR_7][1] += fs->rc_stat[VAR_7][1]; } for (VAR_7 = 0; VAR_7 < f->quant_table_count; VAR_7++) { for (VAR_8 = 0; VAR_8 < f->context_count[VAR_7]; VAR_8++) for (VAR_9 = 0; VAR_9 < 32; VAR_9++) { f->rc_stat2[VAR_7][VAR_8][VAR_9][0] += fs->rc_stat2[VAR_7][VAR_8][VAR_9][0]; f->rc_stat2[VAR_7][VAR_8][VAR_9][1] += fs->rc_stat2[VAR_7][VAR_8][VAR_9][1]; } } } for (VAR_7 = 0; VAR_7 < 256; VAR_7++) { snprintf(VAR_10, VAR_11 - VAR_10, "%" PRIu64 " %" PRIu64 " ", f->rc_stat[VAR_7][0], f->rc_stat[VAR_7][1]); VAR_10 += strlen(VAR_10); } snprintf(VAR_10, VAR_11 - VAR_10, "\n"); for (VAR_7 = 0; VAR_7 < f->quant_table_count; VAR_7++) { for (VAR_7 = 0; VAR_7 < f->context_count[VAR_7]; VAR_7++) for (VAR_9 = 0; VAR_9 < 32; VAR_9++) { snprintf(VAR_10, VAR_11 - VAR_10, "%" PRIu64 " %" PRIu64 " ", f->rc_stat2[VAR_7][VAR_7][VAR_9][0], f->rc_stat2[VAR_7][VAR_7][VAR_9][1]); VAR_10 += strlen(VAR_10); } } snprintf(VAR_10, VAR_11 - VAR_10, "%d\n", f->gob_count); } else if (VAR_0->flags & AV_CODEC_FLAG_PASS1) VAR_0->stats_out[0] = '\0'; #if FF_API_CODED_FRAME FF_DISABLE_DEPRECATION_WARNINGS VAR_0->coded_frame->key_frame = f->key_frame; FF_ENABLE_DEPRECATION_WARNINGS #endif f->picture_number++; VAR_1->size = buf_p - VAR_1->data; VAR_1->flags |= AV_PKT_FLAG_KEY * f->key_frame; *VAR_3 = 1; return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "FFV1Context *f = VAR_0->priv_data;", "RangeCoder *const c = &f->slice_context[0]->c;", "int VAR_4 = 0;", "uint8_t keystate = 128;", "uint8_t *buf_p;", "int VAR_7, VAR_6;", "f->frame = VAR_2;", "if ((VAR_6 = ff_alloc_packet(VAR_1, VAR_0->width * VAR_0->height *\n((8 * 2 + 1 + 1) * 4) / 8 +\nAV_INPUT_BUFFER_MIN_SIZE)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"Error getting output packet.\\n\");", "return VAR_6;", "}", "ff_init_range_encoder(c, VAR_1->data, VAR_1->size);", "ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);", "if (VAR_0->gop_size == 0 || f->picture_number % VAR_0->gop_size == 0) {", "put_rac(c, &keystate, 1);", "f->key_frame = 1;", "f->gob_count++;", "write_header(f);", "} else {", "put_rac(c, &keystate, 0);", "f->key_frame = 0;", "}", "if (f->ac > 1) {", "int VAR_7;", "for (VAR_7 = 1; VAR_7 < 256; VAR_7++) {", "c->one_state[VAR_7] = f->state_transition[VAR_7];", "c->zero_state[256 - VAR_7] = 256 - c->one_state[VAR_7];", "}", "}", "for (VAR_7 = 1; VAR_7 < f->slice_count; VAR_7++) {", "FFV1Context *fs = f->slice_context[VAR_7];", "uint8_t *start = VAR_1->data +\n(VAR_1->size - VAR_4) * (int64_t)VAR_7 / f->slice_count;", "int len = VAR_1->size / f->slice_count;", "ff_init_range_encoder(&fs->c, start, len);", "}", "VAR_0->execute(VAR_0, encode_slice, &f->slice_context[0], NULL,\nf->slice_count, sizeof(void *));", "buf_p = VAR_1->data;", "for (VAR_7 = 0; VAR_7 < f->slice_count; VAR_7++) {", "FFV1Context *fs = f->slice_context[VAR_7];", "int bytes;", "if (fs->ac) {", "uint8_t state = 129;", "put_rac(&fs->c, &state, 0);", "bytes = ff_rac_terminate(&fs->c);", "} else {", "flush_put_bits(&fs->pb);", "bytes = fs->ac_byte_count + (put_bits_count(&fs->pb) + 7) / 8;", "}", "if (VAR_7 > 0 || f->version > 2) {", "av_assert0(bytes < VAR_1->size / f->slice_count);", "memmove(buf_p, fs->c.bytestream_start, bytes);", "av_assert0(bytes < (1 << 24));", "AV_WB24(buf_p + bytes, bytes);", "bytes += 3;", "}", "if (f->ec) {", "unsigned v;", "buf_p[bytes++] = 0;", "v = av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, buf_p, bytes);", "AV_WL32(buf_p + bytes, v);", "bytes += 4;", "}", "buf_p += bytes;", "}", "if ((VAR_0->flags & AV_CODEC_FLAG_PASS1) && (f->picture_number & 31) == 0) {", "int VAR_7, VAR_8, VAR_9;", "char *VAR_10 = VAR_0->stats_out;", "char *VAR_11 = VAR_10 + STATS_OUT_SIZE;", "memset(f->rc_stat, 0, sizeof(f->rc_stat));", "for (VAR_7 = 0; VAR_7 < f->quant_table_count; VAR_7++)", "memset(f->rc_stat2[VAR_7], 0, f->context_count[VAR_7] * sizeof(*f->rc_stat2[VAR_7]));", "for (VAR_7 = 0; VAR_7 < f->slice_count; VAR_7++) {", "FFV1Context *fs = f->slice_context[VAR_7];", "for (VAR_7 = 0; VAR_7 < 256; VAR_7++) {", "f->rc_stat[VAR_7][0] += fs->rc_stat[VAR_7][0];", "f->rc_stat[VAR_7][1] += fs->rc_stat[VAR_7][1];", "}", "for (VAR_7 = 0; VAR_7 < f->quant_table_count; VAR_7++) {", "for (VAR_8 = 0; VAR_8 < f->context_count[VAR_7]; VAR_8++)", "for (VAR_9 = 0; VAR_9 < 32; VAR_9++) {", "f->rc_stat2[VAR_7][VAR_8][VAR_9][0] += fs->rc_stat2[VAR_7][VAR_8][VAR_9][0];", "f->rc_stat2[VAR_7][VAR_8][VAR_9][1] += fs->rc_stat2[VAR_7][VAR_8][VAR_9][1];", "}", "}", "}", "for (VAR_7 = 0; VAR_7 < 256; VAR_7++) {", "snprintf(VAR_10, VAR_11 - VAR_10, \"%\" PRIu64 \" %\" PRIu64 \" \",\nf->rc_stat[VAR_7][0], f->rc_stat[VAR_7][1]);", "VAR_10 += strlen(VAR_10);", "}", "snprintf(VAR_10, VAR_11 - VAR_10, \"\\n\");", "for (VAR_7 = 0; VAR_7 < f->quant_table_count; VAR_7++) {", "for (VAR_7 = 0; VAR_7 < f->context_count[VAR_7]; VAR_7++)", "for (VAR_9 = 0; VAR_9 < 32; VAR_9++) {", "snprintf(VAR_10, VAR_11 - VAR_10, \"%\" PRIu64 \" %\" PRIu64 \" \",\nf->rc_stat2[VAR_7][VAR_7][VAR_9][0], f->rc_stat2[VAR_7][VAR_7][VAR_9][1]);", "VAR_10 += strlen(VAR_10);", "}", "}", "snprintf(VAR_10, VAR_11 - VAR_10, \"%d\\n\", f->gob_count);", "} else if (VAR_0->flags & AV_CODEC_FLAG_PASS1)", "VAR_0->stats_out[0] = '\\0';", "#if FF_API_CODED_FRAME\nFF_DISABLE_DEPRECATION_WARNINGS\nVAR_0->coded_frame->key_frame = f->key_frame;", "FF_ENABLE_DEPRECATION_WARNINGS\n#endif\nf->picture_number++;", "VAR_1->size = buf_p - VAR_1->data;", "VAR_1->flags |= AV_PKT_FLAG_KEY * f->key_frame;", "*VAR_3 = 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 25, 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95, 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227 ], [ 229, 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247, 249, 251 ], [ 253, 255, 259 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ] ]
8,280
static void setup_frame(int usig, struct emulated_sigaction *ka, target_sigset_t *set, CPUState *regs) { struct sigframe *frame; abi_ulong frame_addr = get_sigframe(ka, regs, sizeof(*frame)); int i, err = 0; if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) return; err |= setup_sigcontext(&frame->sc, /*&frame->fpstate,*/ regs, set->sig[0]); for(i = 1; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->extramask[i - 1])) goto end; } if (err == 0) err = setup_return(regs, ka, &frame->retcode, frame, usig); end: unlock_user_struct(frame, frame_addr, 1); // return err; }
false
qemu
f8b0aa25599782eef91edc00ebf620bd14db720c
static void setup_frame(int usig, struct emulated_sigaction *ka, target_sigset_t *set, CPUState *regs) { struct sigframe *frame; abi_ulong frame_addr = get_sigframe(ka, regs, sizeof(*frame)); int i, err = 0; if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) return; err |= setup_sigcontext(&frame->sc, regs, set->sig[0]); for(i = 1; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->extramask[i - 1])) goto end; } if (err == 0) err = setup_return(regs, ka, &frame->retcode, frame, usig); end: unlock_user_struct(frame, frame_addr, 1); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, struct emulated_sigaction *VAR_1, target_sigset_t *VAR_2, CPUState *VAR_3) { struct sigframe *VAR_4; abi_ulong frame_addr = get_sigframe(VAR_1, VAR_3, sizeof(*VAR_4)); int VAR_5, VAR_6 = 0; if (!lock_user_struct(VERIFY_WRITE, VAR_4, frame_addr, 0)) return; VAR_6 |= setup_sigcontext(&VAR_4->sc, VAR_3, VAR_2->sig[0]); for(VAR_5 = 1; VAR_5 < TARGET_NSIG_WORDS; VAR_5++) { if (__put_user(VAR_2->sig[VAR_5], &VAR_4->extramask[VAR_5 - 1])) goto end; } if (VAR_6 == 0) VAR_6 = setup_return(VAR_3, VAR_1, &VAR_4->retcode, VAR_4, VAR_0); end: unlock_user_struct(VAR_4, frame_addr, 1); }
[ "static void FUNC_0(int VAR_0, struct emulated_sigaction *VAR_1,\ntarget_sigset_t *VAR_2, CPUState *VAR_3)\n{", "struct sigframe *VAR_4;", "abi_ulong frame_addr = get_sigframe(VAR_1, VAR_3, sizeof(*VAR_4));", "int VAR_5, VAR_6 = 0;", "if (!lock_user_struct(VERIFY_WRITE, VAR_4, frame_addr, 0))\nreturn;", "VAR_6 |= setup_sigcontext(&VAR_4->sc, VAR_3, VAR_2->sig[0]);", "for(VAR_5 = 1; VAR_5 < TARGET_NSIG_WORDS; VAR_5++) {", "if (__put_user(VAR_2->sig[VAR_5], &VAR_4->extramask[VAR_5 - 1]))\ngoto end;", "}", "if (VAR_6 == 0)\nVAR_6 = setup_return(VAR_3, VAR_1, &VAR_4->retcode, VAR_4, VAR_0);", "end:\nunlock_user_struct(VAR_4, frame_addr, 1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 35, 37 ], [ 41, 43 ], [ 47 ] ]
8,281
int qemu_uuid_parse(const char *str, uint8_t *uuid) { int ret; if(strlen(str) != 36) return -1; ret = sscanf(str, UUID_FMT, &uuid[0], &uuid[1], &uuid[2], &uuid[3], &uuid[4], &uuid[5], &uuid[6], &uuid[7], &uuid[8], &uuid[9], &uuid[10], &uuid[11], &uuid[12], &uuid[13], &uuid[14], &uuid[15]); if(ret != 16) return -1; #ifdef TARGET_I386 smbios_add_field(1, offsetof(struct smbios_type_1, uuid), 16, uuid); #endif return 0; }
false
qemu
ad96090a01d848df67d70c5259ed8aa321fa8716
int qemu_uuid_parse(const char *str, uint8_t *uuid) { int ret; if(strlen(str) != 36) return -1; ret = sscanf(str, UUID_FMT, &uuid[0], &uuid[1], &uuid[2], &uuid[3], &uuid[4], &uuid[5], &uuid[6], &uuid[7], &uuid[8], &uuid[9], &uuid[10], &uuid[11], &uuid[12], &uuid[13], &uuid[14], &uuid[15]); if(ret != 16) return -1; #ifdef TARGET_I386 smbios_add_field(1, offsetof(struct smbios_type_1, uuid), 16, uuid); #endif return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(const char *VAR_0, uint8_t *VAR_1) { int VAR_2; if(strlen(VAR_0) != 36) return -1; VAR_2 = sscanf(VAR_0, UUID_FMT, &VAR_1[0], &VAR_1[1], &VAR_1[2], &VAR_1[3], &VAR_1[4], &VAR_1[5], &VAR_1[6], &VAR_1[7], &VAR_1[8], &VAR_1[9], &VAR_1[10], &VAR_1[11], &VAR_1[12], &VAR_1[13], &VAR_1[14], &VAR_1[15]); if(VAR_2 != 16) return -1; #ifdef TARGET_I386 smbios_add_field(1, offsetof(struct smbios_type_1, VAR_1), 16, VAR_1); #endif return 0; }
[ "int FUNC_0(const char *VAR_0, uint8_t *VAR_1)\n{", "int VAR_2;", "if(strlen(VAR_0) != 36)\nreturn -1;", "VAR_2 = sscanf(VAR_0, UUID_FMT, &VAR_1[0], &VAR_1[1], &VAR_1[2], &VAR_1[3],\n&VAR_1[4], &VAR_1[5], &VAR_1[6], &VAR_1[7], &VAR_1[8], &VAR_1[9],\n&VAR_1[10], &VAR_1[11], &VAR_1[12], &VAR_1[13], &VAR_1[14], &VAR_1[15]);", "if(VAR_2 != 16)\nreturn -1;", "#ifdef TARGET_I386\nsmbios_add_field(1, offsetof(struct smbios_type_1, VAR_1), 16, VAR_1);", "#endif\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 15, 17, 19 ], [ 23, 25 ], [ 29, 31 ], [ 33, 37 ], [ 39 ] ]
8,282
QError *qerror_from_info(const char *file, int linenr, const char *func, const char *fmt, va_list *va) { QError *qerr; qerr = qerror_new(); loc_save(&qerr->loc); qerr->linenr = linenr; qerr->file = file; qerr->func = func; if (!fmt) { qerror_abort(qerr, "QDict not specified"); } qerror_set_data(qerr, fmt, va); qerror_set_desc(qerr, fmt); return qerr; }
false
qemu
2a74440547ea0a15195224fa2b7784b267cbfe15
QError *qerror_from_info(const char *file, int linenr, const char *func, const char *fmt, va_list *va) { QError *qerr; qerr = qerror_new(); loc_save(&qerr->loc); qerr->linenr = linenr; qerr->file = file; qerr->func = func; if (!fmt) { qerror_abort(qerr, "QDict not specified"); } qerror_set_data(qerr, fmt, va); qerror_set_desc(qerr, fmt); return qerr; }
{ "code": [], "line_no": [] }
QError *FUNC_0(const char *file, int linenr, const char *func, const char *fmt, va_list *va) { QError *qerr; qerr = qerror_new(); loc_save(&qerr->loc); qerr->linenr = linenr; qerr->file = file; qerr->func = func; if (!fmt) { qerror_abort(qerr, "QDict not specified"); } qerror_set_data(qerr, fmt, va); qerror_set_desc(qerr, fmt); return qerr; }
[ "QError *FUNC_0(const char *file, int linenr, const char *func,\nconst char *fmt, va_list *va)\n{", "QError *qerr;", "qerr = qerror_new();", "loc_save(&qerr->loc);", "qerr->linenr = linenr;", "qerr->file = file;", "qerr->func = func;", "if (!fmt) {", "qerror_abort(qerr, \"QDict not specified\");", "}", "qerror_set_data(qerr, fmt, va);", "qerror_set_desc(qerr, fmt);", "return qerr;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ] ]
8,283
fork_exec(struct socket *so, const char *ex, int do_pty) { int s; struct sockaddr_in addr; int addrlen = sizeof(addr); int opt; int master = -1; char *argv[256]; #if 0 char buff[256]; #endif /* don't want to clobber the original */ char *bptr; const char *curarg; int c, i, ret; DEBUG_CALL("fork_exec"); DEBUG_ARG("so = %lx", (long)so); DEBUG_ARG("ex = %lx", (long)ex); DEBUG_ARG("do_pty = %lx", (long)do_pty); if (do_pty == 2) { #if 0 if (slirp_openpty(&master, &s) == -1) { lprint("Error: openpty failed: %s\n", strerror(errno)); return 0; } #else return 0; #endif } else { addr.sin_family = AF_INET; addr.sin_port = 0; addr.sin_addr.s_addr = INADDR_ANY; if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0 || bind(s, (struct sockaddr *)&addr, addrlen) < 0 || listen(s, 1) < 0) { lprint("Error: inet socket: %s\n", strerror(errno)); closesocket(s); return 0; } } switch(fork()) { case -1: lprint("Error: fork failed: %s\n", strerror(errno)); close(s); if (do_pty == 2) close(master); return 0; case 0: /* Set the DISPLAY */ if (do_pty == 2) { (void) close(master); #ifdef TIOCSCTTY /* XXXXX */ (void) setsid(); ioctl(s, TIOCSCTTY, (char *)NULL); #endif } else { getsockname(s, (struct sockaddr *)&addr, &addrlen); close(s); /* * Connect to the socket * XXX If any of these fail, we're in trouble! */ s = socket(AF_INET, SOCK_STREAM, 0); addr.sin_addr = loopback_addr; do { ret = connect(s, (struct sockaddr *)&addr, addrlen); } while (ret < 0 && errno == EINTR); } #if 0 if (x_port >= 0) { #ifdef HAVE_SETENV sprintf(buff, "%s:%d.%d", inet_ntoa(our_addr), x_port, x_screen); setenv("DISPLAY", buff, 1); #else sprintf(buff, "DISPLAY=%s:%d.%d", inet_ntoa(our_addr), x_port, x_screen); putenv(buff); #endif } #endif dup2(s, 0); dup2(s, 1); dup2(s, 2); for (s = getdtablesize() - 1; s >= 3; s--) close(s); i = 0; bptr = strdup(ex); /* No need to free() this */ if (do_pty == 1) { /* Setup "slirp.telnetd -x" */ argv[i++] = "slirp.telnetd"; argv[i++] = "-x"; argv[i++] = bptr; } else do { /* Change the string into argv[] */ curarg = bptr; while (*bptr != ' ' && *bptr != (char)0) bptr++; c = *bptr; *bptr++ = (char)0; argv[i++] = strdup(curarg); } while (c); argv[i] = 0; execvp(argv[0], argv); /* Ooops, failed, let's tell the user why */ { char buff[256]; sprintf(buff, "Error: execvp of %s failed: %s\n", argv[0], strerror(errno)); write(2, buff, strlen(buff)+1); } close(0); close(1); close(2); /* XXX */ exit(1); default: if (do_pty == 2) { close(s); so->s = master; } else { /* * XXX this could block us... * XXX Should set a timer here, and if accept() doesn't * return after X seconds, declare it a failure * The only reason this will block forever is if socket() * of connect() fail in the child process */ do { so->s = accept(s, (struct sockaddr *)&addr, &addrlen); } while (so->s < 0 && errno == EINTR); closesocket(s); opt = 1; setsockopt(so->s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)); opt = 1; setsockopt(so->s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int)); } fd_nonblock(so->s); /* Append the telnet options now */ if (so->so_m != 0 && do_pty == 1) { sbappend(so, so->so_m); so->so_m = 0; } return 1; } }
false
qemu
242acf3af4605adce933906bdc053b2414181ec7
fork_exec(struct socket *so, const char *ex, int do_pty) { int s; struct sockaddr_in addr; int addrlen = sizeof(addr); int opt; int master = -1; char *argv[256]; #if 0 char buff[256]; #endif char *bptr; const char *curarg; int c, i, ret; DEBUG_CALL("fork_exec"); DEBUG_ARG("so = %lx", (long)so); DEBUG_ARG("ex = %lx", (long)ex); DEBUG_ARG("do_pty = %lx", (long)do_pty); if (do_pty == 2) { #if 0 if (slirp_openpty(&master, &s) == -1) { lprint("Error: openpty failed: %s\n", strerror(errno)); return 0; } #else return 0; #endif } else { addr.sin_family = AF_INET; addr.sin_port = 0; addr.sin_addr.s_addr = INADDR_ANY; if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0 || bind(s, (struct sockaddr *)&addr, addrlen) < 0 || listen(s, 1) < 0) { lprint("Error: inet socket: %s\n", strerror(errno)); closesocket(s); return 0; } } switch(fork()) { case -1: lprint("Error: fork failed: %s\n", strerror(errno)); close(s); if (do_pty == 2) close(master); return 0; case 0: if (do_pty == 2) { (void) close(master); #ifdef TIOCSCTTY (void) setsid(); ioctl(s, TIOCSCTTY, (char *)NULL); #endif } else { getsockname(s, (struct sockaddr *)&addr, &addrlen); close(s); s = socket(AF_INET, SOCK_STREAM, 0); addr.sin_addr = loopback_addr; do { ret = connect(s, (struct sockaddr *)&addr, addrlen); } while (ret < 0 && errno == EINTR); } #if 0 if (x_port >= 0) { #ifdef HAVE_SETENV sprintf(buff, "%s:%d.%d", inet_ntoa(our_addr), x_port, x_screen); setenv("DISPLAY", buff, 1); #else sprintf(buff, "DISPLAY=%s:%d.%d", inet_ntoa(our_addr), x_port, x_screen); putenv(buff); #endif } #endif dup2(s, 0); dup2(s, 1); dup2(s, 2); for (s = getdtablesize() - 1; s >= 3; s--) close(s); i = 0; bptr = strdup(ex); if (do_pty == 1) { argv[i++] = "slirp.telnetd"; argv[i++] = "-x"; argv[i++] = bptr; } else do { curarg = bptr; while (*bptr != ' ' && *bptr != (char)0) bptr++; c = *bptr; *bptr++ = (char)0; argv[i++] = strdup(curarg); } while (c); argv[i] = 0; execvp(argv[0], argv); { char buff[256]; sprintf(buff, "Error: execvp of %s failed: %s\n", argv[0], strerror(errno)); write(2, buff, strlen(buff)+1); } close(0); close(1); close(2); exit(1); default: if (do_pty == 2) { close(s); so->s = master; } else { do { so->s = accept(s, (struct sockaddr *)&addr, &addrlen); } while (so->s < 0 && errno == EINTR); closesocket(s); opt = 1; setsockopt(so->s,SOL_SOCKET,SO_REUSEADDR,(char *)&opt,sizeof(int)); opt = 1; setsockopt(so->s,SOL_SOCKET,SO_OOBINLINE,(char *)&opt,sizeof(int)); } fd_nonblock(so->s); if (so->so_m != 0 && do_pty == 1) { sbappend(so, so->so_m); so->so_m = 0; } return 1; } }
{ "code": [], "line_no": [] }
FUNC_0(struct socket *VAR_0, const char *VAR_1, int VAR_2) { int VAR_3; struct sockaddr_in VAR_4; int VAR_5 = sizeof(VAR_4); int VAR_6; int VAR_7 = -1; char *VAR_8[256]; #if 0 char VAR_14[256]; #endif char *VAR_9; const char *VAR_10; int VAR_11, VAR_12, VAR_13; DEBUG_CALL("FUNC_0"); DEBUG_ARG("VAR_0 = %lx", (long)VAR_0); DEBUG_ARG("VAR_1 = %lx", (long)VAR_1); DEBUG_ARG("VAR_2 = %lx", (long)VAR_2); if (VAR_2 == 2) { #if 0 if (slirp_openpty(&VAR_7, &VAR_3) == -1) { lprint("Error: openpty failed: %VAR_3\n", strerror(errno)); return 0; } #else return 0; #endif } else { VAR_4.sin_family = AF_INET; VAR_4.sin_port = 0; VAR_4.sin_addr.s_addr = INADDR_ANY; if ((VAR_3 = socket(AF_INET, SOCK_STREAM, 0)) < 0 || bind(VAR_3, (struct sockaddr *)&VAR_4, VAR_5) < 0 || listen(VAR_3, 1) < 0) { lprint("Error: inet socket: %VAR_3\n", strerror(errno)); closesocket(VAR_3); return 0; } } switch(fork()) { case -1: lprint("Error: fork failed: %VAR_3\n", strerror(errno)); close(VAR_3); if (VAR_2 == 2) close(VAR_7); return 0; case 0: if (VAR_2 == 2) { (void) close(VAR_7); #ifdef TIOCSCTTY (void) setsid(); ioctl(VAR_3, TIOCSCTTY, (char *)NULL); #endif } else { getsockname(VAR_3, (struct sockaddr *)&VAR_4, &VAR_5); close(VAR_3); VAR_3 = socket(AF_INET, SOCK_STREAM, 0); VAR_4.sin_addr = loopback_addr; do { VAR_13 = connect(VAR_3, (struct sockaddr *)&VAR_4, VAR_5); } while (VAR_13 < 0 && errno == EINTR); } #if 0 if (x_port >= 0) { #ifdef HAVE_SETENV sprintf(VAR_14, "%VAR_3:%d.%d", inet_ntoa(our_addr), x_port, x_screen); setenv("DISPLAY", VAR_14, 1); #else sprintf(VAR_14, "DISPLAY=%VAR_3:%d.%d", inet_ntoa(our_addr), x_port, x_screen); putenv(VAR_14); #endif } #endif dup2(VAR_3, 0); dup2(VAR_3, 1); dup2(VAR_3, 2); for (VAR_3 = getdtablesize() - 1; VAR_3 >= 3; VAR_3--) close(VAR_3); VAR_12 = 0; VAR_9 = strdup(VAR_1); if (VAR_2 == 1) { VAR_8[VAR_12++] = "slirp.telnetd"; VAR_8[VAR_12++] = "-x"; VAR_8[VAR_12++] = VAR_9; } else do { VAR_10 = VAR_9; while (*VAR_9 != ' ' && *VAR_9 != (char)0) VAR_9++; VAR_11 = *VAR_9; *VAR_9++ = (char)0; VAR_8[VAR_12++] = strdup(VAR_10); } while (VAR_11); VAR_8[VAR_12] = 0; execvp(VAR_8[0], VAR_8); { char VAR_14[256]; sprintf(VAR_14, "Error: execvp of %VAR_3 failed: %VAR_3\n", VAR_8[0], strerror(errno)); write(2, VAR_14, strlen(VAR_14)+1); } close(0); close(1); close(2); exit(1); default: if (VAR_2 == 2) { close(VAR_3); VAR_0->VAR_3 = VAR_7; } else { do { VAR_0->VAR_3 = accept(VAR_3, (struct sockaddr *)&VAR_4, &VAR_5); } while (VAR_0->VAR_3 < 0 && errno == EINTR); closesocket(VAR_3); VAR_6 = 1; setsockopt(VAR_0->VAR_3,SOL_SOCKET,SO_REUSEADDR,(char *)&VAR_6,sizeof(int)); VAR_6 = 1; setsockopt(VAR_0->VAR_3,SOL_SOCKET,SO_OOBINLINE,(char *)&VAR_6,sizeof(int)); } fd_nonblock(VAR_0->VAR_3); if (VAR_0->so_m != 0 && VAR_2 == 1) { sbappend(VAR_0, VAR_0->so_m); VAR_0->so_m = 0; } return 1; } }
[ "FUNC_0(struct socket *VAR_0, const char *VAR_1, int VAR_2)\n{", "int VAR_3;", "struct sockaddr_in VAR_4;", "int VAR_5 = sizeof(VAR_4);", "int VAR_6;", "int VAR_7 = -1;", "char *VAR_8[256];", "#if 0\nchar VAR_14[256];", "#endif\nchar *VAR_9;", "const char *VAR_10;", "int VAR_11, VAR_12, VAR_13;", "DEBUG_CALL(\"FUNC_0\");", "DEBUG_ARG(\"VAR_0 = %lx\", (long)VAR_0);", "DEBUG_ARG(\"VAR_1 = %lx\", (long)VAR_1);", "DEBUG_ARG(\"VAR_2 = %lx\", (long)VAR_2);", "if (VAR_2 == 2) {", "#if 0\nif (slirp_openpty(&VAR_7, &VAR_3) == -1) {", "lprint(\"Error: openpty failed: %VAR_3\\n\", strerror(errno));", "return 0;", "}", "#else\nreturn 0;", "#endif\n} else {", "VAR_4.sin_family = AF_INET;", "VAR_4.sin_port = 0;", "VAR_4.sin_addr.s_addr = INADDR_ANY;", "if ((VAR_3 = socket(AF_INET, SOCK_STREAM, 0)) < 0 ||\nbind(VAR_3, (struct sockaddr *)&VAR_4, VAR_5) < 0 ||\nlisten(VAR_3, 1) < 0) {", "lprint(\"Error: inet socket: %VAR_3\\n\", strerror(errno));", "closesocket(VAR_3);", "return 0;", "}", "}", "switch(fork()) {", "case -1:\nlprint(\"Error: fork failed: %VAR_3\\n\", strerror(errno));", "close(VAR_3);", "if (VAR_2 == 2)\nclose(VAR_7);", "return 0;", "case 0:\nif (VAR_2 == 2) {", "(void) close(VAR_7);", "#ifdef TIOCSCTTY\n(void) setsid();", "ioctl(VAR_3, TIOCSCTTY, (char *)NULL);", "#endif\n} else {", "getsockname(VAR_3, (struct sockaddr *)&VAR_4, &VAR_5);", "close(VAR_3);", "VAR_3 = socket(AF_INET, SOCK_STREAM, 0);", "VAR_4.sin_addr = loopback_addr;", "do {", "VAR_13 = connect(VAR_3, (struct sockaddr *)&VAR_4, VAR_5);", "} while (VAR_13 < 0 && errno == EINTR);", "}", "#if 0\nif (x_port >= 0) {", "#ifdef HAVE_SETENV\nsprintf(VAR_14, \"%VAR_3:%d.%d\", inet_ntoa(our_addr), x_port, x_screen);", "setenv(\"DISPLAY\", VAR_14, 1);", "#else\nsprintf(VAR_14, \"DISPLAY=%VAR_3:%d.%d\", inet_ntoa(our_addr), x_port, x_screen);", "putenv(VAR_14);", "#endif\n}", "#endif\ndup2(VAR_3, 0);", "dup2(VAR_3, 1);", "dup2(VAR_3, 2);", "for (VAR_3 = getdtablesize() - 1; VAR_3 >= 3; VAR_3--)", "close(VAR_3);", "VAR_12 = 0;", "VAR_9 = strdup(VAR_1);", "if (VAR_2 == 1) {", "VAR_8[VAR_12++] = \"slirp.telnetd\";", "VAR_8[VAR_12++] = \"-x\";", "VAR_8[VAR_12++] = VAR_9;", "} else", "do {", "VAR_10 = VAR_9;", "while (*VAR_9 != ' ' && *VAR_9 != (char)0)\nVAR_9++;", "VAR_11 = *VAR_9;", "*VAR_9++ = (char)0;", "VAR_8[VAR_12++] = strdup(VAR_10);", "} while (VAR_11);", "VAR_8[VAR_12] = 0;", "execvp(VAR_8[0], VAR_8);", "{", "char VAR_14[256];", "sprintf(VAR_14, \"Error: execvp of %VAR_3 failed: %VAR_3\\n\",\nVAR_8[0], strerror(errno));", "write(2, VAR_14, strlen(VAR_14)+1);", "}", "close(0); close(1); close(2);", "exit(1);", "default:\nif (VAR_2 == 2) {", "close(VAR_3);", "VAR_0->VAR_3 = VAR_7;", "} else {", "do {", "VAR_0->VAR_3 = accept(VAR_3, (struct sockaddr *)&VAR_4, &VAR_5);", "} while (VAR_0->VAR_3 < 0 && errno == EINTR);", "closesocket(VAR_3);", "VAR_6 = 1;", "setsockopt(VAR_0->VAR_3,SOL_SOCKET,SO_REUSEADDR,(char *)&VAR_6,sizeof(int));", "VAR_6 = 1;", "setsockopt(VAR_0->VAR_3,SOL_SOCKET,SO_OOBINLINE,(char *)&VAR_6,sizeof(int));", "}", "fd_nonblock(VAR_0->VAR_3);", "if (VAR_0->so_m != 0 && VAR_2 == 1) {", "sbappend(VAR_0, VAR_0->so_m);", "VAR_0->so_m = 0;", "}", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71, 73, 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 107, 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151, 153 ], [ 155, 157 ], [ 159 ], [ 161, 163 ], [ 165 ], [ 167, 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185 ], [ 187 ], [ 189 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 221 ], [ 223 ], [ 229 ], [ 231 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 307 ], [ 309 ], [ 311 ] ]
8,285
static int bmdma_prepare_buf(IDEDMA *dma, int is_write) { BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma); IDEState *s = bmdma_active_if(bm); struct { uint32_t addr; uint32_t size; } prd; int l, len; qemu_sglist_init(&s->sg, s->nsector / (BMDMA_PAGE_SIZE / 512) + 1); s->io_buffer_size = 0; for(;;) { if (bm->cur_prd_len == 0) { /* end of table (with a fail safe of one page) */ if (bm->cur_prd_last || (bm->cur_addr - bm->addr) >= BMDMA_PAGE_SIZE) return s->io_buffer_size != 0; cpu_physical_memory_read(bm->cur_addr, (uint8_t *)&prd, 8); bm->cur_addr += 8; prd.addr = le32_to_cpu(prd.addr); prd.size = le32_to_cpu(prd.size); len = prd.size & 0xfffe; if (len == 0) len = 0x10000; bm->cur_prd_len = len; bm->cur_prd_addr = prd.addr; bm->cur_prd_last = (prd.size & 0x80000000); } l = bm->cur_prd_len; if (l > 0) { qemu_sglist_add(&s->sg, bm->cur_prd_addr, l); bm->cur_prd_addr += l; bm->cur_prd_len -= l; s->io_buffer_size += l; } } return 1; }
false
qemu
552908fef5b67ad9d96b76d7cb8371ebc26c9bc8
static int bmdma_prepare_buf(IDEDMA *dma, int is_write) { BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma); IDEState *s = bmdma_active_if(bm); struct { uint32_t addr; uint32_t size; } prd; int l, len; qemu_sglist_init(&s->sg, s->nsector / (BMDMA_PAGE_SIZE / 512) + 1); s->io_buffer_size = 0; for(;;) { if (bm->cur_prd_len == 0) { if (bm->cur_prd_last || (bm->cur_addr - bm->addr) >= BMDMA_PAGE_SIZE) return s->io_buffer_size != 0; cpu_physical_memory_read(bm->cur_addr, (uint8_t *)&prd, 8); bm->cur_addr += 8; prd.addr = le32_to_cpu(prd.addr); prd.size = le32_to_cpu(prd.size); len = prd.size & 0xfffe; if (len == 0) len = 0x10000; bm->cur_prd_len = len; bm->cur_prd_addr = prd.addr; bm->cur_prd_last = (prd.size & 0x80000000); } l = bm->cur_prd_len; if (l > 0) { qemu_sglist_add(&s->sg, bm->cur_prd_addr, l); bm->cur_prd_addr += l; bm->cur_prd_len -= l; s->io_buffer_size += l; } } return 1; }
{ "code": [], "line_no": [] }
static int FUNC_0(IDEDMA *VAR_0, int VAR_1) { BMDMAState *bm = DO_UPCAST(BMDMAState, VAR_0, VAR_0); IDEState *s = bmdma_active_if(bm); struct { uint32_t addr; uint32_t size; } VAR_2; int VAR_3, VAR_4; qemu_sglist_init(&s->sg, s->nsector / (BMDMA_PAGE_SIZE / 512) + 1); s->io_buffer_size = 0; for(;;) { if (bm->cur_prd_len == 0) { if (bm->cur_prd_last || (bm->cur_addr - bm->addr) >= BMDMA_PAGE_SIZE) return s->io_buffer_size != 0; cpu_physical_memory_read(bm->cur_addr, (uint8_t *)&VAR_2, 8); bm->cur_addr += 8; VAR_2.addr = le32_to_cpu(VAR_2.addr); VAR_2.size = le32_to_cpu(VAR_2.size); VAR_4 = VAR_2.size & 0xfffe; if (VAR_4 == 0) VAR_4 = 0x10000; bm->cur_prd_len = VAR_4; bm->cur_prd_addr = VAR_2.addr; bm->cur_prd_last = (VAR_2.size & 0x80000000); } VAR_3 = bm->cur_prd_len; if (VAR_3 > 0) { qemu_sglist_add(&s->sg, bm->cur_prd_addr, VAR_3); bm->cur_prd_addr += VAR_3; bm->cur_prd_len -= VAR_3; s->io_buffer_size += VAR_3; } } return 1; }
[ "static int FUNC_0(IDEDMA *VAR_0, int VAR_1)\n{", "BMDMAState *bm = DO_UPCAST(BMDMAState, VAR_0, VAR_0);", "IDEState *s = bmdma_active_if(bm);", "struct {", "uint32_t addr;", "uint32_t size;", "} VAR_2;", "int VAR_3, VAR_4;", "qemu_sglist_init(&s->sg, s->nsector / (BMDMA_PAGE_SIZE / 512) + 1);", "s->io_buffer_size = 0;", "for(;;) {", "if (bm->cur_prd_len == 0) {", "if (bm->cur_prd_last ||\n(bm->cur_addr - bm->addr) >= BMDMA_PAGE_SIZE)\nreturn s->io_buffer_size != 0;", "cpu_physical_memory_read(bm->cur_addr, (uint8_t *)&VAR_2, 8);", "bm->cur_addr += 8;", "VAR_2.addr = le32_to_cpu(VAR_2.addr);", "VAR_2.size = le32_to_cpu(VAR_2.size);", "VAR_4 = VAR_2.size & 0xfffe;", "if (VAR_4 == 0)\nVAR_4 = 0x10000;", "bm->cur_prd_len = VAR_4;", "bm->cur_prd_addr = VAR_2.addr;", "bm->cur_prd_last = (VAR_2.size & 0x80000000);", "}", "VAR_3 = bm->cur_prd_len;", "if (VAR_3 > 0) {", "qemu_sglist_add(&s->sg, bm->cur_prd_addr, VAR_3);", "bm->cur_prd_addr += VAR_3;", "bm->cur_prd_len -= VAR_3;", "s->io_buffer_size += VAR_3;", "}", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31, 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ] ]
8,286
void timer_mod(QEMUTimer *ts, int64_t expire_time) { timer_mod_ns(ts, expire_time * ts->scale); }
false
qemu
c2b38b277a7882a592f4f2ec955084b2b756daaa
void timer_mod(QEMUTimer *ts, int64_t expire_time) { timer_mod_ns(ts, expire_time * ts->scale); }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUTimer *VAR_0, int64_t VAR_1) { timer_mod_ns(VAR_0, VAR_1 * VAR_0->scale); }
[ "void FUNC_0(QEMUTimer *VAR_0, int64_t VAR_1)\n{", "timer_mod_ns(VAR_0, VAR_1 * VAR_0->scale);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
8,287
ram_addr_t qemu_ram_alloc_from_ptr(DeviceState *dev, const char *name, ram_addr_t size, void *host) { RAMBlock *new_block, *block; size = TARGET_PAGE_ALIGN(size); new_block = qemu_mallocz(sizeof(*new_block)); if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) { char *id = dev->parent_bus->info->get_dev_path(dev); if (id) { snprintf(new_block->idstr, sizeof(new_block->idstr), "%s/", id); qemu_free(id); } } pstrcat(new_block->idstr, sizeof(new_block->idstr), name); QLIST_FOREACH(block, &ram_list.blocks, next) { if (!strcmp(block->idstr, new_block->idstr)) { fprintf(stderr, "RAMBlock \"%s\" already registered, abort!\n", new_block->idstr); abort(); } } new_block->host = host; new_block->offset = find_ram_offset(size); new_block->length = size; QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next); ram_list.phys_dirty = qemu_realloc(ram_list.phys_dirty, last_ram_offset() >> TARGET_PAGE_BITS); memset(ram_list.phys_dirty + (new_block->offset >> TARGET_PAGE_BITS), 0xff, size >> TARGET_PAGE_BITS); if (kvm_enabled()) kvm_setup_guest_memory(new_block->host, size); return new_block->offset; }
false
qemu
6977dfe6af975d72a8140dbc91effe8b8f2a58f8
ram_addr_t qemu_ram_alloc_from_ptr(DeviceState *dev, const char *name, ram_addr_t size, void *host) { RAMBlock *new_block, *block; size = TARGET_PAGE_ALIGN(size); new_block = qemu_mallocz(sizeof(*new_block)); if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) { char *id = dev->parent_bus->info->get_dev_path(dev); if (id) { snprintf(new_block->idstr, sizeof(new_block->idstr), "%s/", id); qemu_free(id); } } pstrcat(new_block->idstr, sizeof(new_block->idstr), name); QLIST_FOREACH(block, &ram_list.blocks, next) { if (!strcmp(block->idstr, new_block->idstr)) { fprintf(stderr, "RAMBlock \"%s\" already registered, abort!\n", new_block->idstr); abort(); } } new_block->host = host; new_block->offset = find_ram_offset(size); new_block->length = size; QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next); ram_list.phys_dirty = qemu_realloc(ram_list.phys_dirty, last_ram_offset() >> TARGET_PAGE_BITS); memset(ram_list.phys_dirty + (new_block->offset >> TARGET_PAGE_BITS), 0xff, size >> TARGET_PAGE_BITS); if (kvm_enabled()) kvm_setup_guest_memory(new_block->host, size); return new_block->offset; }
{ "code": [], "line_no": [] }
ram_addr_t FUNC_0(DeviceState *dev, const char *name, ram_addr_t size, void *host) { RAMBlock *new_block, *block; size = TARGET_PAGE_ALIGN(size); new_block = qemu_mallocz(sizeof(*new_block)); if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) { char *VAR_0 = dev->parent_bus->info->get_dev_path(dev); if (VAR_0) { snprintf(new_block->idstr, sizeof(new_block->idstr), "%s/", VAR_0); qemu_free(VAR_0); } } pstrcat(new_block->idstr, sizeof(new_block->idstr), name); QLIST_FOREACH(block, &ram_list.blocks, next) { if (!strcmp(block->idstr, new_block->idstr)) { fprintf(stderr, "RAMBlock \"%s\" already registered, abort!\n", new_block->idstr); abort(); } } new_block->host = host; new_block->offset = find_ram_offset(size); new_block->length = size; QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next); ram_list.phys_dirty = qemu_realloc(ram_list.phys_dirty, last_ram_offset() >> TARGET_PAGE_BITS); memset(ram_list.phys_dirty + (new_block->offset >> TARGET_PAGE_BITS), 0xff, size >> TARGET_PAGE_BITS); if (kvm_enabled()) kvm_setup_guest_memory(new_block->host, size); return new_block->offset; }
[ "ram_addr_t FUNC_0(DeviceState *dev, const char *name,\nram_addr_t size, void *host)\n{", "RAMBlock *new_block, *block;", "size = TARGET_PAGE_ALIGN(size);", "new_block = qemu_mallocz(sizeof(*new_block));", "if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) {", "char *VAR_0 = dev->parent_bus->info->get_dev_path(dev);", "if (VAR_0) {", "snprintf(new_block->idstr, sizeof(new_block->idstr), \"%s/\", VAR_0);", "qemu_free(VAR_0);", "}", "}", "pstrcat(new_block->idstr, sizeof(new_block->idstr), name);", "QLIST_FOREACH(block, &ram_list.blocks, next) {", "if (!strcmp(block->idstr, new_block->idstr)) {", "fprintf(stderr, \"RAMBlock \\\"%s\\\" already registered, abort!\\n\",\nnew_block->idstr);", "abort();", "}", "}", "new_block->host = host;", "new_block->offset = find_ram_offset(size);", "new_block->length = size;", "QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next);", "ram_list.phys_dirty = qemu_realloc(ram_list.phys_dirty,\nlast_ram_offset() >> TARGET_PAGE_BITS);", "memset(ram_list.phys_dirty + (new_block->offset >> TARGET_PAGE_BITS),\n0xff, size >> TARGET_PAGE_BITS);", "if (kvm_enabled())\nkvm_setup_guest_memory(new_block->host, size);", "return new_block->offset;", "}" ]
[ 0, 0, 0, 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 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 61 ], [ 65, 67 ], [ 69, 71 ], [ 75, 77 ], [ 81 ], [ 83 ] ]
8,288
static bool qemu_opt_get_bool_helper(QemuOpts *opts, const char *name, bool defval, bool del) { QemuOpt *opt = qemu_opt_find(opts, name); bool ret = defval; if (opt == NULL) { const QemuOptDesc *desc = find_desc_by_name(opts->list->desc, name); if (desc && desc->def_value_str) { parse_option_bool(name, desc->def_value_str, &ret, &error_abort); } return ret; } assert(opt->desc && opt->desc->type == QEMU_OPT_BOOL); ret = opt->value.boolean; if (del) { qemu_opt_del_all(opts, name); } return ret; }
false
qemu
435db4cf29b88b6612e30acda01cd18788dff458
static bool qemu_opt_get_bool_helper(QemuOpts *opts, const char *name, bool defval, bool del) { QemuOpt *opt = qemu_opt_find(opts, name); bool ret = defval; if (opt == NULL) { const QemuOptDesc *desc = find_desc_by_name(opts->list->desc, name); if (desc && desc->def_value_str) { parse_option_bool(name, desc->def_value_str, &ret, &error_abort); } return ret; } assert(opt->desc && opt->desc->type == QEMU_OPT_BOOL); ret = opt->value.boolean; if (del) { qemu_opt_del_all(opts, name); } return ret; }
{ "code": [], "line_no": [] }
static bool FUNC_0(QemuOpts *opts, const char *name, bool defval, bool del) { QemuOpt *opt = qemu_opt_find(opts, name); bool ret = defval; if (opt == NULL) { const QemuOptDesc *VAR_0 = find_desc_by_name(opts->list->VAR_0, name); if (VAR_0 && VAR_0->def_value_str) { parse_option_bool(name, VAR_0->def_value_str, &ret, &error_abort); } return ret; } assert(opt->VAR_0 && opt->VAR_0->type == QEMU_OPT_BOOL); ret = opt->value.boolean; if (del) { qemu_opt_del_all(opts, name); } return ret; }
[ "static bool FUNC_0(QemuOpts *opts, const char *name,\nbool defval, bool del)\n{", "QemuOpt *opt = qemu_opt_find(opts, name);", "bool ret = defval;", "if (opt == NULL) {", "const QemuOptDesc *VAR_0 = find_desc_by_name(opts->list->VAR_0, name);", "if (VAR_0 && VAR_0->def_value_str) {", "parse_option_bool(name, VAR_0->def_value_str, &ret, &error_abort);", "}", "return ret;", "}", "assert(opt->VAR_0 && opt->VAR_0->type == QEMU_OPT_BOOL);", "ret = opt->value.boolean;", "if (del) {", "qemu_opt_del_all(opts, name);", "}", "return ret;", "}" ]
[ 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
8,289
static void tcg_out_reloc(TCGContext *s, tcg_insn_unit *code_ptr, int type, int label_index, intptr_t addend) { TCGLabel *l; TCGRelocation *r; l = &s->labels[label_index]; if (l->has_value) { /* FIXME: This may break relocations on RISC targets that modify instruction fields in place. The caller may not have written the initial value. */ patch_reloc(code_ptr, type, l->u.value, addend); } else { /* add a new relocation entry */ r = tcg_malloc(sizeof(TCGRelocation)); r->type = type; r->ptr = code_ptr; r->addend = addend; r->next = l->u.first_reloc; l->u.first_reloc = r; } }
false
qemu
bec1631100323fac0900aea71043d5c4e22fc2fa
static void tcg_out_reloc(TCGContext *s, tcg_insn_unit *code_ptr, int type, int label_index, intptr_t addend) { TCGLabel *l; TCGRelocation *r; l = &s->labels[label_index]; if (l->has_value) { patch_reloc(code_ptr, type, l->u.value, addend); } else { r = tcg_malloc(sizeof(TCGRelocation)); r->type = type; r->ptr = code_ptr; r->addend = addend; r->next = l->u.first_reloc; l->u.first_reloc = r; } }
{ "code": [], "line_no": [] }
static void FUNC_0(TCGContext *VAR_0, tcg_insn_unit *VAR_1, int VAR_2, int VAR_3, intptr_t VAR_4) { TCGLabel *l; TCGRelocation *r; l = &VAR_0->labels[VAR_3]; if (l->has_value) { patch_reloc(VAR_1, VAR_2, l->u.value, VAR_4); } else { r = tcg_malloc(sizeof(TCGRelocation)); r->VAR_2 = VAR_2; r->ptr = VAR_1; r->VAR_4 = VAR_4; r->next = l->u.first_reloc; l->u.first_reloc = r; } }
[ "static void FUNC_0(TCGContext *VAR_0, tcg_insn_unit *VAR_1, int VAR_2,\nint VAR_3, intptr_t VAR_4)\n{", "TCGLabel *l;", "TCGRelocation *r;", "l = &VAR_0->labels[VAR_3];", "if (l->has_value) {", "patch_reloc(VAR_1, VAR_2, l->u.value, VAR_4);", "} else {", "r = tcg_malloc(sizeof(TCGRelocation));", "r->VAR_2 = VAR_2;", "r->ptr = VAR_1;", "r->VAR_4 = VAR_4;", "r->next = l->u.first_reloc;", "l->u.first_reloc = r;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
8,290
static int mov_write_packet(AVFormatContext *s, int stream_index, const uint8_t *buf, int size, int64_t pts) { MOVContext *mov = s->priv_data; ByteIOContext *pb = &s->pb; AVCodecContext *enc = &s->streams[stream_index]->codec; MOVTrack* trk = &mov->tracks[stream_index]; int cl, id; unsigned int samplesInChunk = 0; if (url_is_streamed(&s->pb)) return 0; /* Can't handle that */ if (!size) return 0; /* Discard 0 sized packets */ if (enc->codec_type == CODEC_TYPE_VIDEO ) { samplesInChunk = 1; } else if (enc->codec_type == CODEC_TYPE_AUDIO ) { if( enc->codec_id == CODEC_ID_AMR_NB) { /* We must find out how many AMR blocks there are in one packet */ static uint16_t packed_size[16] = {13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 0}; int len = 0; while (len < size && samplesInChunk < 100) { len += packed_size[(buf[len] >> 3) & 0x0F]; samplesInChunk++; } } else if(enc->codec_id == CODEC_ID_PCM_ALAW) { samplesInChunk = size/enc->channels; } else { samplesInChunk = 1; } } if ((enc->codec_id == CODEC_ID_MPEG4 || enc->codec_id == CODEC_ID_AAC) && trk->vosLen == 0) { assert(enc->extradata_size); trk->vosLen = enc->extradata_size; trk->vosData = av_malloc(trk->vosLen); memcpy(trk->vosData, enc->extradata, trk->vosLen); } cl = trk->entry / MOV_INDEX_CLUSTER_SIZE; id = trk->entry % MOV_INDEX_CLUSTER_SIZE; if (trk->ents_allocated <= trk->entry) { trk->cluster = av_realloc(trk->cluster, (cl+1)*sizeof(void*)); if (!trk->cluster) return -1; trk->cluster[cl] = av_malloc(MOV_INDEX_CLUSTER_SIZE*sizeof(MOVIentry)); if (!trk->cluster[cl]) return -1; trk->ents_allocated += MOV_INDEX_CLUSTER_SIZE; } if (mov->mdat_written == 0) { mov_write_mdat_tag(pb, mov); mov->mdat_written = 1; mov->time = Timestamp(); } trk->cluster[cl][id].pos = url_ftell(pb) - mov->movi_list; trk->cluster[cl][id].samplesInChunk = samplesInChunk; trk->cluster[cl][id].size = size; trk->cluster[cl][id].entries = samplesInChunk; if(enc->codec_type == CODEC_TYPE_VIDEO) { trk->cluster[cl][id].key_frame = enc->coded_frame->key_frame; if(enc->coded_frame->pict_type == FF_I_TYPE) trk->hasKeyframes = 1; } trk->enc = enc; trk->entry++; trk->sampleCount += samplesInChunk; trk->mdat_size += size; put_buffer(pb, buf, size); put_flush_packet(pb); return 0; }
false
FFmpeg
69dde1ad36b7d95b8b9268f414aa6c076212ed41
static int mov_write_packet(AVFormatContext *s, int stream_index, const uint8_t *buf, int size, int64_t pts) { MOVContext *mov = s->priv_data; ByteIOContext *pb = &s->pb; AVCodecContext *enc = &s->streams[stream_index]->codec; MOVTrack* trk = &mov->tracks[stream_index]; int cl, id; unsigned int samplesInChunk = 0; if (url_is_streamed(&s->pb)) return 0; if (!size) return 0; if (enc->codec_type == CODEC_TYPE_VIDEO ) { samplesInChunk = 1; } else if (enc->codec_type == CODEC_TYPE_AUDIO ) { if( enc->codec_id == CODEC_ID_AMR_NB) { static uint16_t packed_size[16] = {13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 0}; int len = 0; while (len < size && samplesInChunk < 100) { len += packed_size[(buf[len] >> 3) & 0x0F]; samplesInChunk++; } } else if(enc->codec_id == CODEC_ID_PCM_ALAW) { samplesInChunk = size/enc->channels; } else { samplesInChunk = 1; } } if ((enc->codec_id == CODEC_ID_MPEG4 || enc->codec_id == CODEC_ID_AAC) && trk->vosLen == 0) { assert(enc->extradata_size); trk->vosLen = enc->extradata_size; trk->vosData = av_malloc(trk->vosLen); memcpy(trk->vosData, enc->extradata, trk->vosLen); } cl = trk->entry / MOV_INDEX_CLUSTER_SIZE; id = trk->entry % MOV_INDEX_CLUSTER_SIZE; if (trk->ents_allocated <= trk->entry) { trk->cluster = av_realloc(trk->cluster, (cl+1)*sizeof(void*)); if (!trk->cluster) return -1; trk->cluster[cl] = av_malloc(MOV_INDEX_CLUSTER_SIZE*sizeof(MOVIentry)); if (!trk->cluster[cl]) return -1; trk->ents_allocated += MOV_INDEX_CLUSTER_SIZE; } if (mov->mdat_written == 0) { mov_write_mdat_tag(pb, mov); mov->mdat_written = 1; mov->time = Timestamp(); } trk->cluster[cl][id].pos = url_ftell(pb) - mov->movi_list; trk->cluster[cl][id].samplesInChunk = samplesInChunk; trk->cluster[cl][id].size = size; trk->cluster[cl][id].entries = samplesInChunk; if(enc->codec_type == CODEC_TYPE_VIDEO) { trk->cluster[cl][id].key_frame = enc->coded_frame->key_frame; if(enc->coded_frame->pict_type == FF_I_TYPE) trk->hasKeyframes = 1; } trk->enc = enc; trk->entry++; trk->sampleCount += samplesInChunk; trk->mdat_size += size; put_buffer(pb, buf, size); put_flush_packet(pb); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, const uint8_t *VAR_2, int VAR_3, int64_t VAR_4) { MOVContext *mov = VAR_0->priv_data; ByteIOContext *pb = &VAR_0->pb; AVCodecContext *enc = &VAR_0->streams[VAR_1]->codec; MOVTrack* trk = &mov->tracks[VAR_1]; int VAR_5, VAR_6; unsigned int VAR_7 = 0; if (url_is_streamed(&VAR_0->pb)) return 0; if (!VAR_3) return 0; if (enc->codec_type == CODEC_TYPE_VIDEO ) { VAR_7 = 1; } else if (enc->codec_type == CODEC_TYPE_AUDIO ) { if( enc->codec_id == CODEC_ID_AMR_NB) { static uint16_t VAR_8[16] = {13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 0}; int VAR_9 = 0; while (VAR_9 < VAR_3 && VAR_7 < 100) { VAR_9 += VAR_8[(VAR_2[VAR_9] >> 3) & 0x0F]; VAR_7++; } } else if(enc->codec_id == CODEC_ID_PCM_ALAW) { VAR_7 = VAR_3/enc->channels; } else { VAR_7 = 1; } } if ((enc->codec_id == CODEC_ID_MPEG4 || enc->codec_id == CODEC_ID_AAC) && trk->vosLen == 0) { assert(enc->extradata_size); trk->vosLen = enc->extradata_size; trk->vosData = av_malloc(trk->vosLen); memcpy(trk->vosData, enc->extradata, trk->vosLen); } VAR_5 = trk->entry / MOV_INDEX_CLUSTER_SIZE; VAR_6 = trk->entry % MOV_INDEX_CLUSTER_SIZE; if (trk->ents_allocated <= trk->entry) { trk->cluster = av_realloc(trk->cluster, (VAR_5+1)*sizeof(void*)); if (!trk->cluster) return -1; trk->cluster[VAR_5] = av_malloc(MOV_INDEX_CLUSTER_SIZE*sizeof(MOVIentry)); if (!trk->cluster[VAR_5]) return -1; trk->ents_allocated += MOV_INDEX_CLUSTER_SIZE; } if (mov->mdat_written == 0) { mov_write_mdat_tag(pb, mov); mov->mdat_written = 1; mov->time = Timestamp(); } trk->cluster[VAR_5][VAR_6].pos = url_ftell(pb) - mov->movi_list; trk->cluster[VAR_5][VAR_6].VAR_7 = VAR_7; trk->cluster[VAR_5][VAR_6].VAR_3 = VAR_3; trk->cluster[VAR_5][VAR_6].entries = VAR_7; if(enc->codec_type == CODEC_TYPE_VIDEO) { trk->cluster[VAR_5][VAR_6].key_frame = enc->coded_frame->key_frame; if(enc->coded_frame->pict_type == FF_I_TYPE) trk->hasKeyframes = 1; } trk->enc = enc; trk->entry++; trk->sampleCount += VAR_7; trk->mdat_size += VAR_3; put_buffer(pb, VAR_2, VAR_3); put_flush_packet(pb); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1,\nconst uint8_t *VAR_2, int VAR_3, int64_t VAR_4)\n{", "MOVContext *mov = VAR_0->priv_data;", "ByteIOContext *pb = &VAR_0->pb;", "AVCodecContext *enc = &VAR_0->streams[VAR_1]->codec;", "MOVTrack* trk = &mov->tracks[VAR_1];", "int VAR_5, VAR_6;", "unsigned int VAR_7 = 0;", "if (url_is_streamed(&VAR_0->pb)) return 0;", "if (!VAR_3) return 0;", "if (enc->codec_type == CODEC_TYPE_VIDEO ) {", "VAR_7 = 1;", "}", "else if (enc->codec_type == CODEC_TYPE_AUDIO ) {", "if( enc->codec_id == CODEC_ID_AMR_NB) {", "static uint16_t VAR_8[16] =\n{13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 0};", "int VAR_9 = 0;", "while (VAR_9 < VAR_3 && VAR_7 < 100) {", "VAR_9 += VAR_8[(VAR_2[VAR_9] >> 3) & 0x0F];", "VAR_7++;", "}", "}", "else if(enc->codec_id == CODEC_ID_PCM_ALAW) {", "VAR_7 = VAR_3/enc->channels;", "}", "else {", "VAR_7 = 1;", "}", "}", "if ((enc->codec_id == CODEC_ID_MPEG4 || enc->codec_id == CODEC_ID_AAC)\n&& trk->vosLen == 0) {", "assert(enc->extradata_size);", "trk->vosLen = enc->extradata_size;", "trk->vosData = av_malloc(trk->vosLen);", "memcpy(trk->vosData, enc->extradata, trk->vosLen);", "}", "VAR_5 = trk->entry / MOV_INDEX_CLUSTER_SIZE;", "VAR_6 = trk->entry % MOV_INDEX_CLUSTER_SIZE;", "if (trk->ents_allocated <= trk->entry) {", "trk->cluster = av_realloc(trk->cluster, (VAR_5+1)*sizeof(void*));", "if (!trk->cluster)\nreturn -1;", "trk->cluster[VAR_5] = av_malloc(MOV_INDEX_CLUSTER_SIZE*sizeof(MOVIentry));", "if (!trk->cluster[VAR_5])\nreturn -1;", "trk->ents_allocated += MOV_INDEX_CLUSTER_SIZE;", "}", "if (mov->mdat_written == 0) {", "mov_write_mdat_tag(pb, mov);", "mov->mdat_written = 1;", "mov->time = Timestamp();", "}", "trk->cluster[VAR_5][VAR_6].pos = url_ftell(pb) - mov->movi_list;", "trk->cluster[VAR_5][VAR_6].VAR_7 = VAR_7;", "trk->cluster[VAR_5][VAR_6].VAR_3 = VAR_3;", "trk->cluster[VAR_5][VAR_6].entries = VAR_7;", "if(enc->codec_type == CODEC_TYPE_VIDEO) {", "trk->cluster[VAR_5][VAR_6].key_frame = enc->coded_frame->key_frame;", "if(enc->coded_frame->pict_type == FF_I_TYPE)\ntrk->hasKeyframes = 1;", "}", "trk->enc = enc;", "trk->entry++;", "trk->sampleCount += VAR_7;", "trk->mdat_size += VAR_3;", "put_buffer(pb, VAR_2, VAR_3);", "put_flush_packet(pb);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 159 ], [ 161 ], [ 163 ] ]
8,292
static uint32_t nvdimm_get_max_xfer_label_size(void) { uint32_t max_get_size, max_set_size, dsm_memory_size = 4096; /* * the max data ACPI can read one time which is transferred by * the response of 'Get Namespace Label Data' function. */ max_get_size = dsm_memory_size - sizeof(NvdimmFuncGetLabelDataOut); /* * the max data ACPI can write one time which is transferred by * 'Set Namespace Label Data' function. */ max_set_size = dsm_memory_size - offsetof(NvdimmDsmIn, arg3) - sizeof(NvdimmFuncSetLabelDataIn); return MIN(max_get_size, max_set_size); }
false
qemu
cb88ebd7542458c22f3051646f268dcea6109abc
static uint32_t nvdimm_get_max_xfer_label_size(void) { uint32_t max_get_size, max_set_size, dsm_memory_size = 4096; max_get_size = dsm_memory_size - sizeof(NvdimmFuncGetLabelDataOut); max_set_size = dsm_memory_size - offsetof(NvdimmDsmIn, arg3) - sizeof(NvdimmFuncSetLabelDataIn); return MIN(max_get_size, max_set_size); }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(void) { uint32_t max_get_size, max_set_size, dsm_memory_size = 4096; max_get_size = dsm_memory_size - sizeof(NvdimmFuncGetLabelDataOut); max_set_size = dsm_memory_size - offsetof(NvdimmDsmIn, arg3) - sizeof(NvdimmFuncSetLabelDataIn); return MIN(max_get_size, max_set_size); }
[ "static uint32_t FUNC_0(void)\n{", "uint32_t max_get_size, max_set_size, dsm_memory_size = 4096;", "max_get_size = dsm_memory_size - sizeof(NvdimmFuncGetLabelDataOut);", "max_set_size = dsm_memory_size - offsetof(NvdimmDsmIn, arg3) -\nsizeof(NvdimmFuncSetLabelDataIn);", "return MIN(max_get_size, max_set_size);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 17 ], [ 29, 31 ], [ 35 ], [ 37 ] ]
8,293
static void imx_fec_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { IMXFECState *s = IMX_FEC(opaque); FEC_PRINTF("writing 0x%08x @ 0x%" HWADDR_PRIx "\n", (int)value, addr); switch (addr & 0x3ff) { case 0x004: /* EIR */ s->eir &= ~value; break; case 0x008: /* EIMR */ s->eimr = value; break; case 0x010: /* RDAR */ if ((s->ecr & FEC_EN) && !s->rx_enabled) { imx_fec_enable_rx(s); } break; case 0x014: /* TDAR */ if (s->ecr & FEC_EN) { imx_fec_do_tx(s); } break; case 0x024: /* ECR */ s->ecr = value; if (value & FEC_RESET) { imx_fec_reset(DEVICE(s)); } if ((s->ecr & FEC_EN) == 0) { s->rx_enabled = 0; } break; case 0x040: /* MMFR */ /* store the value */ s->mmfr = value; if (extract32(value, 28, 1)) { do_phy_write(s, extract32(value, 18, 9), extract32(value, 0, 16)); } else { s->mmfr = do_phy_read(s, extract32(value, 18, 9)); } /* raise the interrupt as the PHY operation is done */ s->eir |= FEC_INT_MII; break; case 0x044: /* MSCR */ s->mscr = value & 0xfe; break; case 0x064: /* MIBC */ /* TODO: Implement MIB. */ s->mibc = (value & 0x80000000) ? 0xc0000000 : 0; break; case 0x084: /* RCR */ s->rcr = value & 0x07ff003f; /* TODO: Implement LOOP mode. */ break; case 0x0c4: /* TCR */ /* We transmit immediately, so raise GRA immediately. */ s->tcr = value; if (value & 1) { s->eir |= FEC_INT_GRA; } break; case 0x0e4: /* PALR */ s->conf.macaddr.a[0] = value >> 24; s->conf.macaddr.a[1] = value >> 16; s->conf.macaddr.a[2] = value >> 8; s->conf.macaddr.a[3] = value; break; case 0x0e8: /* PAUR */ s->conf.macaddr.a[4] = value >> 24; s->conf.macaddr.a[5] = value >> 16; break; case 0x0ec: /* OPDR */ break; case 0x118: /* IAUR */ case 0x11c: /* IALR */ case 0x120: /* GAUR */ case 0x124: /* GALR */ /* TODO: implement MAC hash filtering. */ break; case 0x144: /* TFWR */ s->tfwr = value & 3; break; case 0x14c: /* FRBR */ /* FRBR writes ignored. */ break; case 0x150: /* FRSR */ s->frsr = (value & 0x3fc) | 0x400; break; case 0x180: /* ERDSR */ s->erdsr = value & ~3; s->rx_descriptor = s->erdsr; break; case 0x184: /* ETDSR */ s->etdsr = value & ~3; s->tx_descriptor = s->etdsr; break; case 0x188: /* EMRBR */ s->emrbr = value & 0x7f0; break; case 0x300: /* MIIGSK_CFGR */ s->miigsk_cfgr = value & 0x53; break; case 0x308: /* MIIGSK_ENR */ s->miigsk_enr = (value & 0x2) ? 0x6 : 0; break; default: qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad address at offset 0x%" HWADDR_PRIx "\n", TYPE_IMX_FEC, __func__, addr); break; } imx_fec_update(s); }
false
qemu
4816dc168b5745708eba4c005f5e8771623ee405
static void imx_fec_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { IMXFECState *s = IMX_FEC(opaque); FEC_PRINTF("writing 0x%08x @ 0x%" HWADDR_PRIx "\n", (int)value, addr); switch (addr & 0x3ff) { case 0x004: s->eir &= ~value; break; case 0x008: s->eimr = value; break; case 0x010: if ((s->ecr & FEC_EN) && !s->rx_enabled) { imx_fec_enable_rx(s); } break; case 0x014: if (s->ecr & FEC_EN) { imx_fec_do_tx(s); } break; case 0x024: s->ecr = value; if (value & FEC_RESET) { imx_fec_reset(DEVICE(s)); } if ((s->ecr & FEC_EN) == 0) { s->rx_enabled = 0; } break; case 0x040: s->mmfr = value; if (extract32(value, 28, 1)) { do_phy_write(s, extract32(value, 18, 9), extract32(value, 0, 16)); } else { s->mmfr = do_phy_read(s, extract32(value, 18, 9)); } s->eir |= FEC_INT_MII; break; case 0x044: s->mscr = value & 0xfe; break; case 0x064: s->mibc = (value & 0x80000000) ? 0xc0000000 : 0; break; case 0x084: s->rcr = value & 0x07ff003f; break; case 0x0c4: s->tcr = value; if (value & 1) { s->eir |= FEC_INT_GRA; } break; case 0x0e4: s->conf.macaddr.a[0] = value >> 24; s->conf.macaddr.a[1] = value >> 16; s->conf.macaddr.a[2] = value >> 8; s->conf.macaddr.a[3] = value; break; case 0x0e8: s->conf.macaddr.a[4] = value >> 24; s->conf.macaddr.a[5] = value >> 16; break; case 0x0ec: break; case 0x118: case 0x11c: case 0x120: case 0x124: break; case 0x144: s->tfwr = value & 3; break; case 0x14c: break; case 0x150: s->frsr = (value & 0x3fc) | 0x400; break; case 0x180: s->erdsr = value & ~3; s->rx_descriptor = s->erdsr; break; case 0x184: s->etdsr = value & ~3; s->tx_descriptor = s->etdsr; break; case 0x188: s->emrbr = value & 0x7f0; break; case 0x300: s->miigsk_cfgr = value & 0x53; break; case 0x308: s->miigsk_enr = (value & 0x2) ? 0x6 : 0; break; default: qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad address at offset 0x%" HWADDR_PRIx "\n", TYPE_IMX_FEC, __func__, addr); break; } imx_fec_update(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { IMXFECState *s = IMX_FEC(VAR_0); FEC_PRINTF("writing 0x%08x @ 0x%" HWADDR_PRIx "\n", (int)VAR_2, VAR_1); switch (VAR_1 & 0x3ff) { case 0x004: s->eir &= ~VAR_2; break; case 0x008: s->eimr = VAR_2; break; case 0x010: if ((s->ecr & FEC_EN) && !s->rx_enabled) { imx_fec_enable_rx(s); } break; case 0x014: if (s->ecr & FEC_EN) { imx_fec_do_tx(s); } break; case 0x024: s->ecr = VAR_2; if (VAR_2 & FEC_RESET) { imx_fec_reset(DEVICE(s)); } if ((s->ecr & FEC_EN) == 0) { s->rx_enabled = 0; } break; case 0x040: s->mmfr = VAR_2; if (extract32(VAR_2, 28, 1)) { do_phy_write(s, extract32(VAR_2, 18, 9), extract32(VAR_2, 0, 16)); } else { s->mmfr = do_phy_read(s, extract32(VAR_2, 18, 9)); } s->eir |= FEC_INT_MII; break; case 0x044: s->mscr = VAR_2 & 0xfe; break; case 0x064: s->mibc = (VAR_2 & 0x80000000) ? 0xc0000000 : 0; break; case 0x084: s->rcr = VAR_2 & 0x07ff003f; break; case 0x0c4: s->tcr = VAR_2; if (VAR_2 & 1) { s->eir |= FEC_INT_GRA; } break; case 0x0e4: s->conf.macaddr.a[0] = VAR_2 >> 24; s->conf.macaddr.a[1] = VAR_2 >> 16; s->conf.macaddr.a[2] = VAR_2 >> 8; s->conf.macaddr.a[3] = VAR_2; break; case 0x0e8: s->conf.macaddr.a[4] = VAR_2 >> 24; s->conf.macaddr.a[5] = VAR_2 >> 16; break; case 0x0ec: break; case 0x118: case 0x11c: case 0x120: case 0x124: break; case 0x144: s->tfwr = VAR_2 & 3; break; case 0x14c: break; case 0x150: s->frsr = (VAR_2 & 0x3fc) | 0x400; break; case 0x180: s->erdsr = VAR_2 & ~3; s->rx_descriptor = s->erdsr; break; case 0x184: s->etdsr = VAR_2 & ~3; s->tx_descriptor = s->etdsr; break; case 0x188: s->emrbr = VAR_2 & 0x7f0; break; case 0x300: s->miigsk_cfgr = VAR_2 & 0x53; break; case 0x308: s->miigsk_enr = (VAR_2 & 0x2) ? 0x6 : 0; break; default: qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad address at offset 0x%" HWADDR_PRIx "\n", TYPE_IMX_FEC, __func__, VAR_1); break; } imx_fec_update(s); }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "IMXFECState *s = IMX_FEC(VAR_0);", "FEC_PRINTF(\"writing 0x%08x @ 0x%\" HWADDR_PRIx \"\\n\", (int)VAR_2, VAR_1);", "switch (VAR_1 & 0x3ff) {", "case 0x004:\ns->eir &= ~VAR_2;", "break;", "case 0x008:\ns->eimr = VAR_2;", "break;", "case 0x010:\nif ((s->ecr & FEC_EN) && !s->rx_enabled) {", "imx_fec_enable_rx(s);", "}", "break;", "case 0x014:\nif (s->ecr & FEC_EN) {", "imx_fec_do_tx(s);", "}", "break;", "case 0x024:\ns->ecr = VAR_2;", "if (VAR_2 & FEC_RESET) {", "imx_fec_reset(DEVICE(s));", "}", "if ((s->ecr & FEC_EN) == 0) {", "s->rx_enabled = 0;", "}", "break;", "case 0x040:\ns->mmfr = VAR_2;", "if (extract32(VAR_2, 28, 1)) {", "do_phy_write(s, extract32(VAR_2, 18, 9), extract32(VAR_2, 0, 16));", "} else {", "s->mmfr = do_phy_read(s, extract32(VAR_2, 18, 9));", "}", "s->eir |= FEC_INT_MII;", "break;", "case 0x044:\ns->mscr = VAR_2 & 0xfe;", "break;", "case 0x064:\ns->mibc = (VAR_2 & 0x80000000) ? 0xc0000000 : 0;", "break;", "case 0x084:\ns->rcr = VAR_2 & 0x07ff003f;", "break;", "case 0x0c4:\ns->tcr = VAR_2;", "if (VAR_2 & 1) {", "s->eir |= FEC_INT_GRA;", "}", "break;", "case 0x0e4:\ns->conf.macaddr.a[0] = VAR_2 >> 24;", "s->conf.macaddr.a[1] = VAR_2 >> 16;", "s->conf.macaddr.a[2] = VAR_2 >> 8;", "s->conf.macaddr.a[3] = VAR_2;", "break;", "case 0x0e8:\ns->conf.macaddr.a[4] = VAR_2 >> 24;", "s->conf.macaddr.a[5] = VAR_2 >> 16;", "break;", "case 0x0ec:\nbreak;", "case 0x118:\ncase 0x11c:\ncase 0x120:\ncase 0x124:\nbreak;", "case 0x144:\ns->tfwr = VAR_2 & 3;", "break;", "case 0x14c:\nbreak;", "case 0x150:\ns->frsr = (VAR_2 & 0x3fc) | 0x400;", "break;", "case 0x180:\ns->erdsr = VAR_2 & ~3;", "s->rx_descriptor = s->erdsr;", "break;", "case 0x184:\ns->etdsr = VAR_2 & ~3;", "s->tx_descriptor = s->etdsr;", "break;", "case 0x188:\ns->emrbr = VAR_2 & 0x7f0;", "break;", "case 0x300:\ns->miigsk_cfgr = VAR_2 & 0x53;", "break;", "case 0x308:\ns->miigsk_enr = (VAR_2 & 0x2) ? 0x6 : 0;", "break;", "default:\nqemu_log_mask(LOG_GUEST_ERROR, \"[%s]%s: Bad address at offset 0x%\"\nHWADDR_PRIx \"\\n\", TYPE_IMX_FEC, __func__, VAR_1);", "break;", "}", "imx_fec_update(s);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 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 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95, 99 ], [ 101 ], [ 103, 105 ], [ 109 ], [ 111, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125, 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145, 147 ], [ 149, 151, 153, 155, 159 ], [ 161, 163 ], [ 165 ], [ 167, 171 ], [ 173, 175 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 195, 197 ], [ 199 ], [ 201, 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213, 215, 217 ], [ 219 ], [ 221 ], [ 225 ], [ 227 ] ]
8,294
static void replay_enable(const char *fname, int mode) { const char *fmode = NULL; assert(!replay_file); switch (mode) { case REPLAY_MODE_RECORD: fmode = "wb"; break; case REPLAY_MODE_PLAY: fmode = "rb"; break; default: fprintf(stderr, "Replay: internal error: invalid replay mode\n"); exit(1); } atexit(replay_finish); replay_mutex_init(); replay_file = fopen(fname, fmode); if (replay_file == NULL) { fprintf(stderr, "Replay: open %s: %s\n", fname, strerror(errno)); exit(1); } replay_filename = g_strdup(fname); replay_mode = mode; replay_data_kind = -1; replay_state.instructions_count = 0; replay_state.current_step = 0; /* skip file header for RECORD and check it for PLAY */ if (replay_mode == REPLAY_MODE_RECORD) { fseek(replay_file, HEADER_SIZE, SEEK_SET); } else if (replay_mode == REPLAY_MODE_PLAY) { unsigned int version = replay_get_dword(); if (version != REPLAY_VERSION) { fprintf(stderr, "Replay: invalid input log file version\n"); exit(1); } /* go to the beginning */ fseek(replay_file, HEADER_SIZE, SEEK_SET); replay_fetch_data_kind(); } replay_init_events(); }
false
qemu
f186d64d8fda4bb22c15beb8e45b7814fbd8b51e
static void replay_enable(const char *fname, int mode) { const char *fmode = NULL; assert(!replay_file); switch (mode) { case REPLAY_MODE_RECORD: fmode = "wb"; break; case REPLAY_MODE_PLAY: fmode = "rb"; break; default: fprintf(stderr, "Replay: internal error: invalid replay mode\n"); exit(1); } atexit(replay_finish); replay_mutex_init(); replay_file = fopen(fname, fmode); if (replay_file == NULL) { fprintf(stderr, "Replay: open %s: %s\n", fname, strerror(errno)); exit(1); } replay_filename = g_strdup(fname); replay_mode = mode; replay_data_kind = -1; replay_state.instructions_count = 0; replay_state.current_step = 0; if (replay_mode == REPLAY_MODE_RECORD) { fseek(replay_file, HEADER_SIZE, SEEK_SET); } else if (replay_mode == REPLAY_MODE_PLAY) { unsigned int version = replay_get_dword(); if (version != REPLAY_VERSION) { fprintf(stderr, "Replay: invalid input log file version\n"); exit(1); } fseek(replay_file, HEADER_SIZE, SEEK_SET); replay_fetch_data_kind(); } replay_init_events(); }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0, int VAR_1) { const char *VAR_2 = NULL; assert(!replay_file); switch (VAR_1) { case REPLAY_MODE_RECORD: VAR_2 = "wb"; break; case REPLAY_MODE_PLAY: VAR_2 = "rb"; break; default: fprintf(stderr, "Replay: internal error: invalid replay VAR_1\n"); exit(1); } atexit(replay_finish); replay_mutex_init(); replay_file = fopen(VAR_0, VAR_2); if (replay_file == NULL) { fprintf(stderr, "Replay: open %s: %s\n", VAR_0, strerror(errno)); exit(1); } replay_filename = g_strdup(VAR_0); replay_mode = VAR_1; replay_data_kind = -1; replay_state.instructions_count = 0; replay_state.current_step = 0; if (replay_mode == REPLAY_MODE_RECORD) { fseek(replay_file, HEADER_SIZE, SEEK_SET); } else if (replay_mode == REPLAY_MODE_PLAY) { unsigned int VAR_3 = replay_get_dword(); if (VAR_3 != REPLAY_VERSION) { fprintf(stderr, "Replay: invalid input log file VAR_3\n"); exit(1); } fseek(replay_file, HEADER_SIZE, SEEK_SET); replay_fetch_data_kind(); } replay_init_events(); }
[ "static void FUNC_0(const char *VAR_0, int VAR_1)\n{", "const char *VAR_2 = NULL;", "assert(!replay_file);", "switch (VAR_1) {", "case REPLAY_MODE_RECORD:\nVAR_2 = \"wb\";", "break;", "case REPLAY_MODE_PLAY:\nVAR_2 = \"rb\";", "break;", "default:\nfprintf(stderr, \"Replay: internal error: invalid replay VAR_1\\n\");", "exit(1);", "}", "atexit(replay_finish);", "replay_mutex_init();", "replay_file = fopen(VAR_0, VAR_2);", "if (replay_file == NULL) {", "fprintf(stderr, \"Replay: open %s: %s\\n\", VAR_0, strerror(errno));", "exit(1);", "}", "replay_filename = g_strdup(VAR_0);", "replay_mode = VAR_1;", "replay_data_kind = -1;", "replay_state.instructions_count = 0;", "replay_state.current_step = 0;", "if (replay_mode == REPLAY_MODE_RECORD) {", "fseek(replay_file, HEADER_SIZE, SEEK_SET);", "} else if (replay_mode == REPLAY_MODE_PLAY) {", "unsigned int VAR_3 = replay_get_dword();", "if (VAR_3 != REPLAY_VERSION) {", "fprintf(stderr, \"Replay: invalid input log file VAR_3\\n\");", "exit(1);", "}", "fseek(replay_file, HEADER_SIZE, SEEK_SET);", "replay_fetch_data_kind();", "}", "replay_init_events();", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 97 ], [ 99 ] ]
8,295
static bool raw_is_inserted(BlockDriverState *bs) { return bdrv_is_inserted(bs->file->bs); }
false
qemu
1354c473789a91ba603d40bdf2521e3221c0a69f
static bool raw_is_inserted(BlockDriverState *bs) { return bdrv_is_inserted(bs->file->bs); }
{ "code": [], "line_no": [] }
static bool FUNC_0(BlockDriverState *bs) { return bdrv_is_inserted(bs->file->bs); }
[ "static bool FUNC_0(BlockDriverState *bs)\n{", "return bdrv_is_inserted(bs->file->bs);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
8,298
static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) { int ret; DPRINTF("Enter save live stage %d submitted %d transferred %d\n", stage, block_mig_state.submitted, block_mig_state.transferred); if (stage < 0) { blk_mig_cleanup(mon); return 0; } if (block_mig_state.blk_enable != 1) { /* no need to migrate storage */ qemu_put_be64(f, BLK_MIG_FLAG_EOS); return 1; } if (stage == 1) { init_blk_migration(mon, f); /* start track dirty blocks */ set_dirty_tracking(1); } flush_blks(f); ret = qemu_file_get_error(f); if (ret) { blk_mig_cleanup(mon); return ret; } blk_mig_reset_dirty_cursor(); if (stage == 2) { /* control the rate of transfer */ while ((block_mig_state.submitted + block_mig_state.read_done) * BLOCK_SIZE < qemu_file_get_rate_limit(f)) { if (block_mig_state.bulk_completed == 0) { /* first finish the bulk phase */ if (blk_mig_save_bulked_block(mon, f) == 0) { /* finished saving bulk on all devices */ block_mig_state.bulk_completed = 1; } } else { if (blk_mig_save_dirty_block(mon, f, 1) == 0) { /* no more dirty blocks */ break; } } } flush_blks(f); ret = qemu_file_get_error(f); if (ret) { blk_mig_cleanup(mon); return ret; } } if (stage == 3) { /* we know for sure that save bulk is completed and all async read completed */ assert(block_mig_state.submitted == 0); while (blk_mig_save_dirty_block(mon, f, 0) != 0); blk_mig_cleanup(mon); /* report completion */ qemu_put_be64(f, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); ret = qemu_file_get_error(f); if (ret) { return ret; } monitor_printf(mon, "Block migration completed\n"); } qemu_put_be64(f, BLK_MIG_FLAG_EOS); return ((stage == 2) && is_stage2_completed()); }
false
qemu
539de1246d355d3b8aa33fb7cde732352d8827c7
static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) { int ret; DPRINTF("Enter save live stage %d submitted %d transferred %d\n", stage, block_mig_state.submitted, block_mig_state.transferred); if (stage < 0) { blk_mig_cleanup(mon); return 0; } if (block_mig_state.blk_enable != 1) { qemu_put_be64(f, BLK_MIG_FLAG_EOS); return 1; } if (stage == 1) { init_blk_migration(mon, f); set_dirty_tracking(1); } flush_blks(f); ret = qemu_file_get_error(f); if (ret) { blk_mig_cleanup(mon); return ret; } blk_mig_reset_dirty_cursor(); if (stage == 2) { while ((block_mig_state.submitted + block_mig_state.read_done) * BLOCK_SIZE < qemu_file_get_rate_limit(f)) { if (block_mig_state.bulk_completed == 0) { if (blk_mig_save_bulked_block(mon, f) == 0) { block_mig_state.bulk_completed = 1; } } else { if (blk_mig_save_dirty_block(mon, f, 1) == 0) { break; } } } flush_blks(f); ret = qemu_file_get_error(f); if (ret) { blk_mig_cleanup(mon); return ret; } } if (stage == 3) { assert(block_mig_state.submitted == 0); while (blk_mig_save_dirty_block(mon, f, 0) != 0); blk_mig_cleanup(mon); qemu_put_be64(f, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); ret = qemu_file_get_error(f); if (ret) { return ret; } monitor_printf(mon, "Block migration completed\n"); } qemu_put_be64(f, BLK_MIG_FLAG_EOS); return ((stage == 2) && is_stage2_completed()); }
{ "code": [], "line_no": [] }
static int FUNC_0(Monitor *VAR_0, QEMUFile *VAR_1, int VAR_2, void *VAR_3) { int VAR_4; DPRINTF("Enter save live VAR_2 %d submitted %d transferred %d\n", VAR_2, block_mig_state.submitted, block_mig_state.transferred); if (VAR_2 < 0) { blk_mig_cleanup(VAR_0); return 0; } if (block_mig_state.blk_enable != 1) { qemu_put_be64(VAR_1, BLK_MIG_FLAG_EOS); return 1; } if (VAR_2 == 1) { init_blk_migration(VAR_0, VAR_1); set_dirty_tracking(1); } flush_blks(VAR_1); VAR_4 = qemu_file_get_error(VAR_1); if (VAR_4) { blk_mig_cleanup(VAR_0); return VAR_4; } blk_mig_reset_dirty_cursor(); if (VAR_2 == 2) { while ((block_mig_state.submitted + block_mig_state.read_done) * BLOCK_SIZE < qemu_file_get_rate_limit(VAR_1)) { if (block_mig_state.bulk_completed == 0) { if (blk_mig_save_bulked_block(VAR_0, VAR_1) == 0) { block_mig_state.bulk_completed = 1; } } else { if (blk_mig_save_dirty_block(VAR_0, VAR_1, 1) == 0) { break; } } } flush_blks(VAR_1); VAR_4 = qemu_file_get_error(VAR_1); if (VAR_4) { blk_mig_cleanup(VAR_0); return VAR_4; } } if (VAR_2 == 3) { assert(block_mig_state.submitted == 0); while (blk_mig_save_dirty_block(VAR_0, VAR_1, 0) != 0); blk_mig_cleanup(VAR_0); qemu_put_be64(VAR_1, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS); VAR_4 = qemu_file_get_error(VAR_1); if (VAR_4) { return VAR_4; } monitor_printf(VAR_0, "Block migration completed\n"); } qemu_put_be64(VAR_1, BLK_MIG_FLAG_EOS); return ((VAR_2 == 2) && is_stage2_completed()); }
[ "static int FUNC_0(Monitor *VAR_0, QEMUFile *VAR_1, int VAR_2, void *VAR_3)\n{", "int VAR_4;", "DPRINTF(\"Enter save live VAR_2 %d submitted %d transferred %d\\n\",\nVAR_2, block_mig_state.submitted, block_mig_state.transferred);", "if (VAR_2 < 0) {", "blk_mig_cleanup(VAR_0);", "return 0;", "}", "if (block_mig_state.blk_enable != 1) {", "qemu_put_be64(VAR_1, BLK_MIG_FLAG_EOS);", "return 1;", "}", "if (VAR_2 == 1) {", "init_blk_migration(VAR_0, VAR_1);", "set_dirty_tracking(1);", "}", "flush_blks(VAR_1);", "VAR_4 = qemu_file_get_error(VAR_1);", "if (VAR_4) {", "blk_mig_cleanup(VAR_0);", "return VAR_4;", "}", "blk_mig_reset_dirty_cursor();", "if (VAR_2 == 2) {", "while ((block_mig_state.submitted +\nblock_mig_state.read_done) * BLOCK_SIZE <\nqemu_file_get_rate_limit(VAR_1)) {", "if (block_mig_state.bulk_completed == 0) {", "if (blk_mig_save_bulked_block(VAR_0, VAR_1) == 0) {", "block_mig_state.bulk_completed = 1;", "}", "} else {", "if (blk_mig_save_dirty_block(VAR_0, VAR_1, 1) == 0) {", "break;", "}", "}", "}", "flush_blks(VAR_1);", "VAR_4 = qemu_file_get_error(VAR_1);", "if (VAR_4) {", "blk_mig_cleanup(VAR_0);", "return VAR_4;", "}", "}", "if (VAR_2 == 3) {", "assert(block_mig_state.submitted == 0);", "while (blk_mig_save_dirty_block(VAR_0, VAR_1, 0) != 0);", "blk_mig_cleanup(VAR_0);", "qemu_put_be64(VAR_1, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS);", "VAR_4 = qemu_file_get_error(VAR_1);", "if (VAR_4) {", "return VAR_4;", "}", "monitor_printf(VAR_0, \"Block migration completed\\n\");", "}", "qemu_put_be64(VAR_1, BLK_MIG_FLAG_EOS);", "return ((VAR_2 == 2) && is_stage2_completed());", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 71 ], [ 75, 77, 79 ], [ 81 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 133 ], [ 137 ], [ 139 ], [ 145 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 159 ], [ 161 ], [ 165 ], [ 169 ], [ 171 ] ]
8,299
int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname) { char line[1024], group[64], id[64], arg[64], value[1024]; Location loc; QemuOptsList *list = NULL; Error *local_err = NULL; QemuOpts *opts = NULL; int res = -1, lno = 0; loc_push_none(&loc); while (fgets(line, sizeof(line), fp) != NULL) { loc_set_file(fname, ++lno); if (line[0] == '\n') { /* skip empty lines */ continue; } if (line[0] == '#') { /* comment */ continue; } if (sscanf(line, "[%63s \"%63[^\"]\"]", group, id) == 2) { /* group with id */ list = find_list(lists, group, &local_err); if (local_err) { error_report_err(local_err); goto out; } opts = qemu_opts_create(list, id, 1, NULL); continue; } if (sscanf(line, "[%63[^]]]", group) == 1) { /* group without id */ list = find_list(lists, group, &local_err); if (local_err) { error_report_err(local_err); goto out; } opts = qemu_opts_create(list, NULL, 0, &error_abort); continue; } value[0] = '\0'; if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2 || sscanf(line, " %63s = \"\"", arg) == 1) { /* arg = value */ if (opts == NULL) { error_report("no group defined"); goto out; } qemu_opt_set(opts, arg, value, &local_err); if (local_err) { error_report_err(local_err); goto out; } continue; } error_report("parse error"); goto out; } if (ferror(fp)) { error_report("error reading file"); goto out; } res = 0; out: loc_pop(&loc); return res; }
false
qemu
e5766d6ec7524345f4c0fa284c065b68c5e93049
int qemu_config_parse(FILE *fp, QemuOptsList **lists, const char *fname) { char line[1024], group[64], id[64], arg[64], value[1024]; Location loc; QemuOptsList *list = NULL; Error *local_err = NULL; QemuOpts *opts = NULL; int res = -1, lno = 0; loc_push_none(&loc); while (fgets(line, sizeof(line), fp) != NULL) { loc_set_file(fname, ++lno); if (line[0] == '\n') { continue; } if (line[0] == '#') { continue; } if (sscanf(line, "[%63s \"%63[^\"]\"]", group, id) == 2) { list = find_list(lists, group, &local_err); if (local_err) { error_report_err(local_err); goto out; } opts = qemu_opts_create(list, id, 1, NULL); continue; } if (sscanf(line, "[%63[^]]]", group) == 1) { list = find_list(lists, group, &local_err); if (local_err) { error_report_err(local_err); goto out; } opts = qemu_opts_create(list, NULL, 0, &error_abort); continue; } value[0] = '\0'; if (sscanf(line, " %63s = \"%1023[^\"]\"", arg, value) == 2 || sscanf(line, " %63s = \"\"", arg) == 1) { if (opts == NULL) { error_report("no group defined"); goto out; } qemu_opt_set(opts, arg, value, &local_err); if (local_err) { error_report_err(local_err); goto out; } continue; } error_report("parse error"); goto out; } if (ferror(fp)) { error_report("error reading file"); goto out; } res = 0; out: loc_pop(&loc); return res; }
{ "code": [], "line_no": [] }
int FUNC_0(FILE *VAR_0, QemuOptsList **VAR_1, const char *VAR_2) { char VAR_3[1024], VAR_4[64], VAR_5[64], VAR_6[64], VAR_7[1024]; Location loc; QemuOptsList *list = NULL; Error *local_err = NULL; QemuOpts *opts = NULL; int VAR_8 = -1, VAR_9 = 0; loc_push_none(&loc); while (fgets(VAR_3, sizeof(VAR_3), VAR_0) != NULL) { loc_set_file(VAR_2, ++VAR_9); if (VAR_3[0] == '\n') { continue; } if (VAR_3[0] == '#') { continue; } if (sscanf(VAR_3, "[%63s \"%63[^\"]\"]", VAR_4, VAR_5) == 2) { list = find_list(VAR_1, VAR_4, &local_err); if (local_err) { error_report_err(local_err); goto out; } opts = qemu_opts_create(list, VAR_5, 1, NULL); continue; } if (sscanf(VAR_3, "[%63[^]]]", VAR_4) == 1) { list = find_list(VAR_1, VAR_4, &local_err); if (local_err) { error_report_err(local_err); goto out; } opts = qemu_opts_create(list, NULL, 0, &error_abort); continue; } VAR_7[0] = '\0'; if (sscanf(VAR_3, " %63s = \"%1023[^\"]\"", VAR_6, VAR_7) == 2 || sscanf(VAR_3, " %63s = \"\"", VAR_6) == 1) { if (opts == NULL) { error_report("no VAR_4 defined"); goto out; } qemu_opt_set(opts, VAR_6, VAR_7, &local_err); if (local_err) { error_report_err(local_err); goto out; } continue; } error_report("parse error"); goto out; } if (ferror(VAR_0)) { error_report("error reading file"); goto out; } VAR_8 = 0; out: loc_pop(&loc); return VAR_8; }
[ "int FUNC_0(FILE *VAR_0, QemuOptsList **VAR_1, const char *VAR_2)\n{", "char VAR_3[1024], VAR_4[64], VAR_5[64], VAR_6[64], VAR_7[1024];", "Location loc;", "QemuOptsList *list = NULL;", "Error *local_err = NULL;", "QemuOpts *opts = NULL;", "int VAR_8 = -1, VAR_9 = 0;", "loc_push_none(&loc);", "while (fgets(VAR_3, sizeof(VAR_3), VAR_0) != NULL) {", "loc_set_file(VAR_2, ++VAR_9);", "if (VAR_3[0] == '\\n') {", "continue;", "}", "if (VAR_3[0] == '#') {", "continue;", "}", "if (sscanf(VAR_3, \"[%63s \\\"%63[^\\\"]\\\"]\", VAR_4, VAR_5) == 2) {", "list = find_list(VAR_1, VAR_4, &local_err);", "if (local_err) {", "error_report_err(local_err);", "goto out;", "}", "opts = qemu_opts_create(list, VAR_5, 1, NULL);", "continue;", "}", "if (sscanf(VAR_3, \"[%63[^]]]\", VAR_4) == 1) {", "list = find_list(VAR_1, VAR_4, &local_err);", "if (local_err) {", "error_report_err(local_err);", "goto out;", "}", "opts = qemu_opts_create(list, NULL, 0, &error_abort);", "continue;", "}", "VAR_7[0] = '\\0';", "if (sscanf(VAR_3, \" %63s = \\\"%1023[^\\\"]\\\"\", VAR_6, VAR_7) == 2 ||\nsscanf(VAR_3, \" %63s = \\\"\\\"\", VAR_6) == 1) {", "if (opts == NULL) {", "error_report(\"no VAR_4 defined\");", "goto out;", "}", "qemu_opt_set(opts, VAR_6, VAR_7, &local_err);", "if (local_err) {", "error_report_err(local_err);", "goto out;", "}", "continue;", "}", "error_report(\"parse error\");", "goto out;", "}", "if (ferror(VAR_0)) {", "error_report(\"error reading file\");", "goto out;", "}", "VAR_8 = 0;", "out:\nloc_pop(&loc);", "return VAR_8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127, 129 ], [ 131 ], [ 133 ] ]
8,300
static void qmp_input_check_struct(Visitor *v, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); StackObject *tos = &qiv->stack[qiv->nb_stack - 1]; assert(qiv->nb_stack > 0); if (qiv->strict) { GHashTable *const top_ht = tos->h; if (top_ht) { GHashTableIter iter; const char *key; g_hash_table_iter_init(&iter, top_ht); if (g_hash_table_iter_next(&iter, (void **)&key, NULL)) { error_setg(errp, QERR_QMP_EXTRA_MEMBER, key); } } } }
false
qemu
3d344c2aabb7bc9b414321e3c52872901edebdda
static void qmp_input_check_struct(Visitor *v, Error **errp) { QmpInputVisitor *qiv = to_qiv(v); StackObject *tos = &qiv->stack[qiv->nb_stack - 1]; assert(qiv->nb_stack > 0); if (qiv->strict) { GHashTable *const top_ht = tos->h; if (top_ht) { GHashTableIter iter; const char *key; g_hash_table_iter_init(&iter, top_ht); if (g_hash_table_iter_next(&iter, (void **)&key, NULL)) { error_setg(errp, QERR_QMP_EXTRA_MEMBER, key); } } } }
{ "code": [], "line_no": [] }
static void FUNC_0(Visitor *VAR_0, Error **VAR_1) { QmpInputVisitor *qiv = to_qiv(VAR_0); StackObject *tos = &qiv->stack[qiv->nb_stack - 1]; assert(qiv->nb_stack > 0); if (qiv->strict) { GHashTable *const top_ht = tos->h; if (top_ht) { GHashTableIter iter; const char *VAR_2; g_hash_table_iter_init(&iter, top_ht); if (g_hash_table_iter_next(&iter, (void **)&VAR_2, NULL)) { error_setg(VAR_1, QERR_QMP_EXTRA_MEMBER, VAR_2); } } } }
[ "static void FUNC_0(Visitor *VAR_0, Error **VAR_1)\n{", "QmpInputVisitor *qiv = to_qiv(VAR_0);", "StackObject *tos = &qiv->stack[qiv->nb_stack - 1];", "assert(qiv->nb_stack > 0);", "if (qiv->strict) {", "GHashTable *const top_ht = tos->h;", "if (top_ht) {", "GHashTableIter iter;", "const char *VAR_2;", "g_hash_table_iter_init(&iter, top_ht);", "if (g_hash_table_iter_next(&iter, (void **)&VAR_2, NULL)) {", "error_setg(VAR_1, QERR_QMP_EXTRA_MEMBER, VAR_2);", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
8,301
int ff_get_line(AVIOContext *s, char *buf, int maxlen) { int i = 0; char c; do { c = avio_r8(s); if (c && i < maxlen-1) buf[i++] = c; } while (c != '\n' && c != '\r' && c); if (c == '\r' && avio_r8(s) != '\n') avio_skip(s, -1); buf[i] = 0; return i; }
false
FFmpeg
eac5c7b8377f3f0e8262ab44e5ccb2c7ed060cdd
int ff_get_line(AVIOContext *s, char *buf, int maxlen) { int i = 0; char c; do { c = avio_r8(s); if (c && i < maxlen-1) buf[i++] = c; } while (c != '\n' && c != '\r' && c); if (c == '\r' && avio_r8(s) != '\n') avio_skip(s, -1); buf[i] = 0; return i; }
{ "code": [], "line_no": [] }
int FUNC_0(AVIOContext *VAR_0, char *VAR_1, int VAR_2) { int VAR_3 = 0; char VAR_4; do { VAR_4 = avio_r8(VAR_0); if (VAR_4 && VAR_3 < VAR_2-1) VAR_1[VAR_3++] = VAR_4; } while (VAR_4 != '\n' && VAR_4 != '\r' && VAR_4); if (VAR_4 == '\r' && avio_r8(VAR_0) != '\n') avio_skip(VAR_0, -1); VAR_1[VAR_3] = 0; return VAR_3; }
[ "int FUNC_0(AVIOContext *VAR_0, char *VAR_1, int VAR_2)\n{", "int VAR_3 = 0;", "char VAR_4;", "do {", "VAR_4 = avio_r8(VAR_0);", "if (VAR_4 && VAR_3 < VAR_2-1)\nVAR_1[VAR_3++] = VAR_4;", "} while (VAR_4 != '\\n' && VAR_4 != '\\r' && VAR_4);", "if (VAR_4 == '\\r' && avio_r8(VAR_0) != '\\n')\navio_skip(VAR_0, -1);", "VAR_1[VAR_3] = 0;", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 27 ], [ 29 ], [ 31 ] ]
8,302
e1000e_intrmgr_delay_tx_causes(E1000ECore *core, uint32_t *causes) { static const uint32_t delayable_causes = E1000_ICR_TXQ0 | E1000_ICR_TXQ1 | E1000_ICR_TXQE | E1000_ICR_TXDW; if (msix_enabled(core->owner)) { return false; } /* Clean up all causes that may be delayed */ core->delayed_causes |= *causes & delayable_causes; *causes &= ~delayable_causes; /* If there are causes that cannot be delayed */ if (causes != 0) { return false; } /* All causes delayed */ e1000e_intrmgr_rearm_timer(&core->tidv); if (!core->tadv.running && (core->mac[TADV] != 0)) { e1000e_intrmgr_rearm_timer(&core->tadv); } return true; }
false
qemu
1ac6c07f4288b0a563310fad0cdabb3a47c85607
e1000e_intrmgr_delay_tx_causes(E1000ECore *core, uint32_t *causes) { static const uint32_t delayable_causes = E1000_ICR_TXQ0 | E1000_ICR_TXQ1 | E1000_ICR_TXQE | E1000_ICR_TXDW; if (msix_enabled(core->owner)) { return false; } core->delayed_causes |= *causes & delayable_causes; *causes &= ~delayable_causes; if (causes != 0) { return false; } e1000e_intrmgr_rearm_timer(&core->tidv); if (!core->tadv.running && (core->mac[TADV] != 0)) { e1000e_intrmgr_rearm_timer(&core->tadv); } return true; }
{ "code": [], "line_no": [] }
FUNC_0(E1000ECore *VAR_0, uint32_t *VAR_1) { static const uint32_t VAR_2 = E1000_ICR_TXQ0 | E1000_ICR_TXQ1 | E1000_ICR_TXQE | E1000_ICR_TXDW; if (msix_enabled(VAR_0->owner)) { return false; } VAR_0->delayed_causes |= *VAR_1 & VAR_2; *VAR_1 &= ~VAR_2; if (VAR_1 != 0) { return false; } e1000e_intrmgr_rearm_timer(&VAR_0->tidv); if (!VAR_0->tadv.running && (VAR_0->mac[TADV] != 0)) { e1000e_intrmgr_rearm_timer(&VAR_0->tadv); } return true; }
[ "FUNC_0(E1000ECore *VAR_0, uint32_t *VAR_1)\n{", "static const uint32_t VAR_2 = E1000_ICR_TXQ0 |\nE1000_ICR_TXQ1 |\nE1000_ICR_TXQE |\nE1000_ICR_TXDW;", "if (msix_enabled(VAR_0->owner)) {", "return false;", "}", "VAR_0->delayed_causes |= *VAR_1 & VAR_2;", "*VAR_1 &= ~VAR_2;", "if (VAR_1 != 0) {", "return false;", "}", "e1000e_intrmgr_rearm_timer(&VAR_0->tidv);", "if (!VAR_0->tadv.running && (VAR_0->mac[TADV] != 0)) {", "e1000e_intrmgr_rearm_timer(&VAR_0->tadv);", "}", "return true;", "}" ]
[ 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 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ] ]
8,303
static int qcow2_make_empty(BlockDriverState *bs) { BDRVQcow2State *s = bs->opaque; uint64_t start_sector; int sector_step = INT_MAX / BDRV_SECTOR_SIZE; int l1_clusters, ret = 0; l1_clusters = DIV_ROUND_UP(s->l1_size, s->cluster_size / sizeof(uint64_t)); if (s->qcow_version >= 3 && !s->snapshots && 3 + l1_clusters <= s->refcount_block_size) { /* The following function only works for qcow2 v3 images (it requires * the dirty flag) and only as long as there are no snapshots (because * it completely empties the image). Furthermore, the L1 table and three * additional clusters (image header, refcount table, one refcount * block) have to fit inside one refcount block. */ return make_completely_empty(bs); } /* This fallback code simply discards every active cluster; this is slow, * but works in all cases */ for (start_sector = 0; start_sector < bs->total_sectors; start_sector += sector_step) { /* As this function is generally used after committing an external * snapshot, QCOW2_DISCARD_SNAPSHOT seems appropriate. Also, the * default action for this kind of discard is to pass the discard, * which will ideally result in an actually smaller image file, as * is probably desired. */ ret = qcow2_discard_clusters(bs, start_sector * BDRV_SECTOR_SIZE, MIN(sector_step, bs->total_sectors - start_sector), QCOW2_DISCARD_SNAPSHOT, true); if (ret < 0) { break; } } return ret; }
false
qemu
a3e1505daec31ef56f0489f8c8fff1b8e4ca92bd
static int qcow2_make_empty(BlockDriverState *bs) { BDRVQcow2State *s = bs->opaque; uint64_t start_sector; int sector_step = INT_MAX / BDRV_SECTOR_SIZE; int l1_clusters, ret = 0; l1_clusters = DIV_ROUND_UP(s->l1_size, s->cluster_size / sizeof(uint64_t)); if (s->qcow_version >= 3 && !s->snapshots && 3 + l1_clusters <= s->refcount_block_size) { return make_completely_empty(bs); } for (start_sector = 0; start_sector < bs->total_sectors; start_sector += sector_step) { ret = qcow2_discard_clusters(bs, start_sector * BDRV_SECTOR_SIZE, MIN(sector_step, bs->total_sectors - start_sector), QCOW2_DISCARD_SNAPSHOT, true); if (ret < 0) { break; } } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0) { BDRVQcow2State *s = VAR_0->opaque; uint64_t start_sector; int VAR_1 = INT_MAX / BDRV_SECTOR_SIZE; int VAR_2, VAR_3 = 0; VAR_2 = DIV_ROUND_UP(s->l1_size, s->cluster_size / sizeof(uint64_t)); if (s->qcow_version >= 3 && !s->snapshots && 3 + VAR_2 <= s->refcount_block_size) { return make_completely_empty(VAR_0); } for (start_sector = 0; start_sector < VAR_0->total_sectors; start_sector += VAR_1) { VAR_3 = qcow2_discard_clusters(VAR_0, start_sector * BDRV_SECTOR_SIZE, MIN(VAR_1, VAR_0->total_sectors - start_sector), QCOW2_DISCARD_SNAPSHOT, true); if (VAR_3 < 0) { break; } } return VAR_3; }
[ "static int FUNC_0(BlockDriverState *VAR_0)\n{", "BDRVQcow2State *s = VAR_0->opaque;", "uint64_t start_sector;", "int VAR_1 = INT_MAX / BDRV_SECTOR_SIZE;", "int VAR_2, VAR_3 = 0;", "VAR_2 = DIV_ROUND_UP(s->l1_size, s->cluster_size / sizeof(uint64_t));", "if (s->qcow_version >= 3 && !s->snapshots &&\n3 + VAR_2 <= s->refcount_block_size) {", "return make_completely_empty(VAR_0);", "}", "for (start_sector = 0; start_sector < VAR_0->total_sectors;", "start_sector += VAR_1)\n{", "VAR_3 = qcow2_discard_clusters(VAR_0, start_sector * BDRV_SECTOR_SIZE,\nMIN(VAR_1,\nVAR_0->total_sectors - start_sector),\nQCOW2_DISCARD_SNAPSHOT, true);", "if (VAR_3 < 0) {", "break;", "}", "}", "return VAR_3;", "}" ]
[ 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 ], [ 19, 21 ], [ 33 ], [ 35 ], [ 43 ], [ 45, 47 ], [ 59, 61, 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ] ]
8,304
static void s390_cpu_full_reset(CPUState *s) { S390CPU *cpu = S390_CPU(s); S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); CPUS390XState *env = &cpu->env; int i; scc->parent_reset(s); cpu->env.sigp_order = 0; s390_cpu_set_state(CPU_STATE_STOPPED, cpu); memset(env, 0, offsetof(CPUS390XState, end_reset_fields)); /* architectured initial values for CR 0 and 14 */ env->cregs[0] = CR0_RESET; env->cregs[14] = CR14_RESET; /* architectured initial value for Breaking-Event-Address register */ env->gbea = 1; env->pfault_token = -1UL; env->ext_index = -1; for (i = 0; i < ARRAY_SIZE(env->io_index); i++) { env->io_index[i] = -1; } env->mchk_index = -1; /* tininess for underflow is detected before rounding */ set_float_detect_tininess(float_tininess_before_rounding, &env->fpu_status); /* Reset state inside the kernel that we cannot access yet from QEMU. */ if (kvm_enabled()) { kvm_s390_reset_vcpu(cpu); } }
false
qemu
d516f74c99b1a2c289cfba0bacf125cbc9b681e3
static void s390_cpu_full_reset(CPUState *s) { S390CPU *cpu = S390_CPU(s); S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); CPUS390XState *env = &cpu->env; int i; scc->parent_reset(s); cpu->env.sigp_order = 0; s390_cpu_set_state(CPU_STATE_STOPPED, cpu); memset(env, 0, offsetof(CPUS390XState, end_reset_fields)); env->cregs[0] = CR0_RESET; env->cregs[14] = CR14_RESET; env->gbea = 1; env->pfault_token = -1UL; env->ext_index = -1; for (i = 0; i < ARRAY_SIZE(env->io_index); i++) { env->io_index[i] = -1; } env->mchk_index = -1; set_float_detect_tininess(float_tininess_before_rounding, &env->fpu_status); if (kvm_enabled()) { kvm_s390_reset_vcpu(cpu); } }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0) { S390CPU *cpu = S390_CPU(VAR_0); S390CPUClass *scc = S390_CPU_GET_CLASS(cpu); CPUS390XState *env = &cpu->env; int VAR_1; scc->parent_reset(VAR_0); cpu->env.sigp_order = 0; s390_cpu_set_state(CPU_STATE_STOPPED, cpu); memset(env, 0, offsetof(CPUS390XState, end_reset_fields)); env->cregs[0] = CR0_RESET; env->cregs[14] = CR14_RESET; env->gbea = 1; env->pfault_token = -1UL; env->ext_index = -1; for (VAR_1 = 0; VAR_1 < ARRAY_SIZE(env->io_index); VAR_1++) { env->io_index[VAR_1] = -1; } env->mchk_index = -1; set_float_detect_tininess(float_tininess_before_rounding, &env->fpu_status); if (kvm_enabled()) { kvm_s390_reset_vcpu(cpu); } }
[ "static void FUNC_0(CPUState *VAR_0)\n{", "S390CPU *cpu = S390_CPU(VAR_0);", "S390CPUClass *scc = S390_CPU_GET_CLASS(cpu);", "CPUS390XState *env = &cpu->env;", "int VAR_1;", "scc->parent_reset(VAR_0);", "cpu->env.sigp_order = 0;", "s390_cpu_set_state(CPU_STATE_STOPPED, cpu);", "memset(env, 0, offsetof(CPUS390XState, end_reset_fields));", "env->cregs[0] = CR0_RESET;", "env->cregs[14] = CR14_RESET;", "env->gbea = 1;", "env->pfault_token = -1UL;", "env->ext_index = -1;", "for (VAR_1 = 0; VAR_1 < ARRAY_SIZE(env->io_index); VAR_1++) {", "env->io_index[VAR_1] = -1;", "}", "env->mchk_index = -1;", "set_float_detect_tininess(float_tininess_before_rounding,\n&env->fpu_status);", "if (kvm_enabled()) {", "kvm_s390_reset_vcpu(cpu);", "}", "}" ]
[ 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 ], [ 23 ], [ 29 ], [ 31 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57, 59 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
8,305
static bool ufd_version_check(int ufd) { struct uffdio_api api_struct; uint64_t ioctl_mask; api_struct.api = UFFD_API; api_struct.features = 0; if (ioctl(ufd, UFFDIO_API, &api_struct)) { error_report("postcopy_ram_supported_by_host: UFFDIO_API failed: %s", strerror(errno)); return false; } ioctl_mask = (__u64)1 << _UFFDIO_REGISTER | (__u64)1 << _UFFDIO_UNREGISTER; if ((api_struct.ioctls & ioctl_mask) != ioctl_mask) { error_report("Missing userfault features: %" PRIx64, (uint64_t)(~api_struct.ioctls & ioctl_mask)); return false; } if (getpagesize() != ram_pagesize_summary()) { bool have_hp = false; /* We've got a huge page */ #ifdef UFFD_FEATURE_MISSING_HUGETLBFS have_hp = api_struct.features & UFFD_FEATURE_MISSING_HUGETLBFS; #endif if (!have_hp) { error_report("Userfault on this host does not support huge pages"); return false; } } return true; }
false
qemu
d7651f150d61936344c4fab45eaeb0716c606af2
static bool ufd_version_check(int ufd) { struct uffdio_api api_struct; uint64_t ioctl_mask; api_struct.api = UFFD_API; api_struct.features = 0; if (ioctl(ufd, UFFDIO_API, &api_struct)) { error_report("postcopy_ram_supported_by_host: UFFDIO_API failed: %s", strerror(errno)); return false; } ioctl_mask = (__u64)1 << _UFFDIO_REGISTER | (__u64)1 << _UFFDIO_UNREGISTER; if ((api_struct.ioctls & ioctl_mask) != ioctl_mask) { error_report("Missing userfault features: %" PRIx64, (uint64_t)(~api_struct.ioctls & ioctl_mask)); return false; } if (getpagesize() != ram_pagesize_summary()) { bool have_hp = false; #ifdef UFFD_FEATURE_MISSING_HUGETLBFS have_hp = api_struct.features & UFFD_FEATURE_MISSING_HUGETLBFS; #endif if (!have_hp) { error_report("Userfault on this host does not support huge pages"); return false; } } return true; }
{ "code": [], "line_no": [] }
static bool FUNC_0(int ufd) { struct uffdio_api VAR_0; uint64_t ioctl_mask; VAR_0.api = UFFD_API; VAR_0.features = 0; if (ioctl(ufd, UFFDIO_API, &VAR_0)) { error_report("postcopy_ram_supported_by_host: UFFDIO_API failed: %s", strerror(errno)); return false; } ioctl_mask = (__u64)1 << _UFFDIO_REGISTER | (__u64)1 << _UFFDIO_UNREGISTER; if ((VAR_0.ioctls & ioctl_mask) != ioctl_mask) { error_report("Missing userfault features: %" PRIx64, (uint64_t)(~VAR_0.ioctls & ioctl_mask)); return false; } if (getpagesize() != ram_pagesize_summary()) { bool have_hp = false; #ifdef UFFD_FEATURE_MISSING_HUGETLBFS have_hp = VAR_0.features & UFFD_FEATURE_MISSING_HUGETLBFS; #endif if (!have_hp) { error_report("Userfault on this host does not support huge pages"); return false; } } return true; }
[ "static bool FUNC_0(int ufd)\n{", "struct uffdio_api VAR_0;", "uint64_t ioctl_mask;", "VAR_0.api = UFFD_API;", "VAR_0.features = 0;", "if (ioctl(ufd, UFFDIO_API, &VAR_0)) {", "error_report(\"postcopy_ram_supported_by_host: UFFDIO_API failed: %s\",\nstrerror(errno));", "return false;", "}", "ioctl_mask = (__u64)1 << _UFFDIO_REGISTER |\n(__u64)1 << _UFFDIO_UNREGISTER;", "if ((VAR_0.ioctls & ioctl_mask) != ioctl_mask) {", "error_report(\"Missing userfault features: %\" PRIx64,\n(uint64_t)(~VAR_0.ioctls & ioctl_mask));", "return false;", "}", "if (getpagesize() != ram_pagesize_summary()) {", "bool have_hp = false;", "#ifdef UFFD_FEATURE_MISSING_HUGETLBFS\nhave_hp = VAR_0.features & UFFD_FEATURE_MISSING_HUGETLBFS;", "#endif\nif (!have_hp) {", "error_report(\"Userfault on this host does not support huge pages\");", "return false;", "}", "}", "return true;", "}" ]
[ 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 ], [ 27, 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49, 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ] ]
8,306
static void string_output_append(StringOutputVisitor *sov, int64_t a) { Range *r = g_malloc0(sizeof(*r)); r->begin = a; r->end = a + 1; sov->ranges = range_list_insert(sov->ranges, r); }
false
qemu
a0efbf16604770b9d805bcf210ec29942321134f
static void string_output_append(StringOutputVisitor *sov, int64_t a) { Range *r = g_malloc0(sizeof(*r)); r->begin = a; r->end = a + 1; sov->ranges = range_list_insert(sov->ranges, r); }
{ "code": [], "line_no": [] }
static void FUNC_0(StringOutputVisitor *VAR_0, int64_t VAR_1) { Range *r = g_malloc0(sizeof(*r)); r->begin = VAR_1; r->end = VAR_1 + 1; VAR_0->ranges = range_list_insert(VAR_0->ranges, r); }
[ "static void FUNC_0(StringOutputVisitor *VAR_0, int64_t VAR_1)\n{", "Range *r = g_malloc0(sizeof(*r));", "r->begin = VAR_1;", "r->end = VAR_1 + 1;", "VAR_0->ranges = range_list_insert(VAR_0->ranges, r);", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
8,307
static void aarch64_cpu_register(const ARMCPUInfo *info) { TypeInfo type_info = { .parent = TYPE_AARCH64_CPU, .instance_size = sizeof(ARMCPU), .instance_init = info->initfn, .class_size = sizeof(ARMCPUClass), .class_init = info->class_init, }; /* TODO: drop when we support more CPUs - all entries will have name set */ if (!info->name) { return; } type_info.name = g_strdup_printf("%s-" TYPE_ARM_CPU, info->name); type_register(&type_info); g_free((void *)type_info.name); }
false
qemu
83e6813a93e38976391b8c382c3375e3e188df3e
static void aarch64_cpu_register(const ARMCPUInfo *info) { TypeInfo type_info = { .parent = TYPE_AARCH64_CPU, .instance_size = sizeof(ARMCPU), .instance_init = info->initfn, .class_size = sizeof(ARMCPUClass), .class_init = info->class_init, }; if (!info->name) { return; } type_info.name = g_strdup_printf("%s-" TYPE_ARM_CPU, info->name); type_register(&type_info); g_free((void *)type_info.name); }
{ "code": [], "line_no": [] }
static void FUNC_0(const ARMCPUInfo *VAR_0) { TypeInfo type_info = { .parent = TYPE_AARCH64_CPU, .instance_size = sizeof(ARMCPU), .instance_init = VAR_0->initfn, .class_size = sizeof(ARMCPUClass), .class_init = VAR_0->class_init, }; if (!VAR_0->name) { return; } type_info.name = g_strdup_printf("%s-" TYPE_ARM_CPU, VAR_0->name); type_register(&type_info); g_free((void *)type_info.name); }
[ "static void FUNC_0(const ARMCPUInfo *VAR_0)\n{", "TypeInfo type_info = {", ".parent = TYPE_AARCH64_CPU,\n.instance_size = sizeof(ARMCPU),\n.instance_init = VAR_0->initfn,\n.class_size = sizeof(ARMCPUClass),\n.class_init = VAR_0->class_init,\n};", "if (!VAR_0->name) {", "return;", "}", "type_info.name = g_strdup_printf(\"%s-\" TYPE_ARM_CPU, VAR_0->name);", "type_register(&type_info);", "g_free((void *)type_info.name);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9, 11, 13, 15, 17 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
8,308
static void tx_fifo_push(lan9118_state *s, uint32_t val) { int n; if (s->txp->fifo_used == s->tx_fifo_size) { s->int_sts |= TDFO_INT; return; } switch (s->txp->state) { case TX_IDLE: s->txp->cmd_a = val & 0x831f37ff; s->txp->fifo_used++; s->txp->state = TX_B; s->txp->buffer_size = extract32(s->txp->cmd_a, 0, 11); s->txp->offset = extract32(s->txp->cmd_a, 16, 5); break; case TX_B: if (s->txp->cmd_a & 0x2000) { /* First segment */ s->txp->cmd_b = val; s->txp->fifo_used++; /* End alignment does not include command words. */ n = (s->txp->buffer_size + s->txp->offset + 3) >> 2; switch ((n >> 24) & 3) { case 1: n = (-n) & 3; break; case 2: n = (-n) & 7; break; default: n = 0; } s->txp->pad = n; s->txp->len = 0; } DPRINTF("Block len:%d offset:%d pad:%d cmd %08x\n", s->txp->buffer_size, s->txp->offset, s->txp->pad, s->txp->cmd_a); s->txp->state = TX_DATA; break; case TX_DATA: if (s->txp->offset >= 4) { s->txp->offset -= 4; break; } if (s->txp->buffer_size <= 0 && s->txp->pad != 0) { s->txp->pad--; } else { n = 4; while (s->txp->offset) { val >>= 8; n--; s->txp->offset--; } /* Documentation is somewhat unclear on the ordering of bytes in FIFO words. Empirical results show it to be little-endian. */ /* TODO: FIFO overflow checking. */ while (n--) { s->txp->data[s->txp->len] = val & 0xff; s->txp->len++; val >>= 8; s->txp->buffer_size--; } s->txp->fifo_used++; } if (s->txp->buffer_size <= 0 && s->txp->pad == 0) { if (s->txp->cmd_a & 0x1000) { do_tx_packet(s); } if (s->txp->cmd_a & 0x80000000) { s->int_sts |= TX_IOC_INT; } s->txp->state = TX_IDLE; } break; } }
false
qemu
c444dfabfc21cb5f093862100e333b808eea32e4
static void tx_fifo_push(lan9118_state *s, uint32_t val) { int n; if (s->txp->fifo_used == s->tx_fifo_size) { s->int_sts |= TDFO_INT; return; } switch (s->txp->state) { case TX_IDLE: s->txp->cmd_a = val & 0x831f37ff; s->txp->fifo_used++; s->txp->state = TX_B; s->txp->buffer_size = extract32(s->txp->cmd_a, 0, 11); s->txp->offset = extract32(s->txp->cmd_a, 16, 5); break; case TX_B: if (s->txp->cmd_a & 0x2000) { s->txp->cmd_b = val; s->txp->fifo_used++; n = (s->txp->buffer_size + s->txp->offset + 3) >> 2; switch ((n >> 24) & 3) { case 1: n = (-n) & 3; break; case 2: n = (-n) & 7; break; default: n = 0; } s->txp->pad = n; s->txp->len = 0; } DPRINTF("Block len:%d offset:%d pad:%d cmd %08x\n", s->txp->buffer_size, s->txp->offset, s->txp->pad, s->txp->cmd_a); s->txp->state = TX_DATA; break; case TX_DATA: if (s->txp->offset >= 4) { s->txp->offset -= 4; break; } if (s->txp->buffer_size <= 0 && s->txp->pad != 0) { s->txp->pad--; } else { n = 4; while (s->txp->offset) { val >>= 8; n--; s->txp->offset--; } while (n--) { s->txp->data[s->txp->len] = val & 0xff; s->txp->len++; val >>= 8; s->txp->buffer_size--; } s->txp->fifo_used++; } if (s->txp->buffer_size <= 0 && s->txp->pad == 0) { if (s->txp->cmd_a & 0x1000) { do_tx_packet(s); } if (s->txp->cmd_a & 0x80000000) { s->int_sts |= TX_IOC_INT; } s->txp->state = TX_IDLE; } break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(lan9118_state *VAR_0, uint32_t VAR_1) { int VAR_2; if (VAR_0->txp->fifo_used == VAR_0->tx_fifo_size) { VAR_0->int_sts |= TDFO_INT; return; } switch (VAR_0->txp->state) { case TX_IDLE: VAR_0->txp->cmd_a = VAR_1 & 0x831f37ff; VAR_0->txp->fifo_used++; VAR_0->txp->state = TX_B; VAR_0->txp->buffer_size = extract32(VAR_0->txp->cmd_a, 0, 11); VAR_0->txp->offset = extract32(VAR_0->txp->cmd_a, 16, 5); break; case TX_B: if (VAR_0->txp->cmd_a & 0x2000) { VAR_0->txp->cmd_b = VAR_1; VAR_0->txp->fifo_used++; VAR_2 = (VAR_0->txp->buffer_size + VAR_0->txp->offset + 3) >> 2; switch ((VAR_2 >> 24) & 3) { case 1: VAR_2 = (-VAR_2) & 3; break; case 2: VAR_2 = (-VAR_2) & 7; break; default: VAR_2 = 0; } VAR_0->txp->pad = VAR_2; VAR_0->txp->len = 0; } DPRINTF("Block len:%d offset:%d pad:%d cmd %08x\VAR_2", VAR_0->txp->buffer_size, VAR_0->txp->offset, VAR_0->txp->pad, VAR_0->txp->cmd_a); VAR_0->txp->state = TX_DATA; break; case TX_DATA: if (VAR_0->txp->offset >= 4) { VAR_0->txp->offset -= 4; break; } if (VAR_0->txp->buffer_size <= 0 && VAR_0->txp->pad != 0) { VAR_0->txp->pad--; } else { VAR_2 = 4; while (VAR_0->txp->offset) { VAR_1 >>= 8; VAR_2--; VAR_0->txp->offset--; } while (VAR_2--) { VAR_0->txp->data[VAR_0->txp->len] = VAR_1 & 0xff; VAR_0->txp->len++; VAR_1 >>= 8; VAR_0->txp->buffer_size--; } VAR_0->txp->fifo_used++; } if (VAR_0->txp->buffer_size <= 0 && VAR_0->txp->pad == 0) { if (VAR_0->txp->cmd_a & 0x1000) { do_tx_packet(VAR_0); } if (VAR_0->txp->cmd_a & 0x80000000) { VAR_0->int_sts |= TX_IOC_INT; } VAR_0->txp->state = TX_IDLE; } break; } }
[ "static void FUNC_0(lan9118_state *VAR_0, uint32_t VAR_1)\n{", "int VAR_2;", "if (VAR_0->txp->fifo_used == VAR_0->tx_fifo_size) {", "VAR_0->int_sts |= TDFO_INT;", "return;", "}", "switch (VAR_0->txp->state) {", "case TX_IDLE:\nVAR_0->txp->cmd_a = VAR_1 & 0x831f37ff;", "VAR_0->txp->fifo_used++;", "VAR_0->txp->state = TX_B;", "VAR_0->txp->buffer_size = extract32(VAR_0->txp->cmd_a, 0, 11);", "VAR_0->txp->offset = extract32(VAR_0->txp->cmd_a, 16, 5);", "break;", "case TX_B:\nif (VAR_0->txp->cmd_a & 0x2000) {", "VAR_0->txp->cmd_b = VAR_1;", "VAR_0->txp->fifo_used++;", "VAR_2 = (VAR_0->txp->buffer_size + VAR_0->txp->offset + 3) >> 2;", "switch ((VAR_2 >> 24) & 3) {", "case 1:\nVAR_2 = (-VAR_2) & 3;", "break;", "case 2:\nVAR_2 = (-VAR_2) & 7;", "break;", "default:\nVAR_2 = 0;", "}", "VAR_0->txp->pad = VAR_2;", "VAR_0->txp->len = 0;", "}", "DPRINTF(\"Block len:%d offset:%d pad:%d cmd %08x\\VAR_2\",\nVAR_0->txp->buffer_size, VAR_0->txp->offset, VAR_0->txp->pad,\nVAR_0->txp->cmd_a);", "VAR_0->txp->state = TX_DATA;", "break;", "case TX_DATA:\nif (VAR_0->txp->offset >= 4) {", "VAR_0->txp->offset -= 4;", "break;", "}", "if (VAR_0->txp->buffer_size <= 0 && VAR_0->txp->pad != 0) {", "VAR_0->txp->pad--;", "} else {", "VAR_2 = 4;", "while (VAR_0->txp->offset) {", "VAR_1 >>= 8;", "VAR_2--;", "VAR_0->txp->offset--;", "}", "while (VAR_2--) {", "VAR_0->txp->data[VAR_0->txp->len] = VAR_1 & 0xff;", "VAR_0->txp->len++;", "VAR_1 >>= 8;", "VAR_0->txp->buffer_size--;", "}", "VAR_0->txp->fifo_used++;", "}", "if (VAR_0->txp->buffer_size <= 0 && VAR_0->txp->pad == 0) {", "if (VAR_0->txp->cmd_a & 0x1000) {", "do_tx_packet(VAR_0);", "}", "if (VAR_0->txp->cmd_a & 0x80000000) {", "VAR_0->int_sts |= TX_IOC_INT;", "}", "VAR_0->txp->state = TX_IDLE;", "}", "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, 0, 0, 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 ], [ 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 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ] ]
8,309
int ff_h264_decode_ref_pic_list_reordering(H264Context *h) { int list, index, pic_structure, i; print_short_term(h); print_long_term(h); for (list = 0; list < h->list_count; list++) { for (i = 0; i < h->ref_count[list]; i++) COPY_PICTURE(&h->ref_list[list][i], &h->default_ref_list[list][i]); if (get_bits1(&h->gb)) { int pred = h->curr_pic_num; for (index = 0; ; index++) { unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(&h->gb); unsigned int pic_id; int i; Picture *ref = NULL; if (reordering_of_pic_nums_idc == 3) break; if (index >= h->ref_count[list]) { av_log(h->avctx, AV_LOG_ERROR, "reference count overflow\n"); return -1; } if (reordering_of_pic_nums_idc < 3) { if (reordering_of_pic_nums_idc < 2) { const unsigned int abs_diff_pic_num = get_ue_golomb(&h->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 -1; } if (reordering_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; } else { int long_idx; pic_id = get_ue_golomb(&h->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 -1; } ref = h->long_ref[long_idx]; assert(!(ref && !ref->reference)); if (ref && (ref->reference & pic_structure)) { ref->pic_id = pic_id; assert(ref->long_ref); i = 0; } else { i = -1; } } if (i < 0) { av_log(h->avctx, AV_LOG_ERROR, "reference picture missing during reorder\n"); memset(&h->ref_list[list][index], 0, sizeof(Picture)); //FIXME } else { for (i = index; i + 1 < h->ref_count[list]; i++) { if (ref->long_ref == h->ref_list[list][i].long_ref && ref->pic_id == h->ref_list[list][i].pic_id) break; } for (; i > index; i--) { COPY_PICTURE(&h->ref_list[list][i], &h->ref_list[list][i - 1]); } COPY_PICTURE(&h->ref_list[list][index], ref); if (FIELD_PICTURE(h)) { pic_as_field(&h->ref_list[list][index], pic_structure); } } } else { av_log(h->avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n"); return -1; } } } } for (list = 0; list < h->list_count; list++) { for (index = 0; index < h->ref_count[list]; index++) { if (!h->ref_list[list][index].f.data[0]) { av_log(h->avctx, AV_LOG_ERROR, "Missing reference picture\n"); if (h->default_ref_list[list][0].f.data[0]) COPY_PICTURE(&h->ref_list[list][index], &h->default_ref_list[list][0]); else return -1; } } } return 0; }
false
FFmpeg
a553c6a347d3d28d7ee44c3df3d5c4ee780dba23
int ff_h264_decode_ref_pic_list_reordering(H264Context *h) { int list, index, pic_structure, i; print_short_term(h); print_long_term(h); for (list = 0; list < h->list_count; list++) { for (i = 0; i < h->ref_count[list]; i++) COPY_PICTURE(&h->ref_list[list][i], &h->default_ref_list[list][i]); if (get_bits1(&h->gb)) { int pred = h->curr_pic_num; for (index = 0; ; index++) { unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(&h->gb); unsigned int pic_id; int i; Picture *ref = NULL; if (reordering_of_pic_nums_idc == 3) break; if (index >= h->ref_count[list]) { av_log(h->avctx, AV_LOG_ERROR, "reference count overflow\n"); return -1; } if (reordering_of_pic_nums_idc < 3) { if (reordering_of_pic_nums_idc < 2) { const unsigned int abs_diff_pic_num = get_ue_golomb(&h->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 -1; } if (reordering_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; } else { int long_idx; pic_id = get_ue_golomb(&h->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 -1; } ref = h->long_ref[long_idx]; assert(!(ref && !ref->reference)); if (ref && (ref->reference & pic_structure)) { ref->pic_id = pic_id; assert(ref->long_ref); i = 0; } else { i = -1; } } if (i < 0) { av_log(h->avctx, AV_LOG_ERROR, "reference picture missing during reorder\n"); memset(&h->ref_list[list][index], 0, sizeof(Picture)); } else { for (i = index; i + 1 < h->ref_count[list]; i++) { if (ref->long_ref == h->ref_list[list][i].long_ref && ref->pic_id == h->ref_list[list][i].pic_id) break; } for (; i > index; i--) { COPY_PICTURE(&h->ref_list[list][i], &h->ref_list[list][i - 1]); } COPY_PICTURE(&h->ref_list[list][index], ref); if (FIELD_PICTURE(h)) { pic_as_field(&h->ref_list[list][index], pic_structure); } } } else { av_log(h->avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n"); return -1; } } } } for (list = 0; list < h->list_count; list++) { for (index = 0; index < h->ref_count[list]; index++) { if (!h->ref_list[list][index].f.data[0]) { av_log(h->avctx, AV_LOG_ERROR, "Missing reference picture\n"); if (h->default_ref_list[list][0].f.data[0]) COPY_PICTURE(&h->ref_list[list][index], &h->default_ref_list[list][0]); else return -1; } } } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(H264Context *VAR_0) { int VAR_1, VAR_2, VAR_3, VAR_4; print_short_term(VAR_0); print_long_term(VAR_0); for (VAR_1 = 0; VAR_1 < VAR_0->list_count; VAR_1++) { for (VAR_4 = 0; VAR_4 < VAR_0->ref_count[VAR_1]; VAR_4++) COPY_PICTURE(&VAR_0->ref_list[VAR_1][VAR_4], &VAR_0->default_ref_list[VAR_1][VAR_4]); if (get_bits1(&VAR_0->gb)) { int pred = VAR_0->curr_pic_num; for (VAR_2 = 0; ; VAR_2++) { unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(&VAR_0->gb); unsigned int pic_id; int VAR_4; Picture *ref = NULL; if (reordering_of_pic_nums_idc == 3) break; if (VAR_2 >= VAR_0->ref_count[VAR_1]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "reference count overflow\n"); return -1; } if (reordering_of_pic_nums_idc < 3) { if (reordering_of_pic_nums_idc < 2) { const unsigned int abs_diff_pic_num = get_ue_golomb(&VAR_0->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 -1; } if (reordering_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_3); for (VAR_4 = VAR_0->short_ref_count - 1; VAR_4 >= 0; VAR_4--) { ref = VAR_0->short_ref[VAR_4]; assert(ref->reference); assert(!ref->long_ref); if (ref->frame_num == frame_num && (ref->reference & VAR_3)) break; } if (VAR_4 >= 0) ref->pic_id = pred; } else { int long_idx; pic_id = get_ue_golomb(&VAR_0->gb); long_idx = pic_num_extract(VAR_0, pic_id, &VAR_3); if (long_idx > 31) { av_log(VAR_0->avctx, AV_LOG_ERROR, "long_term_pic_idx overflow\n"); return -1; } ref = VAR_0->long_ref[long_idx]; assert(!(ref && !ref->reference)); if (ref && (ref->reference & VAR_3)) { ref->pic_id = pic_id; assert(ref->long_ref); VAR_4 = 0; } else { VAR_4 = -1; } } if (VAR_4 < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "reference picture missing during reorder\n"); memset(&VAR_0->ref_list[VAR_1][VAR_2], 0, sizeof(Picture)); } else { for (VAR_4 = VAR_2; VAR_4 + 1 < VAR_0->ref_count[VAR_1]; VAR_4++) { if (ref->long_ref == VAR_0->ref_list[VAR_1][VAR_4].long_ref && ref->pic_id == VAR_0->ref_list[VAR_1][VAR_4].pic_id) break; } for (; VAR_4 > VAR_2; VAR_4--) { COPY_PICTURE(&VAR_0->ref_list[VAR_1][VAR_4], &VAR_0->ref_list[VAR_1][VAR_4 - 1]); } COPY_PICTURE(&VAR_0->ref_list[VAR_1][VAR_2], ref); if (FIELD_PICTURE(VAR_0)) { pic_as_field(&VAR_0->ref_list[VAR_1][VAR_2], VAR_3); } } } else { av_log(VAR_0->avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n"); return -1; } } } } for (VAR_1 = 0; VAR_1 < VAR_0->list_count; VAR_1++) { for (VAR_2 = 0; VAR_2 < VAR_0->ref_count[VAR_1]; VAR_2++) { if (!VAR_0->ref_list[VAR_1][VAR_2].f.data[0]) { av_log(VAR_0->avctx, AV_LOG_ERROR, "Missing reference picture\n"); if (VAR_0->default_ref_list[VAR_1][0].f.data[0]) COPY_PICTURE(&VAR_0->ref_list[VAR_1][VAR_2], &VAR_0->default_ref_list[VAR_1][0]); else return -1; } } } return 0; }
[ "int FUNC_0(H264Context *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3, VAR_4;", "print_short_term(VAR_0);", "print_long_term(VAR_0);", "for (VAR_1 = 0; VAR_1 < VAR_0->list_count; VAR_1++) {", "for (VAR_4 = 0; VAR_4 < VAR_0->ref_count[VAR_1]; VAR_4++)", "COPY_PICTURE(&VAR_0->ref_list[VAR_1][VAR_4], &VAR_0->default_ref_list[VAR_1][VAR_4]);", "if (get_bits1(&VAR_0->gb)) {", "int pred = VAR_0->curr_pic_num;", "for (VAR_2 = 0; ; VAR_2++) {", "unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(&VAR_0->gb);", "unsigned int pic_id;", "int VAR_4;", "Picture *ref = NULL;", "if (reordering_of_pic_nums_idc == 3)\nbreak;", "if (VAR_2 >= VAR_0->ref_count[VAR_1]) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"reference count overflow\\n\");", "return -1;", "}", "if (reordering_of_pic_nums_idc < 3) {", "if (reordering_of_pic_nums_idc < 2) {", "const unsigned int abs_diff_pic_num = get_ue_golomb(&VAR_0->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 -1;", "}", "if (reordering_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_3);", "for (VAR_4 = VAR_0->short_ref_count - 1; VAR_4 >= 0; VAR_4--) {", "ref = VAR_0->short_ref[VAR_4];", "assert(ref->reference);", "assert(!ref->long_ref);", "if (ref->frame_num == frame_num &&\n(ref->reference & VAR_3))\nbreak;", "}", "if (VAR_4 >= 0)\nref->pic_id = pred;", "} else {", "int long_idx;", "pic_id = get_ue_golomb(&VAR_0->gb);", "long_idx = pic_num_extract(VAR_0, pic_id, &VAR_3);", "if (long_idx > 31) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"long_term_pic_idx overflow\\n\");", "return -1;", "}", "ref = VAR_0->long_ref[long_idx];", "assert(!(ref && !ref->reference));", "if (ref && (ref->reference & VAR_3)) {", "ref->pic_id = pic_id;", "assert(ref->long_ref);", "VAR_4 = 0;", "} else {", "VAR_4 = -1;", "}", "}", "if (VAR_4 < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"reference picture missing during reorder\\n\");", "memset(&VAR_0->ref_list[VAR_1][VAR_2], 0, sizeof(Picture));", "} else {", "for (VAR_4 = VAR_2; VAR_4 + 1 < VAR_0->ref_count[VAR_1]; VAR_4++) {", "if (ref->long_ref == VAR_0->ref_list[VAR_1][VAR_4].long_ref &&\nref->pic_id == VAR_0->ref_list[VAR_1][VAR_4].pic_id)\nbreak;", "}", "for (; VAR_4 > VAR_2; VAR_4--) {", "COPY_PICTURE(&VAR_0->ref_list[VAR_1][VAR_4], &VAR_0->ref_list[VAR_1][VAR_4 - 1]);", "}", "COPY_PICTURE(&VAR_0->ref_list[VAR_1][VAR_2], ref);", "if (FIELD_PICTURE(VAR_0)) {", "pic_as_field(&VAR_0->ref_list[VAR_1][VAR_2], VAR_3);", "}", "}", "} else {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"illegal reordering_of_pic_nums_idc\\n\");", "return -1;", "}", "}", "}", "}", "for (VAR_1 = 0; VAR_1 < VAR_0->list_count; VAR_1++) {", "for (VAR_2 = 0; VAR_2 < VAR_0->ref_count[VAR_1]; VAR_2++) {", "if (!VAR_0->ref_list[VAR_1][VAR_2].f.data[0]) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"Missing reference picture\\n\");", "if (VAR_0->default_ref_list[VAR_1][0].f.data[0])\nCOPY_PICTURE(&VAR_0->ref_list[VAR_1][VAR_2], &VAR_0->default_ref_list[VAR_1][0]);", "else\nreturn -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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77, 79 ], [ 81, 83 ], [ 85 ], [ 89 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103, 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165, 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211, 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 223 ], [ 227 ], [ 229 ] ]
8,310
static enum AVHWDeviceType hw_device_match_type_by_hwaccel(enum HWAccelID hwaccel_id) { int i; if (hwaccel_id == HWACCEL_NONE) return AV_HWDEVICE_TYPE_NONE; for (i = 0; hwaccels[i].name; i++) { if (hwaccels[i].id == hwaccel_id) return hwaccels[i].device_type; } return AV_HWDEVICE_TYPE_NONE; }
false
FFmpeg
b0cd14fb1dab4b044f7fe6b53ac635409849de77
static enum AVHWDeviceType hw_device_match_type_by_hwaccel(enum HWAccelID hwaccel_id) { int i; if (hwaccel_id == HWACCEL_NONE) return AV_HWDEVICE_TYPE_NONE; for (i = 0; hwaccels[i].name; i++) { if (hwaccels[i].id == hwaccel_id) return hwaccels[i].device_type; } return AV_HWDEVICE_TYPE_NONE; }
{ "code": [], "line_no": [] }
static enum AVHWDeviceType FUNC_0(enum HWAccelID VAR_0) { int VAR_1; if (VAR_0 == HWACCEL_NONE) return AV_HWDEVICE_TYPE_NONE; for (VAR_1 = 0; hwaccels[VAR_1].name; VAR_1++) { if (hwaccels[VAR_1].id == VAR_0) return hwaccels[VAR_1].device_type; } return AV_HWDEVICE_TYPE_NONE; }
[ "static enum AVHWDeviceType FUNC_0(enum HWAccelID VAR_0)\n{", "int VAR_1;", "if (VAR_0 == HWACCEL_NONE)\nreturn AV_HWDEVICE_TYPE_NONE;", "for (VAR_1 = 0; hwaccels[VAR_1].name; VAR_1++) {", "if (hwaccels[VAR_1].id == VAR_0)\nreturn hwaccels[VAR_1].device_type;", "}", "return AV_HWDEVICE_TYPE_NONE;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 21 ] ]
8,312
int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_count, const uint8_t *in_arg [SWR_CH_MAX], int in_count){ AudioData * in= &s->in; AudioData *out= &s->out; if(s->drop_output > 0){ int ret; uint8_t *tmp_arg[SWR_CH_MAX]; if((ret=swri_realloc_audio(&s->drop_temp, s->drop_output))<0) return ret; reversefill_audiodata(&s->drop_temp, tmp_arg); s->drop_output *= -1; //FIXME find a less hackish solution ret = swr_convert(s, tmp_arg, -s->drop_output, in_arg, in_count); //FIXME optimize but this is as good as never called so maybe it doesnt matter s->drop_output *= -1; if(ret>0) s->drop_output -= ret; if(s->drop_output || !out_arg) return 0; in_count = 0; } if(!in_arg){ if(s->resample){ if (!s->flushed) s->resampler->flush(s); s->resample_in_constraint = 0; s->flushed = 1; }else if(!s->in_buffer_count){ return 0; } }else fill_audiodata(in , (void*)in_arg); fill_audiodata(out, out_arg); if(s->resample){ int ret = swr_convert_internal(s, out, out_count, in, in_count); if(ret>0 && !s->drop_output) s->outpts += ret * (int64_t)s->in_sample_rate; return ret; }else{ AudioData tmp= *in; int ret2=0; int ret, size; size = FFMIN(out_count, s->in_buffer_count); if(size){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index); ret= swr_convert_internal(s, out, size, &tmp, size); if(ret<0) return ret; ret2= ret; s->in_buffer_count -= ret; s->in_buffer_index += ret; buf_set(out, out, ret); out_count -= ret; if(!s->in_buffer_count) s->in_buffer_index = 0; } if(in_count){ size= s->in_buffer_index + s->in_buffer_count + in_count - out_count; if(in_count > out_count) { //FIXME move after swr_convert_internal if( size > s->in_buffer.count && s->in_buffer_count + in_count - out_count <= s->in_buffer_index){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index); copy(&s->in_buffer, &tmp, s->in_buffer_count); s->in_buffer_index=0; }else if((ret=swri_realloc_audio(&s->in_buffer, size)) < 0) return ret; } if(out_count){ size = FFMIN(in_count, out_count); ret= swr_convert_internal(s, out, size, in, size); if(ret<0) return ret; buf_set(in, in, ret); in_count -= ret; ret2 += ret; } if(in_count){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index + s->in_buffer_count); copy(&tmp, in, in_count); s->in_buffer_count += in_count; } } if(ret2>0 && !s->drop_output) s->outpts += ret2 * (int64_t)s->in_sample_rate; return ret2; } }
false
FFmpeg
b481d09bd9c7b3cba617a7811d7015ea0472e4ee
int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_count, const uint8_t *in_arg [SWR_CH_MAX], int in_count){ AudioData * in= &s->in; AudioData *out= &s->out; if(s->drop_output > 0){ int ret; uint8_t *tmp_arg[SWR_CH_MAX]; if((ret=swri_realloc_audio(&s->drop_temp, s->drop_output))<0) return ret; reversefill_audiodata(&s->drop_temp, tmp_arg); s->drop_output *= -1; ret = swr_convert(s, tmp_arg, -s->drop_output, in_arg, in_count); s->drop_output *= -1; if(ret>0) s->drop_output -= ret; if(s->drop_output || !out_arg) return 0; in_count = 0; } if(!in_arg){ if(s->resample){ if (!s->flushed) s->resampler->flush(s); s->resample_in_constraint = 0; s->flushed = 1; }else if(!s->in_buffer_count){ return 0; } }else fill_audiodata(in , (void*)in_arg); fill_audiodata(out, out_arg); if(s->resample){ int ret = swr_convert_internal(s, out, out_count, in, in_count); if(ret>0 && !s->drop_output) s->outpts += ret * (int64_t)s->in_sample_rate; return ret; }else{ AudioData tmp= *in; int ret2=0; int ret, size; size = FFMIN(out_count, s->in_buffer_count); if(size){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index); ret= swr_convert_internal(s, out, size, &tmp, size); if(ret<0) return ret; ret2= ret; s->in_buffer_count -= ret; s->in_buffer_index += ret; buf_set(out, out, ret); out_count -= ret; if(!s->in_buffer_count) s->in_buffer_index = 0; } if(in_count){ size= s->in_buffer_index + s->in_buffer_count + in_count - out_count; if(in_count > out_count) { if( size > s->in_buffer.count && s->in_buffer_count + in_count - out_count <= s->in_buffer_index){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index); copy(&s->in_buffer, &tmp, s->in_buffer_count); s->in_buffer_index=0; }else if((ret=swri_realloc_audio(&s->in_buffer, size)) < 0) return ret; } if(out_count){ size = FFMIN(in_count, out_count); ret= swr_convert_internal(s, out, size, in, size); if(ret<0) return ret; buf_set(in, in, ret); in_count -= ret; ret2 += ret; } if(in_count){ buf_set(&tmp, &s->in_buffer, s->in_buffer_index + s->in_buffer_count); copy(&tmp, in, in_count); s->in_buffer_count += in_count; } } if(ret2>0 && !s->drop_output) s->outpts += ret2 * (int64_t)s->in_sample_rate; return ret2; } }
{ "code": [], "line_no": [] }
int FUNC_0(struct SwrContext *VAR_0, uint8_t *VAR_1[SWR_CH_MAX], int VAR_2, const uint8_t *VAR_3 [SWR_CH_MAX], int VAR_4){ AudioData * in= &VAR_0->in; AudioData *out= &VAR_0->out; if(VAR_0->drop_output > 0){ int VAR_7; uint8_t *tmp_arg[SWR_CH_MAX]; if((VAR_7=swri_realloc_audio(&VAR_0->drop_temp, VAR_0->drop_output))<0) return VAR_7; reversefill_audiodata(&VAR_0->drop_temp, tmp_arg); VAR_0->drop_output *= -1; VAR_7 = FUNC_0(VAR_0, tmp_arg, -VAR_0->drop_output, VAR_3, VAR_4); VAR_0->drop_output *= -1; if(VAR_7>0) VAR_0->drop_output -= VAR_7; if(VAR_0->drop_output || !VAR_1) return 0; VAR_4 = 0; } if(!VAR_3){ if(VAR_0->resample){ if (!VAR_0->flushed) VAR_0->resampler->flush(VAR_0); VAR_0->resample_in_constraint = 0; VAR_0->flushed = 1; }else if(!VAR_0->in_buffer_count){ return 0; } }else fill_audiodata(in , (void*)VAR_3); fill_audiodata(out, VAR_1); if(VAR_0->resample){ int VAR_7 = swr_convert_internal(VAR_0, out, VAR_2, in, VAR_4); if(VAR_7>0 && !VAR_0->drop_output) VAR_0->outpts += VAR_7 * (int64_t)VAR_0->in_sample_rate; return VAR_7; }else{ AudioData tmp= *in; int VAR_6=0; int VAR_7, VAR_7; VAR_7 = FFMIN(VAR_2, VAR_0->in_buffer_count); if(VAR_7){ buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index); VAR_7= swr_convert_internal(VAR_0, out, VAR_7, &tmp, VAR_7); if(VAR_7<0) return VAR_7; VAR_6= VAR_7; VAR_0->in_buffer_count -= VAR_7; VAR_0->in_buffer_index += VAR_7; buf_set(out, out, VAR_7); VAR_2 -= VAR_7; if(!VAR_0->in_buffer_count) VAR_0->in_buffer_index = 0; } if(VAR_4){ VAR_7= VAR_0->in_buffer_index + VAR_0->in_buffer_count + VAR_4 - VAR_2; if(VAR_4 > VAR_2) { if( VAR_7 > VAR_0->in_buffer.count && VAR_0->in_buffer_count + VAR_4 - VAR_2 <= VAR_0->in_buffer_index){ buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index); copy(&VAR_0->in_buffer, &tmp, VAR_0->in_buffer_count); VAR_0->in_buffer_index=0; }else if((VAR_7=swri_realloc_audio(&VAR_0->in_buffer, VAR_7)) < 0) return VAR_7; } if(VAR_2){ VAR_7 = FFMIN(VAR_4, VAR_2); VAR_7= swr_convert_internal(VAR_0, out, VAR_7, in, VAR_7); if(VAR_7<0) return VAR_7; buf_set(in, in, VAR_7); VAR_4 -= VAR_7; VAR_6 += VAR_7; } if(VAR_4){ buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index + VAR_0->in_buffer_count); copy(&tmp, in, VAR_4); VAR_0->in_buffer_count += VAR_4; } } if(VAR_6>0 && !VAR_0->drop_output) VAR_0->outpts += VAR_6 * (int64_t)VAR_0->in_sample_rate; return VAR_6; } }
[ "int FUNC_0(struct SwrContext *VAR_0, uint8_t *VAR_1[SWR_CH_MAX], int VAR_2,\nconst uint8_t *VAR_3 [SWR_CH_MAX], int VAR_4){", "AudioData * in= &VAR_0->in;", "AudioData *out= &VAR_0->out;", "if(VAR_0->drop_output > 0){", "int VAR_7;", "uint8_t *tmp_arg[SWR_CH_MAX];", "if((VAR_7=swri_realloc_audio(&VAR_0->drop_temp, VAR_0->drop_output))<0)\nreturn VAR_7;", "reversefill_audiodata(&VAR_0->drop_temp, tmp_arg);", "VAR_0->drop_output *= -1;", "VAR_7 = FUNC_0(VAR_0, tmp_arg, -VAR_0->drop_output, VAR_3, VAR_4);", "VAR_0->drop_output *= -1;", "if(VAR_7>0)\nVAR_0->drop_output -= VAR_7;", "if(VAR_0->drop_output || !VAR_1)\nreturn 0;", "VAR_4 = 0;", "}", "if(!VAR_3){", "if(VAR_0->resample){", "if (!VAR_0->flushed)\nVAR_0->resampler->flush(VAR_0);", "VAR_0->resample_in_constraint = 0;", "VAR_0->flushed = 1;", "}else if(!VAR_0->in_buffer_count){", "return 0;", "}", "}else", "fill_audiodata(in , (void*)VAR_3);", "fill_audiodata(out, VAR_1);", "if(VAR_0->resample){", "int VAR_7 = swr_convert_internal(VAR_0, out, VAR_2, in, VAR_4);", "if(VAR_7>0 && !VAR_0->drop_output)\nVAR_0->outpts += VAR_7 * (int64_t)VAR_0->in_sample_rate;", "return VAR_7;", "}else{", "AudioData tmp= *in;", "int VAR_6=0;", "int VAR_7, VAR_7;", "VAR_7 = FFMIN(VAR_2, VAR_0->in_buffer_count);", "if(VAR_7){", "buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index);", "VAR_7= swr_convert_internal(VAR_0, out, VAR_7, &tmp, VAR_7);", "if(VAR_7<0)\nreturn VAR_7;", "VAR_6= VAR_7;", "VAR_0->in_buffer_count -= VAR_7;", "VAR_0->in_buffer_index += VAR_7;", "buf_set(out, out, VAR_7);", "VAR_2 -= VAR_7;", "if(!VAR_0->in_buffer_count)\nVAR_0->in_buffer_index = 0;", "}", "if(VAR_4){", "VAR_7= VAR_0->in_buffer_index + VAR_0->in_buffer_count + VAR_4 - VAR_2;", "if(VAR_4 > VAR_2) {", "if( VAR_7 > VAR_0->in_buffer.count\n&& VAR_0->in_buffer_count + VAR_4 - VAR_2 <= VAR_0->in_buffer_index){", "buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index);", "copy(&VAR_0->in_buffer, &tmp, VAR_0->in_buffer_count);", "VAR_0->in_buffer_index=0;", "}else", "if((VAR_7=swri_realloc_audio(&VAR_0->in_buffer, VAR_7)) < 0)\nreturn VAR_7;", "}", "if(VAR_2){", "VAR_7 = FFMIN(VAR_4, VAR_2);", "VAR_7= swr_convert_internal(VAR_0, out, VAR_7, in, VAR_7);", "if(VAR_7<0)\nreturn VAR_7;", "buf_set(in, in, VAR_7);", "VAR_4 -= VAR_7;", "VAR_6 += VAR_7;", "}", "if(VAR_4){", "buf_set(&tmp, &VAR_0->in_buffer, VAR_0->in_buffer_index + VAR_0->in_buffer_count);", "copy(&tmp, in, VAR_4);", "VAR_0->in_buffer_count += VAR_4;", "}", "}", "if(VAR_6>0 && !VAR_0->drop_output)\nVAR_0->outpts += VAR_6 * (int64_t)VAR_0->in_sample_rate;", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115, 117 ], [ 119 ], [ 123 ], [ 125 ], [ 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 ] ]
8,314
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) { MJpegDecodeContext *s = avctx->priv_data; int ret; if (!s->picture_ptr) { s->picture = av_frame_alloc(); if (!s->picture) return AVERROR(ENOMEM); s->picture_ptr = s->picture; } s->avctx = avctx; ff_blockdsp_init(&s->bdsp, avctx); ff_hpeldsp_init(&s->hdsp, avctx->flags); ff_idctdsp_init(&s->idsp, avctx); ff_init_scantable(s->idsp.idct_permutation, &s->scantable, ff_zigzag_direct); s->buffer_size = 0; s->buffer = NULL; s->start_code = -1; s->first_picture = 1; s->org_height = avctx->coded_height; avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; avctx->colorspace = AVCOL_SPC_BT470BG; if ((ret = build_basic_mjpeg_vlc(s)) < 0) return ret; if (s->extern_huff) { av_log(avctx, AV_LOG_INFO, "mjpeg: using external huffman table\n"); if ((ret = init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size * 8)) < 0) return ret; if ((ret = ff_mjpeg_decode_dht(s))) { av_log(avctx, AV_LOG_ERROR, "mjpeg: error using external huffman table\n"); return ret; } } if (avctx->field_order == AV_FIELD_BB) { /* quicktime icefloe 019 */ s->interlace_polarity = 1; /* bottom field first */ av_log(avctx, AV_LOG_DEBUG, "mjpeg bottom field first\n"); } if (avctx->codec->id == AV_CODEC_ID_AMV) s->flipped = 1; return 0; }
false
FFmpeg
dcc39ee10e82833ce24aa57926c00ffeb1948198
av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) { MJpegDecodeContext *s = avctx->priv_data; int ret; if (!s->picture_ptr) { s->picture = av_frame_alloc(); if (!s->picture) return AVERROR(ENOMEM); s->picture_ptr = s->picture; } s->avctx = avctx; ff_blockdsp_init(&s->bdsp, avctx); ff_hpeldsp_init(&s->hdsp, avctx->flags); ff_idctdsp_init(&s->idsp, avctx); ff_init_scantable(s->idsp.idct_permutation, &s->scantable, ff_zigzag_direct); s->buffer_size = 0; s->buffer = NULL; s->start_code = -1; s->first_picture = 1; s->org_height = avctx->coded_height; avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; avctx->colorspace = AVCOL_SPC_BT470BG; if ((ret = build_basic_mjpeg_vlc(s)) < 0) return ret; if (s->extern_huff) { av_log(avctx, AV_LOG_INFO, "mjpeg: using external huffman table\n"); if ((ret = init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size * 8)) < 0) return ret; if ((ret = ff_mjpeg_decode_dht(s))) { av_log(avctx, AV_LOG_ERROR, "mjpeg: error using external huffman table\n"); return ret; } } if (avctx->field_order == AV_FIELD_BB) { s->interlace_polarity = 1; av_log(avctx, AV_LOG_DEBUG, "mjpeg bottom field first\n"); } if (avctx->codec->id == AV_CODEC_ID_AMV) s->flipped = 1; return 0; }
{ "code": [], "line_no": [] }
av_cold int FUNC_0(AVCodecContext *avctx) { MJpegDecodeContext *s = avctx->priv_data; int VAR_0; if (!s->picture_ptr) { s->picture = av_frame_alloc(); if (!s->picture) return AVERROR(ENOMEM); s->picture_ptr = s->picture; } s->avctx = avctx; ff_blockdsp_init(&s->bdsp, avctx); ff_hpeldsp_init(&s->hdsp, avctx->flags); ff_idctdsp_init(&s->idsp, avctx); ff_init_scantable(s->idsp.idct_permutation, &s->scantable, ff_zigzag_direct); s->buffer_size = 0; s->buffer = NULL; s->start_code = -1; s->first_picture = 1; s->org_height = avctx->coded_height; avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; avctx->colorspace = AVCOL_SPC_BT470BG; if ((VAR_0 = build_basic_mjpeg_vlc(s)) < 0) return VAR_0; if (s->extern_huff) { av_log(avctx, AV_LOG_INFO, "mjpeg: using external huffman table\n"); if ((VAR_0 = init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size * 8)) < 0) return VAR_0; if ((VAR_0 = ff_mjpeg_decode_dht(s))) { av_log(avctx, AV_LOG_ERROR, "mjpeg: error using external huffman table\n"); return VAR_0; } } if (avctx->field_order == AV_FIELD_BB) { s->interlace_polarity = 1; av_log(avctx, AV_LOG_DEBUG, "mjpeg bottom field first\n"); } if (avctx->codec->id == AV_CODEC_ID_AMV) s->flipped = 1; return 0; }
[ "av_cold int FUNC_0(AVCodecContext *avctx)\n{", "MJpegDecodeContext *s = avctx->priv_data;", "int VAR_0;", "if (!s->picture_ptr) {", "s->picture = av_frame_alloc();", "if (!s->picture)\nreturn AVERROR(ENOMEM);", "s->picture_ptr = s->picture;", "}", "s->avctx = avctx;", "ff_blockdsp_init(&s->bdsp, avctx);", "ff_hpeldsp_init(&s->hdsp, avctx->flags);", "ff_idctdsp_init(&s->idsp, avctx);", "ff_init_scantable(s->idsp.idct_permutation, &s->scantable,\nff_zigzag_direct);", "s->buffer_size = 0;", "s->buffer = NULL;", "s->start_code = -1;", "s->first_picture = 1;", "s->org_height = avctx->coded_height;", "avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;", "avctx->colorspace = AVCOL_SPC_BT470BG;", "if ((VAR_0 = build_basic_mjpeg_vlc(s)) < 0)\nreturn VAR_0;", "if (s->extern_huff) {", "av_log(avctx, AV_LOG_INFO, \"mjpeg: using external huffman table\\n\");", "if ((VAR_0 = init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size * 8)) < 0)\nreturn VAR_0;", "if ((VAR_0 = ff_mjpeg_decode_dht(s))) {", "av_log(avctx, AV_LOG_ERROR,\n\"mjpeg: error using external huffman table\\n\");", "return VAR_0;", "}", "}", "if (avctx->field_order == AV_FIELD_BB) {", "s->interlace_polarity = 1;", "av_log(avctx, AV_LOG_DEBUG, \"mjpeg bottom field first\\n\");", "}", "if (avctx->codec->id == AV_CODEC_ID_AMV)\ns->flipped = 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, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 93 ], [ 95 ] ]
8,315
static int seg_write_trailer(struct AVFormatContext *s) { SegmentContext *seg = s->priv_data; AVFormatContext *oc = seg->avf; int ret = 0; if (!oc) goto fail; if (!seg->write_header_trailer) { if ((ret = segment_end(oc, 0)) < 0) goto fail; open_null_ctx(&oc->pb); ret = av_write_trailer(oc); close_null_ctx(oc->pb); } else { ret = segment_end(oc, 1); } if (ret < 0) goto fail; if (seg->list && seg->list_type == LIST_HLS) { if ((ret = segment_hls_window(s, 1) < 0)) goto fail; } fail: avio_close(seg->pb); avformat_free_context(oc); return ret; }
false
FFmpeg
8a78ae2d2101622fd244b99178d8bc61175c878e
static int seg_write_trailer(struct AVFormatContext *s) { SegmentContext *seg = s->priv_data; AVFormatContext *oc = seg->avf; int ret = 0; if (!oc) goto fail; if (!seg->write_header_trailer) { if ((ret = segment_end(oc, 0)) < 0) goto fail; open_null_ctx(&oc->pb); ret = av_write_trailer(oc); close_null_ctx(oc->pb); } else { ret = segment_end(oc, 1); } if (ret < 0) goto fail; if (seg->list && seg->list_type == LIST_HLS) { if ((ret = segment_hls_window(s, 1) < 0)) goto fail; } fail: avio_close(seg->pb); avformat_free_context(oc); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(struct AVFormatContext *VAR_0) { SegmentContext *seg = VAR_0->priv_data; AVFormatContext *VAR_1 = seg->avf; int VAR_2 = 0; if (!VAR_1) goto fail; if (!seg->write_header_trailer) { if ((VAR_2 = segment_end(VAR_1, 0)) < 0) goto fail; open_null_ctx(&VAR_1->pb); VAR_2 = av_write_trailer(VAR_1); close_null_ctx(VAR_1->pb); } else { VAR_2 = segment_end(VAR_1, 1); } if (VAR_2 < 0) goto fail; if (seg->list && seg->list_type == LIST_HLS) { if ((VAR_2 = segment_hls_window(VAR_0, 1) < 0)) goto fail; } fail: avio_close(seg->pb); avformat_free_context(VAR_1); return VAR_2; }
[ "static int FUNC_0(struct AVFormatContext *VAR_0)\n{", "SegmentContext *seg = VAR_0->priv_data;", "AVFormatContext *VAR_1 = seg->avf;", "int VAR_2 = 0;", "if (!VAR_1)\ngoto fail;", "if (!seg->write_header_trailer) {", "if ((VAR_2 = segment_end(VAR_1, 0)) < 0)\ngoto fail;", "open_null_ctx(&VAR_1->pb);", "VAR_2 = av_write_trailer(VAR_1);", "close_null_ctx(VAR_1->pb);", "} else {", "VAR_2 = segment_end(VAR_1, 1);", "}", "if (VAR_2 < 0)\ngoto fail;", "if (seg->list && seg->list_type == LIST_HLS) {", "if ((VAR_2 = segment_hls_window(VAR_0, 1) < 0))\ngoto fail;", "}", "fail:\navio_close(seg->pb);", "avformat_free_context(VAR_1);", "return VAR_2;", "}" ]
[ 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 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39, 41 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ] ]
8,316
int ff_tempfile(const char *prefix, char **filename) { int fd=-1; #if !HAVE_MKSTEMP *filename = tempnam(".", prefix); #else size_t len = strlen(prefix) + 12; /* room for "/tmp/" and "XXXXXX\0" */ *filename = av_malloc(len); #endif /* -----common section-----*/ if (*filename == NULL) { av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n"); return -1; } #if !HAVE_MKSTEMP fd = avpriv_open(*filename, O_RDWR | O_BINARY | O_CREAT, 0444); #else snprintf(*filename, len, "/tmp/%sXXXXXX", prefix); fd = mkstemp(*filename); if (fd < 0) { snprintf(*filename, len, "./%sXXXXXX", prefix); fd = mkstemp(*filename); } #endif /* -----common section-----*/ if (fd < 0) { av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename); return -1; } return fd; /* success */ }
false
FFmpeg
f929ab0569ff31ed5a59b0b0adb7ce09df3fca39
int ff_tempfile(const char *prefix, char **filename) { int fd=-1; #if !HAVE_MKSTEMP *filename = tempnam(".", prefix); #else size_t len = strlen(prefix) + 12; *filename = av_malloc(len); #endif if (*filename == NULL) { av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot allocate file name\n"); return -1; } #if !HAVE_MKSTEMP fd = avpriv_open(*filename, O_RDWR | O_BINARY | O_CREAT, 0444); #else snprintf(*filename, len, "/tmp/%sXXXXXX", prefix); fd = mkstemp(*filename); if (fd < 0) { snprintf(*filename, len, "./%sXXXXXX", prefix); fd = mkstemp(*filename); } #endif if (fd < 0) { av_log(NULL, AV_LOG_ERROR, "ff_tempfile: Cannot open temporary file %s\n", *filename); return -1; } return fd; }
{ "code": [], "line_no": [] }
int FUNC_0(const char *VAR_0, char **VAR_1) { int VAR_2=-1; #if !HAVE_MKSTEMP *VAR_1 = tempnam(".", VAR_0); #else size_t len = strlen(VAR_0) + 12; *VAR_1 = av_malloc(len); #endif if (*VAR_1 == NULL) { av_log(NULL, AV_LOG_ERROR, "FUNC_0: Cannot allocate file name\n"); return -1; } #if !HAVE_MKSTEMP VAR_2 = avpriv_open(*VAR_1, O_RDWR | O_BINARY | O_CREAT, 0444); #else snprintf(*VAR_1, len, "/tmp/%sXXXXXX", VAR_0); VAR_2 = mkstemp(*VAR_1); if (VAR_2 < 0) { snprintf(*VAR_1, len, "./%sXXXXXX", VAR_0); VAR_2 = mkstemp(*VAR_1); } #endif if (VAR_2 < 0) { av_log(NULL, AV_LOG_ERROR, "FUNC_0: Cannot open temporary file %s\n", *VAR_1); return -1; } return VAR_2; }
[ "int FUNC_0(const char *VAR_0, char **VAR_1) {", "int VAR_2=-1;", "#if !HAVE_MKSTEMP\n*VAR_1 = tempnam(\".\", VAR_0);", "#else\nsize_t len = strlen(VAR_0) + 12;", "*VAR_1 = av_malloc(len);", "#endif\nif (*VAR_1 == NULL) {", "av_log(NULL, AV_LOG_ERROR, \"FUNC_0: Cannot allocate file name\\n\");", "return -1;", "}", "#if !HAVE_MKSTEMP\nVAR_2 = avpriv_open(*VAR_1, O_RDWR | O_BINARY | O_CREAT, 0444);", "#else\nsnprintf(*VAR_1, len, \"/tmp/%sXXXXXX\", VAR_0);", "VAR_2 = mkstemp(*VAR_1);", "if (VAR_2 < 0) {", "snprintf(*VAR_1, len, \"./%sXXXXXX\", VAR_0);", "VAR_2 = mkstemp(*VAR_1);", "}", "#endif\nif (VAR_2 < 0) {", "av_log(NULL, AV_LOG_ERROR, \"FUNC_0: Cannot open temporary file %s\\n\", *VAR_1);", "return -1;", "}", "return VAR_2;", "}" ]
[ 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, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ] ]
8,317
static void ffm_seek1(AVFormatContext *s, int64_t pos1) { FFMContext *ffm = s->priv_data; ByteIOContext *pb = s->pb; int64_t pos; pos = pos1 + ffm->write_index; if (pos >= ffm->file_size) pos -= (ffm->file_size - FFM_PACKET_SIZE); #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos); #endif url_fseek(pb, pos, SEEK_SET); }
false
FFmpeg
92a0f338786b629c5661f5b552e32c6154c3389d
static void ffm_seek1(AVFormatContext *s, int64_t pos1) { FFMContext *ffm = s->priv_data; ByteIOContext *pb = s->pb; int64_t pos; pos = pos1 + ffm->write_index; if (pos >= ffm->file_size) pos -= (ffm->file_size - FFM_PACKET_SIZE); #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos); #endif url_fseek(pb, pos, SEEK_SET); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFormatContext *VAR_0, int64_t VAR_1) { FFMContext *ffm = VAR_0->priv_data; ByteIOContext *pb = VAR_0->pb; int64_t pos; pos = VAR_1 + ffm->write_index; if (pos >= ffm->file_size) pos -= (ffm->file_size - FFM_PACKET_SIZE); #ifdef DEBUG_SEEK av_log(VAR_0, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", VAR_1, pos); #endif url_fseek(pb, pos, SEEK_SET); }
[ "static void FUNC_0(AVFormatContext *VAR_0, int64_t VAR_1)\n{", "FFMContext *ffm = VAR_0->priv_data;", "ByteIOContext *pb = VAR_0->pb;", "int64_t pos;", "pos = VAR_1 + ffm->write_index;", "if (pos >= ffm->file_size)\npos -= (ffm->file_size - FFM_PACKET_SIZE);", "#ifdef DEBUG_SEEK\nav_log(VAR_0, AV_LOG_DEBUG, \"seek to %\"PRIx64\" -> %\"PRIx64\"\\n\", VAR_1, pos);", "#endif\nurl_fseek(pb, pos, SEEK_SET);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23, 25 ], [ 27 ] ]
8,318
static int decode_init(AVCodecContext * avctx) { MPADecodeContext *s = avctx->priv_data; static int init=0; int i, j, k; #if defined(USE_HIGHPRECISION) && defined(CONFIG_AUDIO_NONSHORT) avctx->sample_fmt= SAMPLE_FMT_S32; #else avctx->sample_fmt= SAMPLE_FMT_S16; #endif if(avctx->antialias_algo != FF_AA_FLOAT) s->compute_antialias= compute_antialias_integer; else s->compute_antialias= compute_antialias_float; if (!init && !avctx->parse_only) { /* scale factors table for layer 1/2 */ for(i=0;i<64;i++) { int shift, mod; /* 1.0 (i = 3) is normalized to 2 ^ FRAC_BITS */ shift = (i / 3); mod = i % 3; scale_factor_modshift[i] = mod | (shift << 2); } /* scale factor multiply for layer 1 */ for(i=0;i<15;i++) { int n, norm; n = i + 2; norm = ((int64_t_C(1) << n) * FRAC_ONE) / ((1 << n) - 1); scale_factor_mult[i][0] = MULL(FIXR(1.0 * 2.0), norm); scale_factor_mult[i][1] = MULL(FIXR(0.7937005259 * 2.0), norm); scale_factor_mult[i][2] = MULL(FIXR(0.6299605249 * 2.0), norm); dprintf("%d: norm=%x s=%x %x %x\n", i, norm, scale_factor_mult[i][0], scale_factor_mult[i][1], scale_factor_mult[i][2]); } ff_mpa_synth_init(window); /* huffman decode tables */ for(i=1;i<16;i++) { const HuffTable *h = &mpa_huff_tables[i]; int xsize, x, y; unsigned int n; uint8_t tmp_bits [256]; uint16_t tmp_codes[256]; memset(tmp_bits , 0, sizeof(tmp_bits )); memset(tmp_codes, 0, sizeof(tmp_codes)); xsize = h->xsize; n = xsize * xsize; j = 0; for(x=0;x<xsize;x++) { for(y=0;y<xsize;y++){ tmp_bits [(x << 4) | y]= h->bits [j ]; tmp_codes[(x << 4) | y]= h->codes[j++]; } } /* XXX: fail test */ init_vlc(&huff_vlc[i], 7, 256, tmp_bits, 1, 1, tmp_codes, 2, 2, 1); } for(i=0;i<2;i++) { init_vlc(&huff_quad_vlc[i], i == 0 ? 7 : 4, 16, mpa_quad_bits[i], 1, 1, mpa_quad_codes[i], 1, 1, 1); } for(i=0;i<9;i++) { k = 0; for(j=0;j<22;j++) { band_index_long[i][j] = k; k += band_size_long[i][j]; } band_index_long[i][22] = k; } /* compute n ^ (4/3) and store it in mantissa/exp format */ table_4_3_exp= av_mallocz_static(TABLE_4_3_SIZE * sizeof(table_4_3_exp[0])); if(!table_4_3_exp) return -1; table_4_3_value= av_mallocz_static(TABLE_4_3_SIZE * sizeof(table_4_3_value[0])); if(!table_4_3_value) return -1; int_pow_init(); for(i=1;i<TABLE_4_3_SIZE;i++) { double f, fm; int e, m; f = pow((double)(i/4), 4.0 / 3.0) * pow(2, (i&3)*0.25); fm = frexp(f, &e); m = (uint32_t)(fm*(1LL<<31) + 0.5); e+= FRAC_BITS - 31 + 5; /* normalized to FRAC_BITS */ table_4_3_value[i] = m; // av_log(NULL, AV_LOG_DEBUG, "%d %d %f\n", i, m, pow((double)i, 4.0 / 3.0)); table_4_3_exp[i] = -e; } for(i=0; i<512*16; i++){ int exponent= (i>>4)-400; double f= pow(i&15, 4.0 / 3.0) * pow(2, exponent*0.25 + FRAC_BITS + 5); expval_table[exponent+400][i&15]= lrintf(f); if((i&15)==1) exp_table[exponent+400]= lrintf(f); } for(i=0;i<7;i++) { float f; int v; if (i != 6) { f = tan((double)i * M_PI / 12.0); v = FIXR(f / (1.0 + f)); } else { v = FIXR(1.0); } is_table[0][i] = v; is_table[1][6 - i] = v; } /* invalid values */ for(i=7;i<16;i++) is_table[0][i] = is_table[1][i] = 0.0; for(i=0;i<16;i++) { double f; int e, k; for(j=0;j<2;j++) { e = -(j + 1) * ((i + 1) >> 1); f = pow(2.0, e / 4.0); k = i & 1; is_table_lsf[j][k ^ 1][i] = FIXR(f); is_table_lsf[j][k][i] = FIXR(1.0); dprintf("is_table_lsf %d %d: %x %x\n", i, j, is_table_lsf[j][0][i], is_table_lsf[j][1][i]); } } for(i=0;i<8;i++) { float ci, cs, ca; ci = ci_table[i]; cs = 1.0 / sqrt(1.0 + ci * ci); ca = cs * ci; csa_table[i][0] = FIXHR(cs/4); csa_table[i][1] = FIXHR(ca/4); csa_table[i][2] = FIXHR(ca/4) + FIXHR(cs/4); csa_table[i][3] = FIXHR(ca/4) - FIXHR(cs/4); csa_table_float[i][0] = cs; csa_table_float[i][1] = ca; csa_table_float[i][2] = ca + cs; csa_table_float[i][3] = ca - cs; // printf("%d %d %d %d\n", FIX(cs), FIX(cs-1), FIX(ca), FIX(cs)-FIX(ca)); // av_log(NULL, AV_LOG_DEBUG,"%f %f %f %f\n", cs, ca, ca+cs, ca-cs); } /* compute mdct windows */ for(i=0;i<36;i++) { for(j=0; j<4; j++){ double d; if(j==2 && i%3 != 1) continue; d= sin(M_PI * (i + 0.5) / 36.0); if(j==1){ if (i>=30) d= 0; else if(i>=24) d= sin(M_PI * (i - 18 + 0.5) / 12.0); else if(i>=18) d= 1; }else if(j==3){ if (i< 6) d= 0; else if(i< 12) d= sin(M_PI * (i - 6 + 0.5) / 12.0); else if(i< 18) d= 1; } //merge last stage of imdct into the window coefficients d*= 0.5 / cos(M_PI*(2*i + 19)/72); if(j==2) mdct_win[j][i/3] = FIXHR((d / (1<<5))); else mdct_win[j][i ] = FIXHR((d / (1<<5))); // av_log(NULL, AV_LOG_DEBUG, "%2d %d %f\n", i,j,d / (1<<5)); } } /* NOTE: we do frequency inversion adter the MDCT by changing the sign of the right window coefs */ for(j=0;j<4;j++) { for(i=0;i<36;i+=2) { mdct_win[j + 4][i] = mdct_win[j][i]; mdct_win[j + 4][i + 1] = -mdct_win[j][i + 1]; } } #if defined(DEBUG) for(j=0;j<8;j++) { av_log(avctx, AV_LOG_DEBUG, "win%d=\n", j); for(i=0;i<36;i++) av_log(avctx, AV_LOG_DEBUG, "%f, ", (double)mdct_win[j][i] / FRAC_ONE); av_log(avctx, AV_LOG_DEBUG, "\n"); } #endif init = 1; } s->inbuf_index = 0; s->inbuf = &s->inbuf1[s->inbuf_index][BACKSTEP_SIZE]; s->inbuf_ptr = s->inbuf; #ifdef DEBUG s->frame_count = 0; #endif if (avctx->codec_id == CODEC_ID_MP3ADU) s->adu_mode = 1; return 0; }
false
FFmpeg
bc2d2757bb532fa260c373adb00f4e47766e3449
static int decode_init(AVCodecContext * avctx) { MPADecodeContext *s = avctx->priv_data; static int init=0; int i, j, k; #if defined(USE_HIGHPRECISION) && defined(CONFIG_AUDIO_NONSHORT) avctx->sample_fmt= SAMPLE_FMT_S32; #else avctx->sample_fmt= SAMPLE_FMT_S16; #endif if(avctx->antialias_algo != FF_AA_FLOAT) s->compute_antialias= compute_antialias_integer; else s->compute_antialias= compute_antialias_float; if (!init && !avctx->parse_only) { for(i=0;i<64;i++) { int shift, mod; shift = (i / 3); mod = i % 3; scale_factor_modshift[i] = mod | (shift << 2); } for(i=0;i<15;i++) { int n, norm; n = i + 2; norm = ((int64_t_C(1) << n) * FRAC_ONE) / ((1 << n) - 1); scale_factor_mult[i][0] = MULL(FIXR(1.0 * 2.0), norm); scale_factor_mult[i][1] = MULL(FIXR(0.7937005259 * 2.0), norm); scale_factor_mult[i][2] = MULL(FIXR(0.6299605249 * 2.0), norm); dprintf("%d: norm=%x s=%x %x %x\n", i, norm, scale_factor_mult[i][0], scale_factor_mult[i][1], scale_factor_mult[i][2]); } ff_mpa_synth_init(window); for(i=1;i<16;i++) { const HuffTable *h = &mpa_huff_tables[i]; int xsize, x, y; unsigned int n; uint8_t tmp_bits [256]; uint16_t tmp_codes[256]; memset(tmp_bits , 0, sizeof(tmp_bits )); memset(tmp_codes, 0, sizeof(tmp_codes)); xsize = h->xsize; n = xsize * xsize; j = 0; for(x=0;x<xsize;x++) { for(y=0;y<xsize;y++){ tmp_bits [(x << 4) | y]= h->bits [j ]; tmp_codes[(x << 4) | y]= h->codes[j++]; } } init_vlc(&huff_vlc[i], 7, 256, tmp_bits, 1, 1, tmp_codes, 2, 2, 1); } for(i=0;i<2;i++) { init_vlc(&huff_quad_vlc[i], i == 0 ? 7 : 4, 16, mpa_quad_bits[i], 1, 1, mpa_quad_codes[i], 1, 1, 1); } for(i=0;i<9;i++) { k = 0; for(j=0;j<22;j++) { band_index_long[i][j] = k; k += band_size_long[i][j]; } band_index_long[i][22] = k; } table_4_3_exp= av_mallocz_static(TABLE_4_3_SIZE * sizeof(table_4_3_exp[0])); if(!table_4_3_exp) return -1; table_4_3_value= av_mallocz_static(TABLE_4_3_SIZE * sizeof(table_4_3_value[0])); if(!table_4_3_value) return -1; int_pow_init(); for(i=1;i<TABLE_4_3_SIZE;i++) { double f, fm; int e, m; f = pow((double)(i/4), 4.0 / 3.0) * pow(2, (i&3)*0.25); fm = frexp(f, &e); m = (uint32_t)(fm*(1LL<<31) + 0.5); e+= FRAC_BITS - 31 + 5; table_4_3_value[i] = m; table_4_3_exp[i] = -e; } for(i=0; i<512*16; i++){ int exponent= (i>>4)-400; double f= pow(i&15, 4.0 / 3.0) * pow(2, exponent*0.25 + FRAC_BITS + 5); expval_table[exponent+400][i&15]= lrintf(f); if((i&15)==1) exp_table[exponent+400]= lrintf(f); } for(i=0;i<7;i++) { float f; int v; if (i != 6) { f = tan((double)i * M_PI / 12.0); v = FIXR(f / (1.0 + f)); } else { v = FIXR(1.0); } is_table[0][i] = v; is_table[1][6 - i] = v; } for(i=7;i<16;i++) is_table[0][i] = is_table[1][i] = 0.0; for(i=0;i<16;i++) { double f; int e, k; for(j=0;j<2;j++) { e = -(j + 1) * ((i + 1) >> 1); f = pow(2.0, e / 4.0); k = i & 1; is_table_lsf[j][k ^ 1][i] = FIXR(f); is_table_lsf[j][k][i] = FIXR(1.0); dprintf("is_table_lsf %d %d: %x %x\n", i, j, is_table_lsf[j][0][i], is_table_lsf[j][1][i]); } } for(i=0;i<8;i++) { float ci, cs, ca; ci = ci_table[i]; cs = 1.0 / sqrt(1.0 + ci * ci); ca = cs * ci; csa_table[i][0] = FIXHR(cs/4); csa_table[i][1] = FIXHR(ca/4); csa_table[i][2] = FIXHR(ca/4) + FIXHR(cs/4); csa_table[i][3] = FIXHR(ca/4) - FIXHR(cs/4); csa_table_float[i][0] = cs; csa_table_float[i][1] = ca; csa_table_float[i][2] = ca + cs; csa_table_float[i][3] = ca - cs; } for(i=0;i<36;i++) { for(j=0; j<4; j++){ double d; if(j==2 && i%3 != 1) continue; d= sin(M_PI * (i + 0.5) / 36.0); if(j==1){ if (i>=30) d= 0; else if(i>=24) d= sin(M_PI * (i - 18 + 0.5) / 12.0); else if(i>=18) d= 1; }else if(j==3){ if (i< 6) d= 0; else if(i< 12) d= sin(M_PI * (i - 6 + 0.5) / 12.0); else if(i< 18) d= 1; } d*= 0.5 / cos(M_PI*(2*i + 19)/72); if(j==2) mdct_win[j][i/3] = FIXHR((d / (1<<5))); else mdct_win[j][i ] = FIXHR((d / (1<<5))); } } for(j=0;j<4;j++) { for(i=0;i<36;i+=2) { mdct_win[j + 4][i] = mdct_win[j][i]; mdct_win[j + 4][i + 1] = -mdct_win[j][i + 1]; } } #if defined(DEBUG) for(j=0;j<8;j++) { av_log(avctx, AV_LOG_DEBUG, "win%d=\n", j); for(i=0;i<36;i++) av_log(avctx, AV_LOG_DEBUG, "%f, ", (double)mdct_win[j][i] / FRAC_ONE); av_log(avctx, AV_LOG_DEBUG, "\n"); } #endif init = 1; } s->inbuf_index = 0; s->inbuf = &s->inbuf1[s->inbuf_index][BACKSTEP_SIZE]; s->inbuf_ptr = s->inbuf; #ifdef DEBUG s->frame_count = 0; #endif if (avctx->codec_id == CODEC_ID_MP3ADU) s->adu_mode = 1; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext * VAR_0) { MPADecodeContext *s = VAR_0->priv_data; static int VAR_1=0; int VAR_2, VAR_3, VAR_17; #if defined(USE_HIGHPRECISION) && defined(CONFIG_AUDIO_NONSHORT) VAR_0->sample_fmt= SAMPLE_FMT_S32; #else VAR_0->sample_fmt= SAMPLE_FMT_S16; #endif if(VAR_0->antialias_algo != FF_AA_FLOAT) s->compute_antialias= compute_antialias_integer; else s->compute_antialias= compute_antialias_float; if (!VAR_1 && !VAR_0->parse_only) { for(VAR_2=0;VAR_2<64;VAR_2++) { int VAR_5, VAR_6; VAR_5 = (VAR_2 / 3); VAR_6 = VAR_2 % 3; scale_factor_modshift[VAR_2] = VAR_6 | (VAR_5 << 2); } for(VAR_2=0;VAR_2<15;VAR_2++) { int VAR_13, VAR_8; VAR_13 = VAR_2 + 2; VAR_8 = ((int64_t_C(1) << VAR_13) * FRAC_ONE) / ((1 << VAR_13) - 1); scale_factor_mult[VAR_2][0] = MULL(FIXR(1.0 * 2.0), VAR_8); scale_factor_mult[VAR_2][1] = MULL(FIXR(0.7937005259 * 2.0), VAR_8); scale_factor_mult[VAR_2][2] = MULL(FIXR(0.6299605249 * 2.0), VAR_8); dprintf("%VAR_20: VAR_8=%VAR_11 s=%VAR_11 %VAR_11 %VAR_11\VAR_13", VAR_2, VAR_8, scale_factor_mult[VAR_2][0], scale_factor_mult[VAR_2][1], scale_factor_mult[VAR_2][2]); } ff_mpa_synth_init(window); for(VAR_2=1;VAR_2<16;VAR_2++) { const HuffTable *VAR_9 = &mpa_huff_tables[VAR_2]; int VAR_10, VAR_11, VAR_12; unsigned int VAR_13; uint8_t tmp_bits [256]; uint16_t tmp_codes[256]; memset(tmp_bits , 0, sizeof(tmp_bits )); memset(tmp_codes, 0, sizeof(tmp_codes)); VAR_10 = VAR_9->VAR_10; VAR_13 = VAR_10 * VAR_10; VAR_3 = 0; for(VAR_11=0;VAR_11<VAR_10;VAR_11++) { for(VAR_12=0;VAR_12<VAR_10;VAR_12++){ tmp_bits [(VAR_11 << 4) | VAR_12]= VAR_9->bits [VAR_3 ]; tmp_codes[(VAR_11 << 4) | VAR_12]= VAR_9->codes[VAR_3++]; } } init_vlc(&huff_vlc[VAR_2], 7, 256, tmp_bits, 1, 1, tmp_codes, 2, 2, 1); } for(VAR_2=0;VAR_2<2;VAR_2++) { init_vlc(&huff_quad_vlc[VAR_2], VAR_2 == 0 ? 7 : 4, 16, mpa_quad_bits[VAR_2], 1, 1, mpa_quad_codes[VAR_2], 1, 1, 1); } for(VAR_2=0;VAR_2<9;VAR_2++) { VAR_17 = 0; for(VAR_3=0;VAR_3<22;VAR_3++) { band_index_long[VAR_2][VAR_3] = VAR_17; VAR_17 += band_size_long[VAR_2][VAR_3]; } band_index_long[VAR_2][22] = VAR_17; } table_4_3_exp= av_mallocz_static(TABLE_4_3_SIZE * sizeof(table_4_3_exp[0])); if(!table_4_3_exp) return -1; table_4_3_value= av_mallocz_static(TABLE_4_3_SIZE * sizeof(table_4_3_value[0])); if(!table_4_3_value) return -1; int_pow_init(); for(VAR_2=1;VAR_2<TABLE_4_3_SIZE;VAR_2++) { double VAR_16, fm; int VAR_16, m; VAR_16 = pow((double)(VAR_2/4), 4.0 / 3.0) * pow(2, (VAR_2&3)*0.25); fm = frexp(VAR_16, &VAR_16); m = (uint32_t)(fm*(1LL<<31) + 0.5); VAR_16+= FRAC_BITS - 31 + 5; table_4_3_value[VAR_2] = m; table_4_3_exp[VAR_2] = -VAR_16; } for(VAR_2=0; VAR_2<512*16; VAR_2++){ int VAR_13= (VAR_2>>4)-400; double VAR_16= pow(VAR_2&15, 4.0 / 3.0) * pow(2, VAR_13*0.25 + FRAC_BITS + 5); expval_table[VAR_13+400][VAR_2&15]= lrintf(VAR_16); if((VAR_2&15)==1) exp_table[VAR_13+400]= lrintf(VAR_16); } for(VAR_2=0;VAR_2<7;VAR_2++) { float VAR_16; int VAR_15; if (VAR_2 != 6) { VAR_16 = tan((double)VAR_2 * M_PI / 12.0); VAR_15 = FIXR(VAR_16 / (1.0 + VAR_16)); } else { VAR_15 = FIXR(1.0); } is_table[0][VAR_2] = VAR_15; is_table[1][6 - VAR_2] = VAR_15; } for(VAR_2=7;VAR_2<16;VAR_2++) is_table[0][VAR_2] = is_table[1][VAR_2] = 0.0; for(VAR_2=0;VAR_2<16;VAR_2++) { double VAR_16; int VAR_16, VAR_17; for(VAR_3=0;VAR_3<2;VAR_3++) { VAR_16 = -(VAR_3 + 1) * ((VAR_2 + 1) >> 1); VAR_16 = pow(2.0, VAR_16 / 4.0); VAR_17 = VAR_2 & 1; is_table_lsf[VAR_3][VAR_17 ^ 1][VAR_2] = FIXR(VAR_16); is_table_lsf[VAR_3][VAR_17][VAR_2] = FIXR(1.0); dprintf("is_table_lsf %VAR_20 %VAR_20: %VAR_11 %VAR_11\VAR_13", VAR_2, VAR_3, is_table_lsf[VAR_3][0][VAR_2], is_table_lsf[VAR_3][1][VAR_2]); } } for(VAR_2=0;VAR_2<8;VAR_2++) { float VAR_17, VAR_18, VAR_19; VAR_17 = ci_table[VAR_2]; VAR_18 = 1.0 / sqrt(1.0 + VAR_17 * VAR_17); VAR_19 = VAR_18 * VAR_17; csa_table[VAR_2][0] = FIXHR(VAR_18/4); csa_table[VAR_2][1] = FIXHR(VAR_19/4); csa_table[VAR_2][2] = FIXHR(VAR_19/4) + FIXHR(VAR_18/4); csa_table[VAR_2][3] = FIXHR(VAR_19/4) - FIXHR(VAR_18/4); csa_table_float[VAR_2][0] = VAR_18; csa_table_float[VAR_2][1] = VAR_19; csa_table_float[VAR_2][2] = VAR_19 + VAR_18; csa_table_float[VAR_2][3] = VAR_19 - VAR_18; } for(VAR_2=0;VAR_2<36;VAR_2++) { for(VAR_3=0; VAR_3<4; VAR_3++){ double VAR_20; if(VAR_3==2 && VAR_2%3 != 1) continue; VAR_20= sin(M_PI * (VAR_2 + 0.5) / 36.0); if(VAR_3==1){ if (VAR_2>=30) VAR_20= 0; else if(VAR_2>=24) VAR_20= sin(M_PI * (VAR_2 - 18 + 0.5) / 12.0); else if(VAR_2>=18) VAR_20= 1; }else if(VAR_3==3){ if (VAR_2< 6) VAR_20= 0; else if(VAR_2< 12) VAR_20= sin(M_PI * (VAR_2 - 6 + 0.5) / 12.0); else if(VAR_2< 18) VAR_20= 1; } VAR_20*= 0.5 / cos(M_PI*(2*VAR_2 + 19)/72); if(VAR_3==2) mdct_win[VAR_3][VAR_2/3] = FIXHR((VAR_20 / (1<<5))); else mdct_win[VAR_3][VAR_2 ] = FIXHR((VAR_20 / (1<<5))); } } for(VAR_3=0;VAR_3<4;VAR_3++) { for(VAR_2=0;VAR_2<36;VAR_2+=2) { mdct_win[VAR_3 + 4][VAR_2] = mdct_win[VAR_3][VAR_2]; mdct_win[VAR_3 + 4][VAR_2 + 1] = -mdct_win[VAR_3][VAR_2 + 1]; } } #if defined(DEBUG) for(VAR_3=0;VAR_3<8;VAR_3++) { av_log(VAR_0, AV_LOG_DEBUG, "win%VAR_20=\VAR_13", VAR_3); for(VAR_2=0;VAR_2<36;VAR_2++) av_log(VAR_0, AV_LOG_DEBUG, "%VAR_16, ", (double)mdct_win[VAR_3][VAR_2] / FRAC_ONE); av_log(VAR_0, AV_LOG_DEBUG, "\VAR_13"); } #endif VAR_1 = 1; } s->inbuf_index = 0; s->inbuf = &s->inbuf1[s->inbuf_index][BACKSTEP_SIZE]; s->inbuf_ptr = s->inbuf; #ifdef DEBUG s->frame_count = 0; #endif if (VAR_0->codec_id == CODEC_ID_MP3ADU) s->adu_mode = 1; return 0; }
[ "static int FUNC_0(AVCodecContext * VAR_0)\n{", "MPADecodeContext *s = VAR_0->priv_data;", "static int VAR_1=0;", "int VAR_2, VAR_3, VAR_17;", "#if defined(USE_HIGHPRECISION) && defined(CONFIG_AUDIO_NONSHORT)\nVAR_0->sample_fmt= SAMPLE_FMT_S32;", "#else\nVAR_0->sample_fmt= SAMPLE_FMT_S16;", "#endif\nif(VAR_0->antialias_algo != FF_AA_FLOAT)\ns->compute_antialias= compute_antialias_integer;", "else\ns->compute_antialias= compute_antialias_float;", "if (!VAR_1 && !VAR_0->parse_only) {", "for(VAR_2=0;VAR_2<64;VAR_2++) {", "int VAR_5, VAR_6;", "VAR_5 = (VAR_2 / 3);", "VAR_6 = VAR_2 % 3;", "scale_factor_modshift[VAR_2] = VAR_6 | (VAR_5 << 2);", "}", "for(VAR_2=0;VAR_2<15;VAR_2++) {", "int VAR_13, VAR_8;", "VAR_13 = VAR_2 + 2;", "VAR_8 = ((int64_t_C(1) << VAR_13) * FRAC_ONE) / ((1 << VAR_13) - 1);", "scale_factor_mult[VAR_2][0] = MULL(FIXR(1.0 * 2.0), VAR_8);", "scale_factor_mult[VAR_2][1] = MULL(FIXR(0.7937005259 * 2.0), VAR_8);", "scale_factor_mult[VAR_2][2] = MULL(FIXR(0.6299605249 * 2.0), VAR_8);", "dprintf(\"%VAR_20: VAR_8=%VAR_11 s=%VAR_11 %VAR_11 %VAR_11\\VAR_13\",\nVAR_2, VAR_8,\nscale_factor_mult[VAR_2][0],\nscale_factor_mult[VAR_2][1],\nscale_factor_mult[VAR_2][2]);", "}", "ff_mpa_synth_init(window);", "for(VAR_2=1;VAR_2<16;VAR_2++) {", "const HuffTable *VAR_9 = &mpa_huff_tables[VAR_2];", "int VAR_10, VAR_11, VAR_12;", "unsigned int VAR_13;", "uint8_t tmp_bits [256];", "uint16_t tmp_codes[256];", "memset(tmp_bits , 0, sizeof(tmp_bits ));", "memset(tmp_codes, 0, sizeof(tmp_codes));", "VAR_10 = VAR_9->VAR_10;", "VAR_13 = VAR_10 * VAR_10;", "VAR_3 = 0;", "for(VAR_11=0;VAR_11<VAR_10;VAR_11++) {", "for(VAR_12=0;VAR_12<VAR_10;VAR_12++){", "tmp_bits [(VAR_11 << 4) | VAR_12]= VAR_9->bits [VAR_3 ];", "tmp_codes[(VAR_11 << 4) | VAR_12]= VAR_9->codes[VAR_3++];", "}", "}", "init_vlc(&huff_vlc[VAR_2], 7, 256,\ntmp_bits, 1, 1, tmp_codes, 2, 2, 1);", "}", "for(VAR_2=0;VAR_2<2;VAR_2++) {", "init_vlc(&huff_quad_vlc[VAR_2], VAR_2 == 0 ? 7 : 4, 16,\nmpa_quad_bits[VAR_2], 1, 1, mpa_quad_codes[VAR_2], 1, 1, 1);", "}", "for(VAR_2=0;VAR_2<9;VAR_2++) {", "VAR_17 = 0;", "for(VAR_3=0;VAR_3<22;VAR_3++) {", "band_index_long[VAR_2][VAR_3] = VAR_17;", "VAR_17 += band_size_long[VAR_2][VAR_3];", "}", "band_index_long[VAR_2][22] = VAR_17;", "}", "table_4_3_exp= av_mallocz_static(TABLE_4_3_SIZE * sizeof(table_4_3_exp[0]));", "if(!table_4_3_exp)\nreturn -1;", "table_4_3_value= av_mallocz_static(TABLE_4_3_SIZE * sizeof(table_4_3_value[0]));", "if(!table_4_3_value)\nreturn -1;", "int_pow_init();", "for(VAR_2=1;VAR_2<TABLE_4_3_SIZE;VAR_2++) {", "double VAR_16, fm;", "int VAR_16, m;", "VAR_16 = pow((double)(VAR_2/4), 4.0 / 3.0) * pow(2, (VAR_2&3)*0.25);", "fm = frexp(VAR_16, &VAR_16);", "m = (uint32_t)(fm*(1LL<<31) + 0.5);", "VAR_16+= FRAC_BITS - 31 + 5;", "table_4_3_value[VAR_2] = m;", "table_4_3_exp[VAR_2] = -VAR_16;", "}", "for(VAR_2=0; VAR_2<512*16; VAR_2++){", "int VAR_13= (VAR_2>>4)-400;", "double VAR_16= pow(VAR_2&15, 4.0 / 3.0) * pow(2, VAR_13*0.25 + FRAC_BITS + 5);", "expval_table[VAR_13+400][VAR_2&15]= lrintf(VAR_16);", "if((VAR_2&15)==1)\nexp_table[VAR_13+400]= lrintf(VAR_16);", "}", "for(VAR_2=0;VAR_2<7;VAR_2++) {", "float VAR_16;", "int VAR_15;", "if (VAR_2 != 6) {", "VAR_16 = tan((double)VAR_2 * M_PI / 12.0);", "VAR_15 = FIXR(VAR_16 / (1.0 + VAR_16));", "} else {", "VAR_15 = FIXR(1.0);", "}", "is_table[0][VAR_2] = VAR_15;", "is_table[1][6 - VAR_2] = VAR_15;", "}", "for(VAR_2=7;VAR_2<16;VAR_2++)", "is_table[0][VAR_2] = is_table[1][VAR_2] = 0.0;", "for(VAR_2=0;VAR_2<16;VAR_2++) {", "double VAR_16;", "int VAR_16, VAR_17;", "for(VAR_3=0;VAR_3<2;VAR_3++) {", "VAR_16 = -(VAR_3 + 1) * ((VAR_2 + 1) >> 1);", "VAR_16 = pow(2.0, VAR_16 / 4.0);", "VAR_17 = VAR_2 & 1;", "is_table_lsf[VAR_3][VAR_17 ^ 1][VAR_2] = FIXR(VAR_16);", "is_table_lsf[VAR_3][VAR_17][VAR_2] = FIXR(1.0);", "dprintf(\"is_table_lsf %VAR_20 %VAR_20: %VAR_11 %VAR_11\\VAR_13\",\nVAR_2, VAR_3, is_table_lsf[VAR_3][0][VAR_2], is_table_lsf[VAR_3][1][VAR_2]);", "}", "}", "for(VAR_2=0;VAR_2<8;VAR_2++) {", "float VAR_17, VAR_18, VAR_19;", "VAR_17 = ci_table[VAR_2];", "VAR_18 = 1.0 / sqrt(1.0 + VAR_17 * VAR_17);", "VAR_19 = VAR_18 * VAR_17;", "csa_table[VAR_2][0] = FIXHR(VAR_18/4);", "csa_table[VAR_2][1] = FIXHR(VAR_19/4);", "csa_table[VAR_2][2] = FIXHR(VAR_19/4) + FIXHR(VAR_18/4);", "csa_table[VAR_2][3] = FIXHR(VAR_19/4) - FIXHR(VAR_18/4);", "csa_table_float[VAR_2][0] = VAR_18;", "csa_table_float[VAR_2][1] = VAR_19;", "csa_table_float[VAR_2][2] = VAR_19 + VAR_18;", "csa_table_float[VAR_2][3] = VAR_19 - VAR_18;", "}", "for(VAR_2=0;VAR_2<36;VAR_2++) {", "for(VAR_3=0; VAR_3<4; VAR_3++){", "double VAR_20;", "if(VAR_3==2 && VAR_2%3 != 1)\ncontinue;", "VAR_20= sin(M_PI * (VAR_2 + 0.5) / 36.0);", "if(VAR_3==1){", "if (VAR_2>=30) VAR_20= 0;", "else if(VAR_2>=24) VAR_20= sin(M_PI * (VAR_2 - 18 + 0.5) / 12.0);", "else if(VAR_2>=18) VAR_20= 1;", "}else if(VAR_3==3){", "if (VAR_2< 6) VAR_20= 0;", "else if(VAR_2< 12) VAR_20= sin(M_PI * (VAR_2 - 6 + 0.5) / 12.0);", "else if(VAR_2< 18) VAR_20= 1;", "}", "VAR_20*= 0.5 / cos(M_PI*(2*VAR_2 + 19)/72);", "if(VAR_3==2)\nmdct_win[VAR_3][VAR_2/3] = FIXHR((VAR_20 / (1<<5)));", "else\nmdct_win[VAR_3][VAR_2 ] = FIXHR((VAR_20 / (1<<5)));", "}", "}", "for(VAR_3=0;VAR_3<4;VAR_3++) {", "for(VAR_2=0;VAR_2<36;VAR_2+=2) {", "mdct_win[VAR_3 + 4][VAR_2] = mdct_win[VAR_3][VAR_2];", "mdct_win[VAR_3 + 4][VAR_2 + 1] = -mdct_win[VAR_3][VAR_2 + 1];", "}", "}", "#if defined(DEBUG)\nfor(VAR_3=0;VAR_3<8;VAR_3++) {", "av_log(VAR_0, AV_LOG_DEBUG, \"win%VAR_20=\\VAR_13\", VAR_3);", "for(VAR_2=0;VAR_2<36;VAR_2++)", "av_log(VAR_0, AV_LOG_DEBUG, \"%VAR_16, \", (double)mdct_win[VAR_3][VAR_2] / FRAC_ONE);", "av_log(VAR_0, AV_LOG_DEBUG, \"\\VAR_13\");", "}", "#endif\nVAR_1 = 1;", "}", "s->inbuf_index = 0;", "s->inbuf = &s->inbuf1[s->inbuf_index][BACKSTEP_SIZE];", "s->inbuf_ptr = s->inbuf;", "#ifdef DEBUG\ns->frame_count = 0;", "#endif\nif (VAR_0->codec_id == CODEC_ID_MP3ADU)\ns->adu_mode = 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 25, 27 ], [ 29, 31 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73, 75, 77, 79 ], [ 81 ], [ 85 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 135, 137 ], [ 139 ], [ 141 ], [ 143, 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 171 ], [ 173, 175 ], [ 177 ], [ 179, 181 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221, 223 ], [ 225 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 255 ], [ 257 ], [ 261 ], [ 263 ], [ 265 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281, 283 ], [ 285 ], [ 287 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 321 ], [ 327 ], [ 329 ], [ 331 ], [ 335, 337 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 363 ], [ 367, 369 ], [ 371, 373 ], [ 377 ], [ 379 ], [ 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 401, 403 ], [ 405 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 415, 417 ], [ 419 ], [ 423 ], [ 425 ], [ 427 ], [ 429, 431 ], [ 433, 435, 437 ], [ 439 ], [ 441 ] ]
8,319
void checkasm_check_vf_threshold(void) { check_threshold_8(); report("threshold8"); }
false
FFmpeg
179a2f04eb2bd6df7221883a92dc4e00cf94394b
void checkasm_check_vf_threshold(void) { check_threshold_8(); report("threshold8"); }
{ "code": [], "line_no": [] }
void FUNC_0(void) { check_threshold_8(); report("threshold8"); }
[ "void FUNC_0(void)\n{", "check_threshold_8();", "report(\"threshold8\");", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ] ]
8,320
int loader_exec(const char * filename, char ** argv, char ** envp, struct target_pt_regs * regs, struct image_info *infop, struct linux_binprm *bprm) { int retval; int i; bprm->p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int); memset(bprm->page, 0, sizeof(bprm->page)); retval = open(filename, O_RDONLY); if (retval < 0) return retval; bprm->fd = retval; bprm->filename = (char *)filename; bprm->argc = count(argv); bprm->argv = argv; bprm->envc = count(envp); bprm->envp = envp; retval = prepare_binprm(bprm); if(retval>=0) { if (bprm->buf[0] == 0x7f && bprm->buf[1] == 'E' && bprm->buf[2] == 'L' && bprm->buf[3] == 'F') { retval = load_elf_binary(bprm, regs, infop); #if defined(TARGET_HAS_BFLT) } else if (bprm->buf[0] == 'b' && bprm->buf[1] == 'F' && bprm->buf[2] == 'L' && bprm->buf[3] == 'T') { retval = load_flt_binary(bprm,regs,infop); #endif } else { fprintf(stderr, "Unknown binary format\n"); return -1; } } if(retval>=0) { /* success. Initialize important registers */ do_init_thread(regs, infop); return retval; } /* Something went wrong, return the inode and free the argument pages*/ for (i=0 ; i<MAX_ARG_PAGES ; i++) { free(bprm->page[i]); } return(retval); }
true
qemu
7dd47667b9b0b23807fc1a550644fc2427462f41
int loader_exec(const char * filename, char ** argv, char ** envp, struct target_pt_regs * regs, struct image_info *infop, struct linux_binprm *bprm) { int retval; int i; bprm->p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int); memset(bprm->page, 0, sizeof(bprm->page)); retval = open(filename, O_RDONLY); if (retval < 0) return retval; bprm->fd = retval; bprm->filename = (char *)filename; bprm->argc = count(argv); bprm->argv = argv; bprm->envc = count(envp); bprm->envp = envp; retval = prepare_binprm(bprm); if(retval>=0) { if (bprm->buf[0] == 0x7f && bprm->buf[1] == 'E' && bprm->buf[2] == 'L' && bprm->buf[3] == 'F') { retval = load_elf_binary(bprm, regs, infop); #if defined(TARGET_HAS_BFLT) } else if (bprm->buf[0] == 'b' && bprm->buf[1] == 'F' && bprm->buf[2] == 'L' && bprm->buf[3] == 'T') { retval = load_flt_binary(bprm,regs,infop); #endif } else { fprintf(stderr, "Unknown binary format\n"); return -1; } } if(retval>=0) { do_init_thread(regs, infop); return retval; } for (i=0 ; i<MAX_ARG_PAGES ; i++) { free(bprm->page[i]); } return(retval); }
{ "code": [ " free(bprm->page[i]);" ], "line_no": [ 97 ] }
int FUNC_0(const char * VAR_0, char ** VAR_1, char ** VAR_2, struct target_pt_regs * VAR_3, struct image_info *VAR_4, struct linux_binprm *VAR_5) { int VAR_6; int VAR_7; VAR_5->p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int); memset(VAR_5->page, 0, sizeof(VAR_5->page)); VAR_6 = open(VAR_0, O_RDONLY); if (VAR_6 < 0) return VAR_6; VAR_5->fd = VAR_6; VAR_5->VAR_0 = (char *)VAR_0; VAR_5->argc = count(VAR_1); VAR_5->VAR_1 = VAR_1; VAR_5->envc = count(VAR_2); VAR_5->VAR_2 = VAR_2; VAR_6 = prepare_binprm(VAR_5); if(VAR_6>=0) { if (VAR_5->buf[0] == 0x7f && VAR_5->buf[1] == 'E' && VAR_5->buf[2] == 'L' && VAR_5->buf[3] == 'F') { VAR_6 = load_elf_binary(VAR_5, VAR_3, VAR_4); #if defined(TARGET_HAS_BFLT) } else if (VAR_5->buf[0] == 'b' && VAR_5->buf[1] == 'F' && VAR_5->buf[2] == 'L' && VAR_5->buf[3] == 'T') { VAR_6 = load_flt_binary(VAR_5,VAR_3,VAR_4); #endif } else { fprintf(stderr, "Unknown binary format\n"); return -1; } } if(VAR_6>=0) { do_init_thread(VAR_3, VAR_4); return VAR_6; } for (VAR_7=0 ; VAR_7<MAX_ARG_PAGES ; VAR_7++) { free(VAR_5->page[VAR_7]); } return(VAR_6); }
[ "int FUNC_0(const char * VAR_0, char ** VAR_1, char ** VAR_2,\nstruct target_pt_regs * VAR_3, struct image_info *VAR_4,\nstruct linux_binprm *VAR_5)\n{", "int VAR_6;", "int VAR_7;", "VAR_5->p = TARGET_PAGE_SIZE*MAX_ARG_PAGES-sizeof(unsigned int);", "memset(VAR_5->page, 0, sizeof(VAR_5->page));", "VAR_6 = open(VAR_0, O_RDONLY);", "if (VAR_6 < 0)\nreturn VAR_6;", "VAR_5->fd = VAR_6;", "VAR_5->VAR_0 = (char *)VAR_0;", "VAR_5->argc = count(VAR_1);", "VAR_5->VAR_1 = VAR_1;", "VAR_5->envc = count(VAR_2);", "VAR_5->VAR_2 = VAR_2;", "VAR_6 = prepare_binprm(VAR_5);", "if(VAR_6>=0) {", "if (VAR_5->buf[0] == 0x7f\n&& VAR_5->buf[1] == 'E'\n&& VAR_5->buf[2] == 'L'\n&& VAR_5->buf[3] == 'F') {", "VAR_6 = load_elf_binary(VAR_5, VAR_3, VAR_4);", "#if defined(TARGET_HAS_BFLT)\n} else if (VAR_5->buf[0] == 'b'", "&& VAR_5->buf[1] == 'F'\n&& VAR_5->buf[2] == 'L'\n&& VAR_5->buf[3] == 'T') {", "VAR_6 = load_flt_binary(VAR_5,VAR_3,VAR_4);", "#endif\n} else {", "fprintf(stderr, \"Unknown binary format\\n\");", "return -1;", "}", "}", "if(VAR_6>=0) {", "do_init_thread(VAR_3, VAR_4);", "return VAR_6;", "}", "for (VAR_7=0 ; VAR_7<MAX_ARG_PAGES ; VAR_7++) {", "free(VAR_5->page[VAR_7]);", "}", "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, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 43 ], [ 45, 47, 49, 51 ], [ 53 ], [ 55, 57 ], [ 59, 61, 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ] ]
8,321
static int mp_get_vlc(MotionPixelsContext *mp, GetBitContext *gb) { int i; i = (mp->codes_count == 1) ? 0 : get_vlc2(gb, mp->vlc.table, mp->max_codes_bits, 1); return mp->codes[i].delta; }
true
FFmpeg
ca41c72c6d9515d9045bd3b68104525dee81b8d0
static int mp_get_vlc(MotionPixelsContext *mp, GetBitContext *gb) { int i; i = (mp->codes_count == 1) ? 0 : get_vlc2(gb, mp->vlc.table, mp->max_codes_bits, 1); return mp->codes[i].delta; }
{ "code": [], "line_no": [] }
static int FUNC_0(MotionPixelsContext *VAR_0, GetBitContext *VAR_1) { int VAR_2; VAR_2 = (VAR_0->codes_count == 1) ? 0 : get_vlc2(VAR_1, VAR_0->vlc.table, VAR_0->max_codes_bits, 1); return VAR_0->codes[VAR_2].delta; }
[ "static int FUNC_0(MotionPixelsContext *VAR_0, GetBitContext *VAR_1)\n{", "int VAR_2;", "VAR_2 = (VAR_0->codes_count == 1) ? 0 : get_vlc2(VAR_1, VAR_0->vlc.table, VAR_0->max_codes_bits, 1);", "return VAR_0->codes[VAR_2].delta;", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 12 ], [ 14 ] ]
8,322
uint64_t helper_mulqv(CPUAlphaState *env, uint64_t op1, uint64_t op2) { uint64_t tl, th; muls64(&tl, &th, op1, op2); /* If th != 0 && th != -1, then we had an overflow */ if (unlikely((th + 1) > 1)) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return tl; }
true
qemu
4d1628e832dfc6ec02b0d196f6cc250aaa7bf3b3
uint64_t helper_mulqv(CPUAlphaState *env, uint64_t op1, uint64_t op2) { uint64_t tl, th; muls64(&tl, &th, op1, op2); if (unlikely((th + 1) > 1)) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return tl; }
{ "code": [ " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", "uint64_t helper_mulqv(CPUAlphaState *env, uint64_t op1, uint64_t op2)", " uint64_t tl, th;", " muls64(&tl, &th, op1, op2);", " if (unlikely((th + 1) > 1)) {", " arith_excp(env, GETPC(), EXC_M_IOV, 0);", " return tl;" ], "line_no": [ 15, 15, 15, 15, 1, 5, 9, 13, 15, 19 ] }
uint64_t FUNC_0(CPUAlphaState *env, uint64_t op1, uint64_t op2) { uint64_t tl, th; muls64(&tl, &th, op1, op2); if (unlikely((th + 1) > 1)) { arith_excp(env, GETPC(), EXC_M_IOV, 0); } return tl; }
[ "uint64_t FUNC_0(CPUAlphaState *env, uint64_t op1, uint64_t op2)\n{", "uint64_t tl, th;", "muls64(&tl, &th, op1, op2);", "if (unlikely((th + 1) > 1)) {", "arith_excp(env, GETPC(), EXC_M_IOV, 0);", "}", "return tl;", "}" ]
[ 1, 1, 1, 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
8,323
PCIDevice *pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) { PCIRTL8139State *d; RTL8139State *s; uint8_t *pci_conf; d = (PCIRTL8139State *)pci_register_device(bus, "RTL8139", sizeof(PCIRTL8139State), devfn, NULL, NULL); pci_conf = d->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8139); pci_conf[0x04] = 0x05; /* command = I/O space, Bus Master */ pci_conf[0x08] = RTL8139_PCI_REVID; /* PCI revision ID; >=0x20 is for 8139C+ */ pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET); pci_conf[0x0e] = 0x00; /* header_type */ pci_conf[0x3d] = 1; /* interrupt pin 0 */ pci_conf[0x34] = 0xdc; s = &d->rtl8139; /* I/O handler for memory-mapped I/O */ s->rtl8139_mmio_io_addr = cpu_register_io_memory(0, rtl8139_mmio_read, rtl8139_mmio_write, s); pci_register_io_region(&d->dev, 0, 0x100, PCI_ADDRESS_SPACE_IO, rtl8139_ioport_map); pci_register_io_region(&d->dev, 1, 0x100, PCI_ADDRESS_SPACE_MEM, rtl8139_mmio_map); s->pci_dev = (PCIDevice *)d; memcpy(s->macaddr, nd->macaddr, 6); rtl8139_reset(s); s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, rtl8139_receive, rtl8139_can_receive, s); qemu_format_nic_info_str(s->vc, s->macaddr); s->cplus_txbuffer = NULL; s->cplus_txbuffer_len = 0; s->cplus_txbuffer_offset = 0; register_savevm("rtl8139", -1, 4, rtl8139_save, rtl8139_load, s); #ifdef RTL8139_ONBOARD_TIMER s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s); qemu_mod_timer(s->timer, rtl8139_get_next_tctr_time(s,qemu_get_clock(vm_clock))); #endif /* RTL8139_ONBOARD_TIMER */ return (PCIDevice *)d; }
true
qemu
b946a1533209f61a93e34898aebb5b43154b99c3
PCIDevice *pci_rtl8139_init(PCIBus *bus, NICInfo *nd, int devfn) { PCIRTL8139State *d; RTL8139State *s; uint8_t *pci_conf; d = (PCIRTL8139State *)pci_register_device(bus, "RTL8139", sizeof(PCIRTL8139State), devfn, NULL, NULL); pci_conf = d->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8139); pci_conf[0x04] = 0x05; pci_conf[0x08] = RTL8139_PCI_REVID; pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET); pci_conf[0x0e] = 0x00; pci_conf[0x3d] = 1; pci_conf[0x34] = 0xdc; s = &d->rtl8139; s->rtl8139_mmio_io_addr = cpu_register_io_memory(0, rtl8139_mmio_read, rtl8139_mmio_write, s); pci_register_io_region(&d->dev, 0, 0x100, PCI_ADDRESS_SPACE_IO, rtl8139_ioport_map); pci_register_io_region(&d->dev, 1, 0x100, PCI_ADDRESS_SPACE_MEM, rtl8139_mmio_map); s->pci_dev = (PCIDevice *)d; memcpy(s->macaddr, nd->macaddr, 6); rtl8139_reset(s); s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, rtl8139_receive, rtl8139_can_receive, s); qemu_format_nic_info_str(s->vc, s->macaddr); s->cplus_txbuffer = NULL; s->cplus_txbuffer_len = 0; s->cplus_txbuffer_offset = 0; register_savevm("rtl8139", -1, 4, rtl8139_save, rtl8139_load, s); #ifdef RTL8139_ONBOARD_TIMER s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s); qemu_mod_timer(s->timer, rtl8139_get_next_tctr_time(s,qemu_get_clock(vm_clock))); #endif return (PCIDevice *)d; }
{ "code": [ " rtl8139_receive, rtl8139_can_receive, s);" ], "line_no": [ 73 ] }
PCIDevice *FUNC_0(PCIBus *bus, NICInfo *nd, int devfn) { PCIRTL8139State *d; RTL8139State *s; uint8_t *pci_conf; d = (PCIRTL8139State *)pci_register_device(bus, "RTL8139", sizeof(PCIRTL8139State), devfn, NULL, NULL); pci_conf = d->dev.config; pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK); pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8139); pci_conf[0x04] = 0x05; pci_conf[0x08] = RTL8139_PCI_REVID; pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET); pci_conf[0x0e] = 0x00; pci_conf[0x3d] = 1; pci_conf[0x34] = 0xdc; s = &d->rtl8139; s->rtl8139_mmio_io_addr = cpu_register_io_memory(0, rtl8139_mmio_read, rtl8139_mmio_write, s); pci_register_io_region(&d->dev, 0, 0x100, PCI_ADDRESS_SPACE_IO, rtl8139_ioport_map); pci_register_io_region(&d->dev, 1, 0x100, PCI_ADDRESS_SPACE_MEM, rtl8139_mmio_map); s->pci_dev = (PCIDevice *)d; memcpy(s->macaddr, nd->macaddr, 6); rtl8139_reset(s); s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, rtl8139_receive, rtl8139_can_receive, s); qemu_format_nic_info_str(s->vc, s->macaddr); s->cplus_txbuffer = NULL; s->cplus_txbuffer_len = 0; s->cplus_txbuffer_offset = 0; register_savevm("rtl8139", -1, 4, rtl8139_save, rtl8139_load, s); #ifdef RTL8139_ONBOARD_TIMER s->timer = qemu_new_timer(vm_clock, rtl8139_timer, s); qemu_mod_timer(s->timer, rtl8139_get_next_tctr_time(s,qemu_get_clock(vm_clock))); #endif return (PCIDevice *)d; }
[ "PCIDevice *FUNC_0(PCIBus *bus, NICInfo *nd, int devfn)\n{", "PCIRTL8139State *d;", "RTL8139State *s;", "uint8_t *pci_conf;", "d = (PCIRTL8139State *)pci_register_device(bus,\n\"RTL8139\", sizeof(PCIRTL8139State),\ndevfn,\nNULL, NULL);", "pci_conf = d->dev.config;", "pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK);", "pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8139);", "pci_conf[0x04] = 0x05;", "pci_conf[0x08] = RTL8139_PCI_REVID;", "pci_config_set_class(pci_conf, PCI_CLASS_NETWORK_ETHERNET);", "pci_conf[0x0e] = 0x00;", "pci_conf[0x3d] = 1;", "pci_conf[0x34] = 0xdc;", "s = &d->rtl8139;", "s->rtl8139_mmio_io_addr =\ncpu_register_io_memory(0, rtl8139_mmio_read, rtl8139_mmio_write, s);", "pci_register_io_region(&d->dev, 0, 0x100,\nPCI_ADDRESS_SPACE_IO, rtl8139_ioport_map);", "pci_register_io_region(&d->dev, 1, 0x100,\nPCI_ADDRESS_SPACE_MEM, rtl8139_mmio_map);", "s->pci_dev = (PCIDevice *)d;", "memcpy(s->macaddr, nd->macaddr, 6);", "rtl8139_reset(s);", "s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name,\nrtl8139_receive, rtl8139_can_receive, s);", "qemu_format_nic_info_str(s->vc, s->macaddr);", "s->cplus_txbuffer = NULL;", "s->cplus_txbuffer_len = 0;", "s->cplus_txbuffer_offset = 0;", "register_savevm(\"rtl8139\", -1, 4, rtl8139_save, rtl8139_load, s);", "#ifdef RTL8139_ONBOARD_TIMER\ns->timer = qemu_new_timer(vm_clock, rtl8139_timer, s);", "qemu_mod_timer(s->timer,\nrtl8139_get_next_tctr_time(s,qemu_get_clock(vm_clock)));", "#endif\nreturn (PCIDevice *)d;", "}" ]
[ 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 ], [ 9 ], [ 13, 15, 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 47, 49 ], [ 53, 55 ], [ 59, 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 77 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 93, 95 ], [ 99, 101 ], [ 103, 105 ], [ 107 ] ]
8,324
void usb_wakeup(USBEndpoint *ep, unsigned int stream) { USBDevice *dev = ep->dev; USBBus *bus = usb_bus_from_device(dev); if (dev->remote_wakeup && dev->port && dev->port->ops->wakeup) { dev->port->ops->wakeup(dev->port); if (bus->ops->wakeup_endpoint) { bus->ops->wakeup_endpoint(bus, ep, stream);
true
qemu
26022652c6fd067b9fa09280f5a6d6284a21c73f
void usb_wakeup(USBEndpoint *ep, unsigned int stream) { USBDevice *dev = ep->dev; USBBus *bus = usb_bus_from_device(dev); if (dev->remote_wakeup && dev->port && dev->port->ops->wakeup) { dev->port->ops->wakeup(dev->port); if (bus->ops->wakeup_endpoint) { bus->ops->wakeup_endpoint(bus, ep, stream);
{ "code": [], "line_no": [] }
void FUNC_0(USBEndpoint *VAR_0, unsigned int VAR_1) { USBDevice *dev = VAR_0->dev; USBBus *bus = usb_bus_from_device(dev); if (dev->remote_wakeup && dev->port && dev->port->ops->wakeup) { dev->port->ops->wakeup(dev->port); if (bus->ops->wakeup_endpoint) { bus->ops->wakeup_endpoint(bus, VAR_0, VAR_1);
[ "void FUNC_0(USBEndpoint *VAR_0, unsigned int VAR_1)\n{", "USBDevice *dev = VAR_0->dev;", "USBBus *bus = usb_bus_from_device(dev);", "if (dev->remote_wakeup && dev->port && dev->port->ops->wakeup) {", "dev->port->ops->wakeup(dev->port);", "if (bus->ops->wakeup_endpoint) {", "bus->ops->wakeup_endpoint(bus, VAR_0, VAR_1);" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 19 ], [ 21 ], [ 24 ], [ 26 ] ]
8,325
target_ulong helper_load_slb_vsid(CPUPPCState *env, target_ulong rb) { target_ulong rt; if (ppc_load_slb_vsid(env, rb, &rt) < 0) { helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_INVAL); } return rt; }
true
qemu
4cc2cc085586cdb787a24d78a7ba032fa657275a
target_ulong helper_load_slb_vsid(CPUPPCState *env, target_ulong rb) { target_ulong rt; if (ppc_load_slb_vsid(env, rb, &rt) < 0) { helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_INVAL); } return rt; }
{ "code": [ " target_ulong rt;", " target_ulong rt;" ], "line_no": [ 5, 5 ] }
target_ulong FUNC_0(CPUPPCState *env, target_ulong rb) { target_ulong rt; if (ppc_load_slb_vsid(env, rb, &rt) < 0) { helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM, POWERPC_EXCP_INVAL); } return rt; }
[ "target_ulong FUNC_0(CPUPPCState *env, target_ulong rb)\n{", "target_ulong rt;", "if (ppc_load_slb_vsid(env, rb, &rt) < 0) {", "helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM,\nPOWERPC_EXCP_INVAL);", "}", "return rt;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ] ]
8,326
static int mov_get_h264_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->par->codec_tag; int interlaced = track->par->field_order > AV_FIELD_PROGRESSIVE; AVStream *st = track->st; int rate = av_q2d(find_fps(s, st)); if (!tag) tag = MKTAG('a', 'v', 'c', 'i'); //fallback tag if (track->par->format == AV_PIX_FMT_YUV420P10) { if (track->par->width == 960 && track->par->height == 720) { if (!interlaced) { if (rate == 24) tag = MKTAG('a','i','5','p'); else if (rate == 25) tag = MKTAG('a','i','5','q'); else if (rate == 30) tag = MKTAG('a','i','5','p'); else if (rate == 50) tag = MKTAG('a','i','5','q'); else if (rate == 60) tag = MKTAG('a','i','5','p'); } } else if (track->par->width == 1440 && track->par->height == 1080) { if (!interlaced) { if (rate == 24) tag = MKTAG('a','i','5','3'); else if (rate == 25) tag = MKTAG('a','i','5','2'); else if (rate == 30) tag = MKTAG('a','i','5','3'); } else { if (rate == 50) tag = MKTAG('a','i','5','5'); else if (rate == 60) tag = MKTAG('a','i','5','6'); } } } else if (track->par->format == AV_PIX_FMT_YUV422P10) { if (track->par->width == 1280 && track->par->height == 720) { if (!interlaced) { if (rate == 24) tag = MKTAG('a','i','1','p'); else if (rate == 25) tag = MKTAG('a','i','1','q'); else if (rate == 30) tag = MKTAG('a','i','1','p'); else if (rate == 50) tag = MKTAG('a','i','1','q'); else if (rate == 60) tag = MKTAG('a','i','1','p'); } } else if (track->par->width == 1920 && track->par->height == 1080) { if (!interlaced) { if (rate == 24) tag = MKTAG('a','i','1','3'); else if (rate == 25) tag = MKTAG('a','i','1','2'); else if (rate == 30) tag = MKTAG('a','i','1','3'); } else { if (rate == 25) tag = MKTAG('a','i','1','5'); else if (rate == 50) tag = MKTAG('a','i','1','5'); else if (rate == 60) tag = MKTAG('a','i','1','6'); } } else if ( track->par->width == 4096 && track->par->height == 2160 || track->par->width == 3840 && track->par->height == 2160 || track->par->width == 2048 && track->par->height == 1080) { tag = MKTAG('a','i','v','x'); } } return tag; }
true
FFmpeg
77bc507f6f001b9f5fa75c664106261bd8f2c971
static int mov_get_h264_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = track->par->codec_tag; int interlaced = track->par->field_order > AV_FIELD_PROGRESSIVE; AVStream *st = track->st; int rate = av_q2d(find_fps(s, st)); if (!tag) tag = MKTAG('a', 'v', 'c', 'i'); if (track->par->format == AV_PIX_FMT_YUV420P10) { if (track->par->width == 960 && track->par->height == 720) { if (!interlaced) { if (rate == 24) tag = MKTAG('a','i','5','p'); else if (rate == 25) tag = MKTAG('a','i','5','q'); else if (rate == 30) tag = MKTAG('a','i','5','p'); else if (rate == 50) tag = MKTAG('a','i','5','q'); else if (rate == 60) tag = MKTAG('a','i','5','p'); } } else if (track->par->width == 1440 && track->par->height == 1080) { if (!interlaced) { if (rate == 24) tag = MKTAG('a','i','5','3'); else if (rate == 25) tag = MKTAG('a','i','5','2'); else if (rate == 30) tag = MKTAG('a','i','5','3'); } else { if (rate == 50) tag = MKTAG('a','i','5','5'); else if (rate == 60) tag = MKTAG('a','i','5','6'); } } } else if (track->par->format == AV_PIX_FMT_YUV422P10) { if (track->par->width == 1280 && track->par->height == 720) { if (!interlaced) { if (rate == 24) tag = MKTAG('a','i','1','p'); else if (rate == 25) tag = MKTAG('a','i','1','q'); else if (rate == 30) tag = MKTAG('a','i','1','p'); else if (rate == 50) tag = MKTAG('a','i','1','q'); else if (rate == 60) tag = MKTAG('a','i','1','p'); } } else if (track->par->width == 1920 && track->par->height == 1080) { if (!interlaced) { if (rate == 24) tag = MKTAG('a','i','1','3'); else if (rate == 25) tag = MKTAG('a','i','1','2'); else if (rate == 30) tag = MKTAG('a','i','1','3'); } else { if (rate == 25) tag = MKTAG('a','i','1','5'); else if (rate == 50) tag = MKTAG('a','i','1','5'); else if (rate == 60) tag = MKTAG('a','i','1','6'); } } else if ( track->par->width == 4096 && track->par->height == 2160 || track->par->width == 3840 && track->par->height == 2160 || track->par->width == 2048 && track->par->height == 1080) { tag = MKTAG('a','i','v','x'); } } return tag; }
{ "code": [ " int rate = av_q2d(find_fps(s, st));", " int rate = av_q2d(find_fps(s, st));" ], "line_no": [ 11, 11 ] }
static int FUNC_0(AVFormatContext *VAR_0, MOVTrack *VAR_1) { int VAR_2 = VAR_1->par->codec_tag; int VAR_3 = VAR_1->par->field_order > AV_FIELD_PROGRESSIVE; AVStream *st = VAR_1->st; int VAR_4 = av_q2d(find_fps(VAR_0, st)); if (!VAR_2) VAR_2 = MKTAG('a', 'v', 'c', 'i'); if (VAR_1->par->format == AV_PIX_FMT_YUV420P10) { if (VAR_1->par->width == 960 && VAR_1->par->height == 720) { if (!VAR_3) { if (VAR_4 == 24) VAR_2 = MKTAG('a','i','5','p'); else if (VAR_4 == 25) VAR_2 = MKTAG('a','i','5','q'); else if (VAR_4 == 30) VAR_2 = MKTAG('a','i','5','p'); else if (VAR_4 == 50) VAR_2 = MKTAG('a','i','5','q'); else if (VAR_4 == 60) VAR_2 = MKTAG('a','i','5','p'); } } else if (VAR_1->par->width == 1440 && VAR_1->par->height == 1080) { if (!VAR_3) { if (VAR_4 == 24) VAR_2 = MKTAG('a','i','5','3'); else if (VAR_4 == 25) VAR_2 = MKTAG('a','i','5','2'); else if (VAR_4 == 30) VAR_2 = MKTAG('a','i','5','3'); } else { if (VAR_4 == 50) VAR_2 = MKTAG('a','i','5','5'); else if (VAR_4 == 60) VAR_2 = MKTAG('a','i','5','6'); } } } else if (VAR_1->par->format == AV_PIX_FMT_YUV422P10) { if (VAR_1->par->width == 1280 && VAR_1->par->height == 720) { if (!VAR_3) { if (VAR_4 == 24) VAR_2 = MKTAG('a','i','1','p'); else if (VAR_4 == 25) VAR_2 = MKTAG('a','i','1','q'); else if (VAR_4 == 30) VAR_2 = MKTAG('a','i','1','p'); else if (VAR_4 == 50) VAR_2 = MKTAG('a','i','1','q'); else if (VAR_4 == 60) VAR_2 = MKTAG('a','i','1','p'); } } else if (VAR_1->par->width == 1920 && VAR_1->par->height == 1080) { if (!VAR_3) { if (VAR_4 == 24) VAR_2 = MKTAG('a','i','1','3'); else if (VAR_4 == 25) VAR_2 = MKTAG('a','i','1','2'); else if (VAR_4 == 30) VAR_2 = MKTAG('a','i','1','3'); } else { if (VAR_4 == 25) VAR_2 = MKTAG('a','i','1','5'); else if (VAR_4 == 50) VAR_2 = MKTAG('a','i','1','5'); else if (VAR_4 == 60) VAR_2 = MKTAG('a','i','1','6'); } } else if ( VAR_1->par->width == 4096 && VAR_1->par->height == 2160 || VAR_1->par->width == 3840 && VAR_1->par->height == 2160 || VAR_1->par->width == 2048 && VAR_1->par->height == 1080) { VAR_2 = MKTAG('a','i','v','x'); } } return VAR_2; }
[ "static int FUNC_0(AVFormatContext *VAR_0, MOVTrack *VAR_1)\n{", "int VAR_2 = VAR_1->par->codec_tag;", "int VAR_3 = VAR_1->par->field_order > AV_FIELD_PROGRESSIVE;", "AVStream *st = VAR_1->st;", "int VAR_4 = av_q2d(find_fps(VAR_0, st));", "if (!VAR_2)\nVAR_2 = MKTAG('a', 'v', 'c', 'i');", "if (VAR_1->par->format == AV_PIX_FMT_YUV420P10) {", "if (VAR_1->par->width == 960 && VAR_1->par->height == 720) {", "if (!VAR_3) {", "if (VAR_4 == 24) VAR_2 = MKTAG('a','i','5','p');", "else if (VAR_4 == 25) VAR_2 = MKTAG('a','i','5','q');", "else if (VAR_4 == 30) VAR_2 = MKTAG('a','i','5','p');", "else if (VAR_4 == 50) VAR_2 = MKTAG('a','i','5','q');", "else if (VAR_4 == 60) VAR_2 = MKTAG('a','i','5','p');", "}", "} else if (VAR_1->par->width == 1440 && VAR_1->par->height == 1080) {", "if (!VAR_3) {", "if (VAR_4 == 24) VAR_2 = MKTAG('a','i','5','3');", "else if (VAR_4 == 25) VAR_2 = MKTAG('a','i','5','2');", "else if (VAR_4 == 30) VAR_2 = MKTAG('a','i','5','3');", "} else {", "if (VAR_4 == 50) VAR_2 = MKTAG('a','i','5','5');", "else if (VAR_4 == 60) VAR_2 = MKTAG('a','i','5','6');", "}", "}", "} else if (VAR_1->par->format == AV_PIX_FMT_YUV422P10) {", "if (VAR_1->par->width == 1280 && VAR_1->par->height == 720) {", "if (!VAR_3) {", "if (VAR_4 == 24) VAR_2 = MKTAG('a','i','1','p');", "else if (VAR_4 == 25) VAR_2 = MKTAG('a','i','1','q');", "else if (VAR_4 == 30) VAR_2 = MKTAG('a','i','1','p');", "else if (VAR_4 == 50) VAR_2 = MKTAG('a','i','1','q');", "else if (VAR_4 == 60) VAR_2 = MKTAG('a','i','1','p');", "}", "} else if (VAR_1->par->width == 1920 && VAR_1->par->height == 1080) {", "if (!VAR_3) {", "if (VAR_4 == 24) VAR_2 = MKTAG('a','i','1','3');", "else if (VAR_4 == 25) VAR_2 = MKTAG('a','i','1','2');", "else if (VAR_4 == 30) VAR_2 = MKTAG('a','i','1','3');", "} else {", "if (VAR_4 == 25) VAR_2 = MKTAG('a','i','1','5');", "else if (VAR_4 == 50) VAR_2 = MKTAG('a','i','1','5');", "else if (VAR_4 == 60) VAR_2 = MKTAG('a','i','1','6');", "}", "} else if ( VAR_1->par->width == 4096 && VAR_1->par->height == 2160", "|| VAR_1->par->width == 3840 && VAR_1->par->height == 2160\n|| VAR_1->par->width == 2048 && VAR_1->par->height == 1080) {", "VAR_2 = MKTAG('a','i','v','x');", "}", "}", "return VAR_2;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 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 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ] ]
8,327
static int64_t get_dts(AVFormatContext *s, int64_t pos) { AVIOContext *pb = s->pb; int64_t dts; ffm_seek1(s, pos); avio_skip(pb, 4); dts = avio_rb64(pb); av_dlog(s, "dts=%0.6f\n", dts / 1000000.0); return dts; }
false
FFmpeg
229843aa359ae0c9519977d7fa952688db63f559
static int64_t get_dts(AVFormatContext *s, int64_t pos) { AVIOContext *pb = s->pb; int64_t dts; ffm_seek1(s, pos); avio_skip(pb, 4); dts = avio_rb64(pb); av_dlog(s, "dts=%0.6f\n", dts / 1000000.0); return dts; }
{ "code": [], "line_no": [] }
static int64_t FUNC_0(AVFormatContext *s, int64_t pos) { AVIOContext *pb = s->pb; int64_t dts; ffm_seek1(s, pos); avio_skip(pb, 4); dts = avio_rb64(pb); av_dlog(s, "dts=%0.6f\n", dts / 1000000.0); return dts; }
[ "static int64_t FUNC_0(AVFormatContext *s, int64_t pos)\n{", "AVIOContext *pb = s->pb;", "int64_t dts;", "ffm_seek1(s, pos);", "avio_skip(pb, 4);", "dts = avio_rb64(pb);", "av_dlog(s, \"dts=%0.6f\\n\", dts / 1000000.0);", "return dts;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
8,328
static void apply_channel_coupling(AC3EncodeContext *s) { LOCAL_ALIGNED_16(CoefType, cpl_coords, [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]); #if CONFIG_AC3ENC_FLOAT LOCAL_ALIGNED_16(int32_t, fixed_cpl_coords, [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]); #else int32_t (*fixed_cpl_coords)[AC3_MAX_CHANNELS][16] = cpl_coords; #endif int av_uninit(blk), ch, bnd, i, j; CoefSumType energy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}}; int cpl_start, num_cpl_coefs; memset(cpl_coords, 0, AC3_MAX_BLOCKS * sizeof(*cpl_coords)); #if CONFIG_AC3ENC_FLOAT memset(fixed_cpl_coords, 0, AC3_MAX_BLOCKS * sizeof(*cpl_coords)); #endif /* align start to 16-byte boundary. align length to multiple of 32. note: coupling start bin % 4 will always be 1 */ cpl_start = s->start_freq[CPL_CH] - 1; num_cpl_coefs = FFALIGN(s->num_cpl_subbands * 12 + 1, 32); cpl_start = FFMIN(256, cpl_start + num_cpl_coefs) - num_cpl_coefs; /* calculate coupling channel from fbw channels */ for (blk = 0; blk < s->num_blocks; blk++) { AC3Block *block = &s->blocks[blk]; CoefType *cpl_coef = &block->mdct_coef[CPL_CH][cpl_start]; if (!block->cpl_in_use) continue; memset(cpl_coef, 0, num_cpl_coefs * sizeof(*cpl_coef)); for (ch = 1; ch <= s->fbw_channels; ch++) { CoefType *ch_coef = &block->mdct_coef[ch][cpl_start]; if (!block->channel_in_cpl[ch]) continue; for (i = 0; i < num_cpl_coefs; i++) cpl_coef[i] += ch_coef[i]; } /* coefficients must be clipped in order to be encoded */ clip_coefficients(&s->adsp, cpl_coef, num_cpl_coefs); } /* calculate energy in each band in coupling channel and each fbw channel */ /* TODO: possibly use SIMD to speed up energy calculation */ bnd = 0; i = s->start_freq[CPL_CH]; while (i < s->cpl_end_freq) { int band_size = s->cpl_band_sizes[bnd]; for (ch = CPL_CH; ch <= s->fbw_channels; ch++) { for (blk = 0; blk < s->num_blocks; blk++) { AC3Block *block = &s->blocks[blk]; if (!block->cpl_in_use || (ch > CPL_CH && !block->channel_in_cpl[ch])) continue; for (j = 0; j < band_size; j++) { CoefType v = block->mdct_coef[ch][i+j]; MAC_COEF(energy[blk][ch][bnd], v, v); } } } i += band_size; bnd++; } /* calculate coupling coordinates for all blocks for all channels */ for (blk = 0; blk < s->num_blocks; blk++) { AC3Block *block = &s->blocks[blk]; if (!block->cpl_in_use) continue; for (ch = 1; ch <= s->fbw_channels; ch++) { if (!block->channel_in_cpl[ch]) continue; for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { cpl_coords[blk][ch][bnd] = calc_cpl_coord(energy[blk][ch][bnd], energy[blk][CPL_CH][bnd]); } } } /* determine which blocks to send new coupling coordinates for */ for (blk = 0; blk < s->num_blocks; blk++) { AC3Block *block = &s->blocks[blk]; AC3Block *block0 = blk ? &s->blocks[blk-1] : NULL; memset(block->new_cpl_coords, 0, sizeof(block->new_cpl_coords)); if (block->cpl_in_use) { /* send new coordinates if this is the first block, if previous * block did not use coupling but this block does, the channels * using coupling has changed from the previous block, or the * coordinate difference from the last block for any channel is * greater than a threshold value. */ if (blk == 0 || !block0->cpl_in_use) { for (ch = 1; ch <= s->fbw_channels; ch++) block->new_cpl_coords[ch] = 1; } else { for (ch = 1; ch <= s->fbw_channels; ch++) { if (!block->channel_in_cpl[ch]) continue; if (!block0->channel_in_cpl[ch]) { block->new_cpl_coords[ch] = 1; } else { CoefSumType coord_diff = 0; for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { coord_diff += FFABS(cpl_coords[blk-1][ch][bnd] - cpl_coords[blk ][ch][bnd]); } coord_diff /= s->num_cpl_bands; if (coord_diff > NEW_CPL_COORD_THRESHOLD) block->new_cpl_coords[ch] = 1; } } } } } /* calculate final coupling coordinates, taking into account reusing of coordinates in successive blocks */ for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { blk = 0; while (blk < s->num_blocks) { int av_uninit(blk1); AC3Block *block = &s->blocks[blk]; if (!block->cpl_in_use) { blk++; continue; } for (ch = 1; ch <= s->fbw_channels; ch++) { CoefSumType energy_ch, energy_cpl; if (!block->channel_in_cpl[ch]) continue; energy_cpl = energy[blk][CPL_CH][bnd]; energy_ch = energy[blk][ch][bnd]; blk1 = blk+1; while (!s->blocks[blk1].new_cpl_coords[ch] && blk1 < s->num_blocks) { if (s->blocks[blk1].cpl_in_use) { energy_cpl += energy[blk1][CPL_CH][bnd]; energy_ch += energy[blk1][ch][bnd]; } blk1++; } cpl_coords[blk][ch][bnd] = calc_cpl_coord(energy_ch, energy_cpl); } blk = blk1; } } /* calculate exponents/mantissas for coupling coordinates */ for (blk = 0; blk < s->num_blocks; blk++) { AC3Block *block = &s->blocks[blk]; if (!block->cpl_in_use) continue; #if CONFIG_AC3ENC_FLOAT s->ac3dsp.float_to_fixed24(fixed_cpl_coords[blk][1], cpl_coords[blk][1], s->fbw_channels * 16); #endif s->ac3dsp.extract_exponents(block->cpl_coord_exp[1], fixed_cpl_coords[blk][1], s->fbw_channels * 16); for (ch = 1; ch <= s->fbw_channels; ch++) { int bnd, min_exp, max_exp, master_exp; if (!block->new_cpl_coords[ch]) continue; /* determine master exponent */ min_exp = max_exp = block->cpl_coord_exp[ch][0]; for (bnd = 1; bnd < s->num_cpl_bands; bnd++) { int exp = block->cpl_coord_exp[ch][bnd]; min_exp = FFMIN(exp, min_exp); max_exp = FFMAX(exp, max_exp); } master_exp = ((max_exp - 15) + 2) / 3; master_exp = FFMAX(master_exp, 0); while (min_exp < master_exp * 3) master_exp--; for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { block->cpl_coord_exp[ch][bnd] = av_clip(block->cpl_coord_exp[ch][bnd] - master_exp * 3, 0, 15); } block->cpl_master_exp[ch] = master_exp; /* quantize mantissas */ for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { int cpl_exp = block->cpl_coord_exp[ch][bnd]; int cpl_mant = (fixed_cpl_coords[blk][ch][bnd] << (5 + cpl_exp + master_exp * 3)) >> 24; if (cpl_exp == 15) cpl_mant >>= 1; else cpl_mant -= 16; block->cpl_coord_mant[ch][bnd] = cpl_mant; } } } if (CONFIG_EAC3_ENCODER && s->eac3) ff_eac3_set_cpl_states(s); }
false
FFmpeg
d85ebea3f3b68ebccfe308fa839fc30fa634e4de
static void apply_channel_coupling(AC3EncodeContext *s) { LOCAL_ALIGNED_16(CoefType, cpl_coords, [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]); #if CONFIG_AC3ENC_FLOAT LOCAL_ALIGNED_16(int32_t, fixed_cpl_coords, [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]); #else int32_t (*fixed_cpl_coords)[AC3_MAX_CHANNELS][16] = cpl_coords; #endif int av_uninit(blk), ch, bnd, i, j; CoefSumType energy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}}; int cpl_start, num_cpl_coefs; memset(cpl_coords, 0, AC3_MAX_BLOCKS * sizeof(*cpl_coords)); #if CONFIG_AC3ENC_FLOAT memset(fixed_cpl_coords, 0, AC3_MAX_BLOCKS * sizeof(*cpl_coords)); #endif cpl_start = s->start_freq[CPL_CH] - 1; num_cpl_coefs = FFALIGN(s->num_cpl_subbands * 12 + 1, 32); cpl_start = FFMIN(256, cpl_start + num_cpl_coefs) - num_cpl_coefs; for (blk = 0; blk < s->num_blocks; blk++) { AC3Block *block = &s->blocks[blk]; CoefType *cpl_coef = &block->mdct_coef[CPL_CH][cpl_start]; if (!block->cpl_in_use) continue; memset(cpl_coef, 0, num_cpl_coefs * sizeof(*cpl_coef)); for (ch = 1; ch <= s->fbw_channels; ch++) { CoefType *ch_coef = &block->mdct_coef[ch][cpl_start]; if (!block->channel_in_cpl[ch]) continue; for (i = 0; i < num_cpl_coefs; i++) cpl_coef[i] += ch_coef[i]; } clip_coefficients(&s->adsp, cpl_coef, num_cpl_coefs); } bnd = 0; i = s->start_freq[CPL_CH]; while (i < s->cpl_end_freq) { int band_size = s->cpl_band_sizes[bnd]; for (ch = CPL_CH; ch <= s->fbw_channels; ch++) { for (blk = 0; blk < s->num_blocks; blk++) { AC3Block *block = &s->blocks[blk]; if (!block->cpl_in_use || (ch > CPL_CH && !block->channel_in_cpl[ch])) continue; for (j = 0; j < band_size; j++) { CoefType v = block->mdct_coef[ch][i+j]; MAC_COEF(energy[blk][ch][bnd], v, v); } } } i += band_size; bnd++; } for (blk = 0; blk < s->num_blocks; blk++) { AC3Block *block = &s->blocks[blk]; if (!block->cpl_in_use) continue; for (ch = 1; ch <= s->fbw_channels; ch++) { if (!block->channel_in_cpl[ch]) continue; for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { cpl_coords[blk][ch][bnd] = calc_cpl_coord(energy[blk][ch][bnd], energy[blk][CPL_CH][bnd]); } } } for (blk = 0; blk < s->num_blocks; blk++) { AC3Block *block = &s->blocks[blk]; AC3Block *block0 = blk ? &s->blocks[blk-1] : NULL; memset(block->new_cpl_coords, 0, sizeof(block->new_cpl_coords)); if (block->cpl_in_use) { if (blk == 0 || !block0->cpl_in_use) { for (ch = 1; ch <= s->fbw_channels; ch++) block->new_cpl_coords[ch] = 1; } else { for (ch = 1; ch <= s->fbw_channels; ch++) { if (!block->channel_in_cpl[ch]) continue; if (!block0->channel_in_cpl[ch]) { block->new_cpl_coords[ch] = 1; } else { CoefSumType coord_diff = 0; for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { coord_diff += FFABS(cpl_coords[blk-1][ch][bnd] - cpl_coords[blk ][ch][bnd]); } coord_diff /= s->num_cpl_bands; if (coord_diff > NEW_CPL_COORD_THRESHOLD) block->new_cpl_coords[ch] = 1; } } } } } for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { blk = 0; while (blk < s->num_blocks) { int av_uninit(blk1); AC3Block *block = &s->blocks[blk]; if (!block->cpl_in_use) { blk++; continue; } for (ch = 1; ch <= s->fbw_channels; ch++) { CoefSumType energy_ch, energy_cpl; if (!block->channel_in_cpl[ch]) continue; energy_cpl = energy[blk][CPL_CH][bnd]; energy_ch = energy[blk][ch][bnd]; blk1 = blk+1; while (!s->blocks[blk1].new_cpl_coords[ch] && blk1 < s->num_blocks) { if (s->blocks[blk1].cpl_in_use) { energy_cpl += energy[blk1][CPL_CH][bnd]; energy_ch += energy[blk1][ch][bnd]; } blk1++; } cpl_coords[blk][ch][bnd] = calc_cpl_coord(energy_ch, energy_cpl); } blk = blk1; } } for (blk = 0; blk < s->num_blocks; blk++) { AC3Block *block = &s->blocks[blk]; if (!block->cpl_in_use) continue; #if CONFIG_AC3ENC_FLOAT s->ac3dsp.float_to_fixed24(fixed_cpl_coords[blk][1], cpl_coords[blk][1], s->fbw_channels * 16); #endif s->ac3dsp.extract_exponents(block->cpl_coord_exp[1], fixed_cpl_coords[blk][1], s->fbw_channels * 16); for (ch = 1; ch <= s->fbw_channels; ch++) { int bnd, min_exp, max_exp, master_exp; if (!block->new_cpl_coords[ch]) continue; min_exp = max_exp = block->cpl_coord_exp[ch][0]; for (bnd = 1; bnd < s->num_cpl_bands; bnd++) { int exp = block->cpl_coord_exp[ch][bnd]; min_exp = FFMIN(exp, min_exp); max_exp = FFMAX(exp, max_exp); } master_exp = ((max_exp - 15) + 2) / 3; master_exp = FFMAX(master_exp, 0); while (min_exp < master_exp * 3) master_exp--; for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { block->cpl_coord_exp[ch][bnd] = av_clip(block->cpl_coord_exp[ch][bnd] - master_exp * 3, 0, 15); } block->cpl_master_exp[ch] = master_exp; for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { int cpl_exp = block->cpl_coord_exp[ch][bnd]; int cpl_mant = (fixed_cpl_coords[blk][ch][bnd] << (5 + cpl_exp + master_exp * 3)) >> 24; if (cpl_exp == 15) cpl_mant >>= 1; else cpl_mant -= 16; block->cpl_coord_mant[ch][bnd] = cpl_mant; } } } if (CONFIG_EAC3_ENCODER && s->eac3) ff_eac3_set_cpl_states(s); }
{ "code": [], "line_no": [] }
static void FUNC_0(AC3EncodeContext *VAR_0) { LOCAL_ALIGNED_16(CoefType, cpl_coords, [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]); #if CONFIG_AC3ENC_FLOAT LOCAL_ALIGNED_16(int32_t, fixed_cpl_coords, [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]); #else int32_t (*fixed_cpl_coords)[AC3_MAX_CHANNELS][16] = cpl_coords; #endif int FUNC_1(blk), ch, bnd, i, j; CoefSumType energy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}}; int VAR_1, VAR_2; memset(cpl_coords, 0, AC3_MAX_BLOCKS * sizeof(*cpl_coords)); #if CONFIG_AC3ENC_FLOAT memset(fixed_cpl_coords, 0, AC3_MAX_BLOCKS * sizeof(*cpl_coords)); #endif VAR_1 = VAR_0->start_freq[CPL_CH] - 1; VAR_2 = FFALIGN(VAR_0->num_cpl_subbands * 12 + 1, 32); VAR_1 = FFMIN(256, VAR_1 + VAR_2) - VAR_2; for (blk = 0; blk < VAR_0->num_blocks; blk++) { AC3Block *block = &VAR_0->blocks[blk]; CoefType *cpl_coef = &block->mdct_coef[CPL_CH][VAR_1]; if (!block->cpl_in_use) continue; memset(cpl_coef, 0, VAR_2 * sizeof(*cpl_coef)); for (ch = 1; ch <= VAR_0->fbw_channels; ch++) { CoefType *ch_coef = &block->mdct_coef[ch][VAR_1]; if (!block->channel_in_cpl[ch]) continue; for (i = 0; i < VAR_2; i++) cpl_coef[i] += ch_coef[i]; } clip_coefficients(&VAR_0->adsp, cpl_coef, VAR_2); } bnd = 0; i = VAR_0->start_freq[CPL_CH]; while (i < VAR_0->cpl_end_freq) { int VAR_3 = VAR_0->cpl_band_sizes[bnd]; for (ch = CPL_CH; ch <= VAR_0->fbw_channels; ch++) { for (blk = 0; blk < VAR_0->num_blocks; blk++) { AC3Block *block = &VAR_0->blocks[blk]; if (!block->cpl_in_use || (ch > CPL_CH && !block->channel_in_cpl[ch])) continue; for (j = 0; j < VAR_3; j++) { CoefType v = block->mdct_coef[ch][i+j]; MAC_COEF(energy[blk][ch][bnd], v, v); } } } i += VAR_3; bnd++; } for (blk = 0; blk < VAR_0->num_blocks; blk++) { AC3Block *block = &VAR_0->blocks[blk]; if (!block->cpl_in_use) continue; for (ch = 1; ch <= VAR_0->fbw_channels; ch++) { if (!block->channel_in_cpl[ch]) continue; for (bnd = 0; bnd < VAR_0->num_cpl_bands; bnd++) { cpl_coords[blk][ch][bnd] = calc_cpl_coord(energy[blk][ch][bnd], energy[blk][CPL_CH][bnd]); } } } for (blk = 0; blk < VAR_0->num_blocks; blk++) { AC3Block *block = &VAR_0->blocks[blk]; AC3Block *block0 = blk ? &VAR_0->blocks[blk-1] : NULL; memset(block->new_cpl_coords, 0, sizeof(block->new_cpl_coords)); if (block->cpl_in_use) { if (blk == 0 || !block0->cpl_in_use) { for (ch = 1; ch <= VAR_0->fbw_channels; ch++) block->new_cpl_coords[ch] = 1; } else { for (ch = 1; ch <= VAR_0->fbw_channels; ch++) { if (!block->channel_in_cpl[ch]) continue; if (!block0->channel_in_cpl[ch]) { block->new_cpl_coords[ch] = 1; } else { CoefSumType coord_diff = 0; for (bnd = 0; bnd < VAR_0->num_cpl_bands; bnd++) { coord_diff += FFABS(cpl_coords[blk-1][ch][bnd] - cpl_coords[blk ][ch][bnd]); } coord_diff /= VAR_0->num_cpl_bands; if (coord_diff > NEW_CPL_COORD_THRESHOLD) block->new_cpl_coords[ch] = 1; } } } } } for (bnd = 0; bnd < VAR_0->num_cpl_bands; bnd++) { blk = 0; while (blk < VAR_0->num_blocks) { int FUNC_1(blk1); AC3Block *block = &VAR_0->blocks[blk]; if (!block->cpl_in_use) { blk++; continue; } for (ch = 1; ch <= VAR_0->fbw_channels; ch++) { CoefSumType energy_ch, energy_cpl; if (!block->channel_in_cpl[ch]) continue; energy_cpl = energy[blk][CPL_CH][bnd]; energy_ch = energy[blk][ch][bnd]; blk1 = blk+1; while (!VAR_0->blocks[blk1].new_cpl_coords[ch] && blk1 < VAR_0->num_blocks) { if (VAR_0->blocks[blk1].cpl_in_use) { energy_cpl += energy[blk1][CPL_CH][bnd]; energy_ch += energy[blk1][ch][bnd]; } blk1++; } cpl_coords[blk][ch][bnd] = calc_cpl_coord(energy_ch, energy_cpl); } blk = blk1; } } for (blk = 0; blk < VAR_0->num_blocks; blk++) { AC3Block *block = &VAR_0->blocks[blk]; if (!block->cpl_in_use) continue; #if CONFIG_AC3ENC_FLOAT VAR_0->ac3dsp.float_to_fixed24(fixed_cpl_coords[blk][1], cpl_coords[blk][1], VAR_0->fbw_channels * 16); #endif VAR_0->ac3dsp.extract_exponents(block->cpl_coord_exp[1], fixed_cpl_coords[blk][1], VAR_0->fbw_channels * 16); for (ch = 1; ch <= VAR_0->fbw_channels; ch++) { int bnd, min_exp, max_exp, master_exp; if (!block->new_cpl_coords[ch]) continue; min_exp = max_exp = block->cpl_coord_exp[ch][0]; for (bnd = 1; bnd < VAR_0->num_cpl_bands; bnd++) { int exp = block->cpl_coord_exp[ch][bnd]; min_exp = FFMIN(exp, min_exp); max_exp = FFMAX(exp, max_exp); } master_exp = ((max_exp - 15) + 2) / 3; master_exp = FFMAX(master_exp, 0); while (min_exp < master_exp * 3) master_exp--; for (bnd = 0; bnd < VAR_0->num_cpl_bands; bnd++) { block->cpl_coord_exp[ch][bnd] = av_clip(block->cpl_coord_exp[ch][bnd] - master_exp * 3, 0, 15); } block->cpl_master_exp[ch] = master_exp; for (bnd = 0; bnd < VAR_0->num_cpl_bands; bnd++) { int cpl_exp = block->cpl_coord_exp[ch][bnd]; int cpl_mant = (fixed_cpl_coords[blk][ch][bnd] << (5 + cpl_exp + master_exp * 3)) >> 24; if (cpl_exp == 15) cpl_mant >>= 1; else cpl_mant -= 16; block->cpl_coord_mant[ch][bnd] = cpl_mant; } } } if (CONFIG_EAC3_ENCODER && VAR_0->eac3) ff_eac3_set_cpl_states(VAR_0); }
[ "static void FUNC_0(AC3EncodeContext *VAR_0)\n{", "LOCAL_ALIGNED_16(CoefType, cpl_coords, [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]);", "#if CONFIG_AC3ENC_FLOAT\nLOCAL_ALIGNED_16(int32_t, fixed_cpl_coords, [AC3_MAX_BLOCKS], [AC3_MAX_CHANNELS][16]);", "#else\nint32_t (*fixed_cpl_coords)[AC3_MAX_CHANNELS][16] = cpl_coords;", "#endif\nint FUNC_1(blk), ch, bnd, i, j;", "CoefSumType energy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS][16] = {{{0}}};", "int VAR_1, VAR_2;", "memset(cpl_coords, 0, AC3_MAX_BLOCKS * sizeof(*cpl_coords));", "#if CONFIG_AC3ENC_FLOAT\nmemset(fixed_cpl_coords, 0, AC3_MAX_BLOCKS * sizeof(*cpl_coords));", "#endif\nVAR_1 = VAR_0->start_freq[CPL_CH] - 1;", "VAR_2 = FFALIGN(VAR_0->num_cpl_subbands * 12 + 1, 32);", "VAR_1 = FFMIN(256, VAR_1 + VAR_2) - VAR_2;", "for (blk = 0; blk < VAR_0->num_blocks; blk++) {", "AC3Block *block = &VAR_0->blocks[blk];", "CoefType *cpl_coef = &block->mdct_coef[CPL_CH][VAR_1];", "if (!block->cpl_in_use)\ncontinue;", "memset(cpl_coef, 0, VAR_2 * sizeof(*cpl_coef));", "for (ch = 1; ch <= VAR_0->fbw_channels; ch++) {", "CoefType *ch_coef = &block->mdct_coef[ch][VAR_1];", "if (!block->channel_in_cpl[ch])\ncontinue;", "for (i = 0; i < VAR_2; i++)", "cpl_coef[i] += ch_coef[i];", "}", "clip_coefficients(&VAR_0->adsp, cpl_coef, VAR_2);", "}", "bnd = 0;", "i = VAR_0->start_freq[CPL_CH];", "while (i < VAR_0->cpl_end_freq) {", "int VAR_3 = VAR_0->cpl_band_sizes[bnd];", "for (ch = CPL_CH; ch <= VAR_0->fbw_channels; ch++) {", "for (blk = 0; blk < VAR_0->num_blocks; blk++) {", "AC3Block *block = &VAR_0->blocks[blk];", "if (!block->cpl_in_use || (ch > CPL_CH && !block->channel_in_cpl[ch]))\ncontinue;", "for (j = 0; j < VAR_3; j++) {", "CoefType v = block->mdct_coef[ch][i+j];", "MAC_COEF(energy[blk][ch][bnd], v, v);", "}", "}", "}", "i += VAR_3;", "bnd++;", "}", "for (blk = 0; blk < VAR_0->num_blocks; blk++) {", "AC3Block *block = &VAR_0->blocks[blk];", "if (!block->cpl_in_use)\ncontinue;", "for (ch = 1; ch <= VAR_0->fbw_channels; ch++) {", "if (!block->channel_in_cpl[ch])\ncontinue;", "for (bnd = 0; bnd < VAR_0->num_cpl_bands; bnd++) {", "cpl_coords[blk][ch][bnd] = calc_cpl_coord(energy[blk][ch][bnd],\nenergy[blk][CPL_CH][bnd]);", "}", "}", "}", "for (blk = 0; blk < VAR_0->num_blocks; blk++) {", "AC3Block *block = &VAR_0->blocks[blk];", "AC3Block *block0 = blk ? &VAR_0->blocks[blk-1] : NULL;", "memset(block->new_cpl_coords, 0, sizeof(block->new_cpl_coords));", "if (block->cpl_in_use) {", "if (blk == 0 || !block0->cpl_in_use) {", "for (ch = 1; ch <= VAR_0->fbw_channels; ch++)", "block->new_cpl_coords[ch] = 1;", "} else {", "for (ch = 1; ch <= VAR_0->fbw_channels; ch++) {", "if (!block->channel_in_cpl[ch])\ncontinue;", "if (!block0->channel_in_cpl[ch]) {", "block->new_cpl_coords[ch] = 1;", "} else {", "CoefSumType coord_diff = 0;", "for (bnd = 0; bnd < VAR_0->num_cpl_bands; bnd++) {", "coord_diff += FFABS(cpl_coords[blk-1][ch][bnd] -\ncpl_coords[blk ][ch][bnd]);", "}", "coord_diff /= VAR_0->num_cpl_bands;", "if (coord_diff > NEW_CPL_COORD_THRESHOLD)\nblock->new_cpl_coords[ch] = 1;", "}", "}", "}", "}", "}", "for (bnd = 0; bnd < VAR_0->num_cpl_bands; bnd++) {", "blk = 0;", "while (blk < VAR_0->num_blocks) {", "int FUNC_1(blk1);", "AC3Block *block = &VAR_0->blocks[blk];", "if (!block->cpl_in_use) {", "blk++;", "continue;", "}", "for (ch = 1; ch <= VAR_0->fbw_channels; ch++) {", "CoefSumType energy_ch, energy_cpl;", "if (!block->channel_in_cpl[ch])\ncontinue;", "energy_cpl = energy[blk][CPL_CH][bnd];", "energy_ch = energy[blk][ch][bnd];", "blk1 = blk+1;", "while (!VAR_0->blocks[blk1].new_cpl_coords[ch] && blk1 < VAR_0->num_blocks) {", "if (VAR_0->blocks[blk1].cpl_in_use) {", "energy_cpl += energy[blk1][CPL_CH][bnd];", "energy_ch += energy[blk1][ch][bnd];", "}", "blk1++;", "}", "cpl_coords[blk][ch][bnd] = calc_cpl_coord(energy_ch, energy_cpl);", "}", "blk = blk1;", "}", "}", "for (blk = 0; blk < VAR_0->num_blocks; blk++) {", "AC3Block *block = &VAR_0->blocks[blk];", "if (!block->cpl_in_use)\ncontinue;", "#if CONFIG_AC3ENC_FLOAT\nVAR_0->ac3dsp.float_to_fixed24(fixed_cpl_coords[blk][1],\ncpl_coords[blk][1],\nVAR_0->fbw_channels * 16);", "#endif\nVAR_0->ac3dsp.extract_exponents(block->cpl_coord_exp[1],\nfixed_cpl_coords[blk][1],\nVAR_0->fbw_channels * 16);", "for (ch = 1; ch <= VAR_0->fbw_channels; ch++) {", "int bnd, min_exp, max_exp, master_exp;", "if (!block->new_cpl_coords[ch])\ncontinue;", "min_exp = max_exp = block->cpl_coord_exp[ch][0];", "for (bnd = 1; bnd < VAR_0->num_cpl_bands; bnd++) {", "int exp = block->cpl_coord_exp[ch][bnd];", "min_exp = FFMIN(exp, min_exp);", "max_exp = FFMAX(exp, max_exp);", "}", "master_exp = ((max_exp - 15) + 2) / 3;", "master_exp = FFMAX(master_exp, 0);", "while (min_exp < master_exp * 3)\nmaster_exp--;", "for (bnd = 0; bnd < VAR_0->num_cpl_bands; bnd++) {", "block->cpl_coord_exp[ch][bnd] = av_clip(block->cpl_coord_exp[ch][bnd] -\nmaster_exp * 3, 0, 15);", "}", "block->cpl_master_exp[ch] = master_exp;", "for (bnd = 0; bnd < VAR_0->num_cpl_bands; bnd++) {", "int cpl_exp = block->cpl_coord_exp[ch][bnd];", "int cpl_mant = (fixed_cpl_coords[blk][ch][bnd] << (5 + cpl_exp + master_exp * 3)) >> 24;", "if (cpl_exp == 15)\ncpl_mant >>= 1;", "else\ncpl_mant -= 16;", "block->cpl_coord_mant[ch][bnd] = cpl_mant;", "}", "}", "}", "if (CONFIG_EAC3_ENCODER && VAR_0->eac3)\nff_eac3_set_cpl_states(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, 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 ], [ 27, 29 ], [ 31, 39 ], [ 41 ], [ 43 ], [ 49 ], [ 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 79 ], [ 81 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 171 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193, 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 213 ], [ 215, 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 299 ], [ 301 ], [ 303, 305 ], [ 309, 311, 313, 315 ], [ 317, 319, 321, 323 ], [ 327 ], [ 329 ], [ 333, 335 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357, 359 ], [ 361 ], [ 363, 365 ], [ 367 ], [ 369 ], [ 375 ], [ 377 ], [ 379 ], [ 381, 383 ], [ 385, 387 ], [ 391 ], [ 393 ], [ 395 ], [ 397 ], [ 401, 403 ], [ 405 ] ]
8,329
static int write_packet(AVFormatContext *s, AVPacket *pkt) { WVMuxContext *wc = s->priv_data; AVCodecContext *codec = s->streams[0]->codec; AVIOContext *pb = s->pb; uint64_t size; uint32_t flags; uint32_t left = pkt->size; uint8_t *ptr = pkt->data; int off = codec->channels > 2 ? 4 : 0; /* FIXME: Simplify decoder/demuxer so bellow code can support midstream * change of stream parameters */ wc->duration += pkt->duration; ffio_wfourcc(pb, "wvpk"); if (off) { size = AV_RL32(pkt->data); if (size <= 12) return AVERROR_INVALIDDATA; size -= 12; } else { size = pkt->size; } if (size + off > left) return AVERROR_INVALIDDATA; avio_wl32(pb, size + 12); avio_wl16(pb, 0x410); avio_w8(pb, 0); avio_w8(pb, 0); avio_wl32(pb, -1); avio_wl32(pb, pkt->pts); ptr += off; left -= off; flags = AV_RL32(ptr + 4); avio_write(pb, ptr, size); ptr += size; left -= size; while (!(flags & WV_END_BLOCK) && (left >= 4 + WV_EXTRA_SIZE)) { ffio_wfourcc(pb, "wvpk"); size = AV_RL32(ptr); ptr += 4; left -= 4; if (size < 24 || size - 24 > left) return AVERROR_INVALIDDATA; avio_wl32(pb, size); avio_wl16(pb, 0x410); avio_w8(pb, 0); avio_w8(pb, 0); avio_wl32(pb, -1); avio_wl32(pb, pkt->pts); flags = AV_RL32(ptr + 4); avio_write(pb, ptr, WV_EXTRA_SIZE); ptr += WV_EXTRA_SIZE; left -= WV_EXTRA_SIZE; avio_write(pb, ptr, size - 24); ptr += size - 24; left -= size - 24; } return 0; }
false
FFmpeg
269fc8e04906ffd965aa19425ca90980b23c6508
static int write_packet(AVFormatContext *s, AVPacket *pkt) { WVMuxContext *wc = s->priv_data; AVCodecContext *codec = s->streams[0]->codec; AVIOContext *pb = s->pb; uint64_t size; uint32_t flags; uint32_t left = pkt->size; uint8_t *ptr = pkt->data; int off = codec->channels > 2 ? 4 : 0; wc->duration += pkt->duration; ffio_wfourcc(pb, "wvpk"); if (off) { size = AV_RL32(pkt->data); if (size <= 12) return AVERROR_INVALIDDATA; size -= 12; } else { size = pkt->size; } if (size + off > left) return AVERROR_INVALIDDATA; avio_wl32(pb, size + 12); avio_wl16(pb, 0x410); avio_w8(pb, 0); avio_w8(pb, 0); avio_wl32(pb, -1); avio_wl32(pb, pkt->pts); ptr += off; left -= off; flags = AV_RL32(ptr + 4); avio_write(pb, ptr, size); ptr += size; left -= size; while (!(flags & WV_END_BLOCK) && (left >= 4 + WV_EXTRA_SIZE)) { ffio_wfourcc(pb, "wvpk"); size = AV_RL32(ptr); ptr += 4; left -= 4; if (size < 24 || size - 24 > left) return AVERROR_INVALIDDATA; avio_wl32(pb, size); avio_wl16(pb, 0x410); avio_w8(pb, 0); avio_w8(pb, 0); avio_wl32(pb, -1); avio_wl32(pb, pkt->pts); flags = AV_RL32(ptr + 4); avio_write(pb, ptr, WV_EXTRA_SIZE); ptr += WV_EXTRA_SIZE; left -= WV_EXTRA_SIZE; avio_write(pb, ptr, size - 24); ptr += size - 24; left -= size - 24; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { WVMuxContext *wc = VAR_0->priv_data; AVCodecContext *codec = VAR_0->streams[0]->codec; AVIOContext *pb = VAR_0->pb; uint64_t size; uint32_t flags; uint32_t left = VAR_1->size; uint8_t *ptr = VAR_1->data; int VAR_2 = codec->channels > 2 ? 4 : 0; wc->duration += VAR_1->duration; ffio_wfourcc(pb, "wvpk"); if (VAR_2) { size = AV_RL32(VAR_1->data); if (size <= 12) return AVERROR_INVALIDDATA; size -= 12; } else { size = VAR_1->size; } if (size + VAR_2 > left) return AVERROR_INVALIDDATA; avio_wl32(pb, size + 12); avio_wl16(pb, 0x410); avio_w8(pb, 0); avio_w8(pb, 0); avio_wl32(pb, -1); avio_wl32(pb, VAR_1->pts); ptr += VAR_2; left -= VAR_2; flags = AV_RL32(ptr + 4); avio_write(pb, ptr, size); ptr += size; left -= size; while (!(flags & WV_END_BLOCK) && (left >= 4 + WV_EXTRA_SIZE)) { ffio_wfourcc(pb, "wvpk"); size = AV_RL32(ptr); ptr += 4; left -= 4; if (size < 24 || size - 24 > left) return AVERROR_INVALIDDATA; avio_wl32(pb, size); avio_wl16(pb, 0x410); avio_w8(pb, 0); avio_w8(pb, 0); avio_wl32(pb, -1); avio_wl32(pb, VAR_1->pts); flags = AV_RL32(ptr + 4); avio_write(pb, ptr, WV_EXTRA_SIZE); ptr += WV_EXTRA_SIZE; left -= WV_EXTRA_SIZE; avio_write(pb, ptr, size - 24); ptr += size - 24; left -= size - 24; } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "WVMuxContext *wc = VAR_0->priv_data;", "AVCodecContext *codec = VAR_0->streams[0]->codec;", "AVIOContext *pb = VAR_0->pb;", "uint64_t size;", "uint32_t flags;", "uint32_t left = VAR_1->size;", "uint8_t *ptr = VAR_1->data;", "int VAR_2 = codec->channels > 2 ? 4 : 0;", "wc->duration += VAR_1->duration;", "ffio_wfourcc(pb, \"wvpk\");", "if (VAR_2) {", "size = AV_RL32(VAR_1->data);", "if (size <= 12)\nreturn AVERROR_INVALIDDATA;", "size -= 12;", "} else {", "size = VAR_1->size;", "}", "if (size + VAR_2 > left)\nreturn AVERROR_INVALIDDATA;", "avio_wl32(pb, size + 12);", "avio_wl16(pb, 0x410);", "avio_w8(pb, 0);", "avio_w8(pb, 0);", "avio_wl32(pb, -1);", "avio_wl32(pb, VAR_1->pts);", "ptr += VAR_2; left -= VAR_2;", "flags = AV_RL32(ptr + 4);", "avio_write(pb, ptr, size);", "ptr += size; left -= size;", "while (!(flags & WV_END_BLOCK) &&\n(left >= 4 + WV_EXTRA_SIZE)) {", "ffio_wfourcc(pb, \"wvpk\");", "size = AV_RL32(ptr);", "ptr += 4; left -= 4;", "if (size < 24 || size - 24 > left)\nreturn AVERROR_INVALIDDATA;", "avio_wl32(pb, size);", "avio_wl16(pb, 0x410);", "avio_w8(pb, 0);", "avio_w8(pb, 0);", "avio_wl32(pb, -1);", "avio_wl32(pb, VAR_1->pts);", "flags = AV_RL32(ptr + 4);", "avio_write(pb, ptr, WV_EXTRA_SIZE);", "ptr += WV_EXTRA_SIZE; left -= WV_EXTRA_SIZE;", "avio_write(pb, ptr, size - 24);", "ptr += size - 24; left -= size - 24;", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 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 ], [ 117 ], [ 119 ] ]
8,330
static void compute_antialias_integer(MPADecodeContext *s, GranuleDef *g) { int32_t *ptr, *csa; int n, i; /* we antialias only "long" bands */ if (g->block_type == 2) { if (!g->switch_point) return; /* XXX: check this for 8000Hz case */ n = 1; } else { n = SBLIMIT - 1; } ptr = g->sb_hybrid + 18; for(i = n;i > 0;i--) { int tmp0, tmp1, tmp2; csa = &csa_table[0][0]; #define INT_AA(j) \ tmp0 = 4*(ptr[-1-j]);\ tmp1 = 4*(ptr[ j]);\ tmp2= MULH(tmp0 + tmp1, csa[0+4*j]);\ ptr[-1-j] = tmp2 - MULH(tmp1, csa[2+4*j]);\ ptr[ j] = tmp2 + MULH(tmp0, csa[3+4*j]); INT_AA(0) INT_AA(1) INT_AA(2) INT_AA(3) INT_AA(4) INT_AA(5) INT_AA(6) INT_AA(7) ptr += 18; } }
true
FFmpeg
44f1698a3824836d32708ae93e78ac1f2310a07e
static void compute_antialias_integer(MPADecodeContext *s, GranuleDef *g) { int32_t *ptr, *csa; int n, i; if (g->block_type == 2) { if (!g->switch_point) return; n = 1; } else { n = SBLIMIT - 1; } ptr = g->sb_hybrid + 18; for(i = n;i > 0;i--) { int tmp0, tmp1, tmp2; csa = &csa_table[0][0]; #define INT_AA(j) \ tmp0 = 4*(ptr[-1-j]);\ tmp1 = 4*(ptr[ j]);\ tmp2= MULH(tmp0 + tmp1, csa[0+4*j]);\ ptr[-1-j] = tmp2 - MULH(tmp1, csa[2+4*j]);\ ptr[ j] = tmp2 + MULH(tmp0, csa[3+4*j]); INT_AA(0) INT_AA(1) INT_AA(2) INT_AA(3) INT_AA(4) INT_AA(5) INT_AA(6) INT_AA(7) ptr += 18; } }
{ "code": [ " tmp0 = 4*(ptr[-1-j]);\\", " tmp1 = 4*(ptr[ j]);\\", " ptr[-1-j] = tmp2 - MULH(tmp1, csa[2+4*j]);\\", " ptr[ j] = tmp2 + MULH(tmp0, csa[3+4*j]);" ], "line_no": [ 43, 45, 49, 51 ] }
static void FUNC_0(MPADecodeContext *VAR_0, GranuleDef *VAR_1) { int32_t *ptr, *csa; int VAR_2, VAR_3; if (VAR_1->block_type == 2) { if (!VAR_1->switch_point) return; VAR_2 = 1; } else { VAR_2 = SBLIMIT - 1; } ptr = VAR_1->sb_hybrid + 18; for(VAR_3 = VAR_2;VAR_3 > 0;VAR_3--) { int VAR_4, VAR_5, VAR_6; csa = &csa_table[0][0]; #define INT_AA(j) \ VAR_4 = 4*(ptr[-1-j]);\ VAR_5 = 4*(ptr[ j]);\ VAR_6= MULH(VAR_4 + VAR_5, csa[0+4*j]);\ ptr[-1-j] = VAR_6 - MULH(VAR_5, csa[2+4*j]);\ ptr[ j] = VAR_6 + MULH(VAR_4, csa[3+4*j]); INT_AA(0) INT_AA(1) INT_AA(2) INT_AA(3) INT_AA(4) INT_AA(5) INT_AA(6) INT_AA(7) ptr += 18; } }
[ "static void FUNC_0(MPADecodeContext *VAR_0,\nGranuleDef *VAR_1)\n{", "int32_t *ptr, *csa;", "int VAR_2, VAR_3;", "if (VAR_1->block_type == 2) {", "if (!VAR_1->switch_point)\nreturn;", "VAR_2 = 1;", "} else {", "VAR_2 = SBLIMIT - 1;", "}", "ptr = VAR_1->sb_hybrid + 18;", "for(VAR_3 = VAR_2;VAR_3 > 0;VAR_3--) {", "int VAR_4, VAR_5, VAR_6;", "csa = &csa_table[0][0];", "#define INT_AA(j) \\\nVAR_4 = 4*(ptr[-1-j]);\\", "VAR_5 = 4*(ptr[ j]);\\", "VAR_6= MULH(VAR_4 + VAR_5, csa[0+4*j]);\\", "ptr[-1-j] = VAR_6 - MULH(VAR_5, csa[2+4*j]);\\", "ptr[ j] = VAR_6 + MULH(VAR_4, csa[3+4*j]);", "INT_AA(0)\nINT_AA(1)\nINT_AA(2)\nINT_AA(3)\nINT_AA(4)\nINT_AA(5)\nINT_AA(6)\nINT_AA(7)\nptr += 18;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57, 59, 61, 63, 65, 67, 69, 73 ], [ 75 ], [ 77 ] ]
8,331
static int receive_filter(VirtIONet *n, const uint8_t *buf, int size) { static const uint8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; static const uint8_t vlan[] = {0x81, 0x00}; uint8_t *ptr = (uint8_t *)buf; int i; if (n->promisc) return 1; if (!memcmp(&ptr[12], vlan, sizeof(vlan))) { int vid = be16_to_cpup((uint16_t *)(ptr + 14)) & 0xfff; if (!(n->vlans[vid >> 5] & (1U << (vid & 0x1f)))) return 0; } if (ptr[0] & 1) { // multicast if (!memcmp(ptr, bcast, sizeof(bcast))) { return 1; } else if (n->allmulti) { return 1; } } else { // unicast if (!memcmp(ptr, n->mac, ETH_ALEN)) { return 1; } } for (i = 0; i < n->mac_table.in_use; i++) { if (!memcmp(ptr, &n->mac_table.macs[i * ETH_ALEN], ETH_ALEN)) return 1; } return 0; }
true
qemu
8fd2a2f1a9048b9e37a898c2a5e9ef59d0c1a095
static int receive_filter(VirtIONet *n, const uint8_t *buf, int size) { static const uint8_t bcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; static const uint8_t vlan[] = {0x81, 0x00}; uint8_t *ptr = (uint8_t *)buf; int i; if (n->promisc) return 1; if (!memcmp(&ptr[12], vlan, sizeof(vlan))) { int vid = be16_to_cpup((uint16_t *)(ptr + 14)) & 0xfff; if (!(n->vlans[vid >> 5] & (1U << (vid & 0x1f)))) return 0; } if (ptr[0] & 1) { if (!memcmp(ptr, bcast, sizeof(bcast))) { return 1; } else if (n->allmulti) { return 1; } } else { if (!memcmp(ptr, n->mac, ETH_ALEN)) { return 1; } } for (i = 0; i < n->mac_table.in_use; i++) { if (!memcmp(ptr, &n->mac_table.macs[i * ETH_ALEN], ETH_ALEN)) return 1; } return 0; }
{ "code": [ " } else if (n->allmulti) {", " if (!memcmp(ptr, n->mac, ETH_ALEN)) {" ], "line_no": [ 39, 47 ] }
static int FUNC_0(VirtIONet *VAR_0, const uint8_t *VAR_1, int VAR_2) { static const uint8_t VAR_3[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; static const uint8_t VAR_4[] = {0x81, 0x00}; uint8_t *ptr = (uint8_t *)VAR_1; int VAR_5; if (VAR_0->promisc) return 1; if (!memcmp(&ptr[12], VAR_4, sizeof(VAR_4))) { int VAR_6 = be16_to_cpup((uint16_t *)(ptr + 14)) & 0xfff; if (!(VAR_0->vlans[VAR_6 >> 5] & (1U << (VAR_6 & 0x1f)))) return 0; } if (ptr[0] & 1) { if (!memcmp(ptr, VAR_3, sizeof(VAR_3))) { return 1; } else if (VAR_0->allmulti) { return 1; } } else { if (!memcmp(ptr, VAR_0->mac, ETH_ALEN)) { return 1; } } for (VAR_5 = 0; VAR_5 < VAR_0->mac_table.in_use; VAR_5++) { if (!memcmp(ptr, &VAR_0->mac_table.macs[VAR_5 * ETH_ALEN], ETH_ALEN)) return 1; } return 0; }
[ "static int FUNC_0(VirtIONet *VAR_0, const uint8_t *VAR_1, int VAR_2)\n{", "static const uint8_t VAR_3[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};", "static const uint8_t VAR_4[] = {0x81, 0x00};", "uint8_t *ptr = (uint8_t *)VAR_1;", "int VAR_5;", "if (VAR_0->promisc)\nreturn 1;", "if (!memcmp(&ptr[12], VAR_4, sizeof(VAR_4))) {", "int VAR_6 = be16_to_cpup((uint16_t *)(ptr + 14)) & 0xfff;", "if (!(VAR_0->vlans[VAR_6 >> 5] & (1U << (VAR_6 & 0x1f))))\nreturn 0;", "}", "if (ptr[0] & 1) {", "if (!memcmp(ptr, VAR_3, sizeof(VAR_3))) {", "return 1;", "} else if (VAR_0->allmulti) {", "return 1;", "}", "} else {", "if (!memcmp(ptr, VAR_0->mac, ETH_ALEN)) {", "return 1;", "}", "}", "for (VAR_5 = 0; VAR_5 < VAR_0->mac_table.in_use; VAR_5++) {", "if (!memcmp(ptr, &VAR_0->mac_table.macs[VAR_5 * ETH_ALEN], ETH_ALEN))\nreturn 1;", "}", "return 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, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 67 ], [ 69 ] ]
8,332
static void expand_rle_row(unsigned char *optr, unsigned char *iptr, int chan_offset, int pixelstride) { unsigned char pixel, count; #ifndef WORDS_BIGENDIAN /* rgba -> bgra for rgba32 on little endian cpus */ if (pixelstride == 4 && chan_offset != 3) { chan_offset = 2 - chan_offset; } #endif optr += chan_offset; while (1) { pixel = *iptr++; if (!(count = (pixel & 0x7f))) { return; } if (pixel & 0x80) { while (count--) { *optr = *iptr; optr += pixelstride; iptr++; } } else { pixel = *iptr++; while (count--) { *optr = pixel; optr += pixelstride; } } } }
true
FFmpeg
44f110f509d0ab4fc73b9f2363a97c6577d3850f
static void expand_rle_row(unsigned char *optr, unsigned char *iptr, int chan_offset, int pixelstride) { unsigned char pixel, count; #ifndef WORDS_BIGENDIAN if (pixelstride == 4 && chan_offset != 3) { chan_offset = 2 - chan_offset; } #endif optr += chan_offset; while (1) { pixel = *iptr++; if (!(count = (pixel & 0x7f))) { return; } if (pixel & 0x80) { while (count--) { *optr = *iptr; optr += pixelstride; iptr++; } } else { pixel = *iptr++; while (count--) { *optr = pixel; optr += pixelstride; } } } }
{ "code": [ "static void expand_rle_row(unsigned char *optr, unsigned char *iptr, ", " pixel = *iptr++;", " *optr = *iptr;", " iptr++;", " pixel = *iptr++;" ], "line_no": [ 1, 31, 45, 49, 55 ] }
static void FUNC_0(unsigned char *VAR_0, unsigned char *VAR_1, int VAR_2, int VAR_3) { unsigned char VAR_4, VAR_5; #ifndef WORDS_BIGENDIAN if (VAR_3 == 4 && VAR_2 != 3) { VAR_2 = 2 - VAR_2; } #endif VAR_0 += VAR_2; while (1) { VAR_4 = *VAR_1++; if (!(VAR_5 = (VAR_4 & 0x7f))) { return; } if (VAR_4 & 0x80) { while (VAR_5--) { *VAR_0 = *VAR_1; VAR_0 += VAR_3; VAR_1++; } } else { VAR_4 = *VAR_1++; while (VAR_5--) { *VAR_0 = VAR_4; VAR_0 += VAR_3; } } } }
[ "static void FUNC_0(unsigned char *VAR_0, unsigned char *VAR_1,\nint VAR_2, int VAR_3)\n{", "unsigned char VAR_4, VAR_5;", "#ifndef WORDS_BIGENDIAN\nif (VAR_3 == 4 && VAR_2 != 3) {", "VAR_2 = 2 - VAR_2;", "}", "#endif\nVAR_0 += VAR_2;", "while (1) {", "VAR_4 = *VAR_1++;", "if (!(VAR_5 = (VAR_4 & 0x7f))) {", "return;", "}", "if (VAR_4 & 0x80) {", "while (VAR_5--) {", "*VAR_0 = *VAR_1;", "VAR_0 += VAR_3;", "VAR_1++;", "}", "} else {", "VAR_4 = *VAR_1++;", "while (VAR_5--) {", "*VAR_0 = VAR_4;", "VAR_0 += VAR_3;", "}", "}", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 15 ], [ 17 ], [ 19 ], [ 21, 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
8,333
static void rtsp_cmd_describe(HTTPContext *c, const char *url) { FFStream *stream; char path1[1024]; const char *path; uint8_t *content; int content_length, len; struct sockaddr_in my_addr; /* find which url is asked */ url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') path++; for(stream = first_stream; stream != NULL; stream = stream->next) { if (!stream->is_feed && !strcmp(stream->fmt->name, "rtp") && !strcmp(path, stream->filename)) { goto found; } } /* no stream found */ rtsp_reply_error(c, RTSP_STATUS_SERVICE); /* XXX: right error ? */ return; found: /* prepare the media description in sdp format */ /* get the host IP */ len = sizeof(my_addr); getsockname(c->fd, (struct sockaddr *)&my_addr, &len); content_length = prepare_sdp_description(stream, &content, my_addr.sin_addr); if (content_length < 0) { rtsp_reply_error(c, RTSP_STATUS_INTERNAL); return; } rtsp_reply_header(c, RTSP_STATUS_OK); url_fprintf(c->pb, "Content-Type: application/sdp\r\n"); url_fprintf(c->pb, "Content-Length: %d\r\n", content_length); url_fprintf(c->pb, "\r\n"); put_buffer(c->pb, content, content_length); }
true
FFmpeg
25e3e53d4092e7b69a4d681824fa0f7b2731bb1e
static void rtsp_cmd_describe(HTTPContext *c, const char *url) { FFStream *stream; char path1[1024]; const char *path; uint8_t *content; int content_length, len; struct sockaddr_in my_addr; url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url); path = path1; if (*path == '/') path++; for(stream = first_stream; stream != NULL; stream = stream->next) { if (!stream->is_feed && !strcmp(stream->fmt->name, "rtp") && !strcmp(path, stream->filename)) { goto found; } } rtsp_reply_error(c, RTSP_STATUS_SERVICE); return; found: len = sizeof(my_addr); getsockname(c->fd, (struct sockaddr *)&my_addr, &len); content_length = prepare_sdp_description(stream, &content, my_addr.sin_addr); if (content_length < 0) { rtsp_reply_error(c, RTSP_STATUS_INTERNAL); return; } rtsp_reply_header(c, RTSP_STATUS_OK); url_fprintf(c->pb, "Content-Type: application/sdp\r\n"); url_fprintf(c->pb, "Content-Length: %d\r\n", content_length); url_fprintf(c->pb, "\r\n"); put_buffer(c->pb, content, content_length); }
{ "code": [ " if (!stream->is_feed && !strcmp(stream->fmt->name, \"rtp\") &&" ], "line_no": [ 33 ] }
static void FUNC_0(HTTPContext *VAR_0, const char *VAR_1) { FFStream *stream; char VAR_2[1024]; const char *VAR_3; uint8_t *content; int VAR_4, VAR_5; struct sockaddr_in VAR_6; url_split(NULL, 0, NULL, 0, NULL, 0, NULL, VAR_2, sizeof(VAR_2), VAR_1); VAR_3 = VAR_2; if (*VAR_3 == '/') VAR_3++; for(stream = first_stream; stream != NULL; stream = stream->next) { if (!stream->is_feed && !strcmp(stream->fmt->name, "rtp") && !strcmp(VAR_3, stream->filename)) { goto found; } } rtsp_reply_error(VAR_0, RTSP_STATUS_SERVICE); return; found: VAR_5 = sizeof(VAR_6); getsockname(VAR_0->fd, (struct sockaddr *)&VAR_6, &VAR_5); VAR_4 = prepare_sdp_description(stream, &content, VAR_6.sin_addr); if (VAR_4 < 0) { rtsp_reply_error(VAR_0, RTSP_STATUS_INTERNAL); return; } rtsp_reply_header(VAR_0, RTSP_STATUS_OK); url_fprintf(VAR_0->pb, "Content-Type: application/sdp\r\n"); url_fprintf(VAR_0->pb, "Content-Length: %d\r\n", VAR_4); url_fprintf(VAR_0->pb, "\r\n"); put_buffer(VAR_0->pb, content, VAR_4); }
[ "static void FUNC_0(HTTPContext *VAR_0, const char *VAR_1)\n{", "FFStream *stream;", "char VAR_2[1024];", "const char *VAR_3;", "uint8_t *content;", "int VAR_4, VAR_5;", "struct sockaddr_in VAR_6;", "url_split(NULL, 0, NULL, 0, NULL, 0, NULL, VAR_2, sizeof(VAR_2), VAR_1);", "VAR_3 = VAR_2;", "if (*VAR_3 == '/')\nVAR_3++;", "for(stream = first_stream; stream != NULL; stream = stream->next) {", "if (!stream->is_feed && !strcmp(stream->fmt->name, \"rtp\") &&\n!strcmp(VAR_3, stream->filename)) {", "goto found;", "}", "}", "rtsp_reply_error(VAR_0, RTSP_STATUS_SERVICE);", "return;", "found:\nVAR_5 = sizeof(VAR_6);", "getsockname(VAR_0->fd, (struct sockaddr *)&VAR_6, &VAR_5);", "VAR_4 = prepare_sdp_description(stream, &content, VAR_6.sin_addr);", "if (VAR_4 < 0) {", "rtsp_reply_error(VAR_0, RTSP_STATUS_INTERNAL);", "return;", "}", "rtsp_reply_header(VAR_0, RTSP_STATUS_OK);", "url_fprintf(VAR_0->pb, \"Content-Type: application/sdp\\r\\n\");", "url_fprintf(VAR_0->pb, \"Content-Length: %d\\r\\n\", VAR_4);", "url_fprintf(VAR_0->pb, \"\\r\\n\");", "put_buffer(VAR_0->pb, content, VAR_4);", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ] ]
8,334
av_cold int ff_vp8_decode_free(AVCodecContext *avctx) { VP8Context *s = avctx->priv_data; int i; vp8_decode_flush_impl(avctx, 1); for (i = 0; i < FF_ARRAY_ELEMS(s->frames); i++) av_frame_free(&s->frames[i].tf.f); }
true
FFmpeg
a84f0e8d8f293df3c535f9b893730a835bed6520
av_cold int ff_vp8_decode_free(AVCodecContext *avctx) { VP8Context *s = avctx->priv_data; int i; vp8_decode_flush_impl(avctx, 1); for (i = 0; i < FF_ARRAY_ELEMS(s->frames); i++) av_frame_free(&s->frames[i].tf.f); }
{ "code": [], "line_no": [] }
av_cold int FUNC_0(AVCodecContext *avctx) { VP8Context *s = avctx->priv_data; int VAR_0; vp8_decode_flush_impl(avctx, 1); for (VAR_0 = 0; VAR_0 < FF_ARRAY_ELEMS(s->frames); VAR_0++) av_frame_free(&s->frames[VAR_0].tf.f); }
[ "av_cold int FUNC_0(AVCodecContext *avctx)\n{", "VP8Context *s = avctx->priv_data;", "int VAR_0;", "vp8_decode_flush_impl(avctx, 1);", "for (VAR_0 = 0; VAR_0 < FF_ARRAY_ELEMS(s->frames); VAR_0++)", "av_frame_free(&s->frames[VAR_0].tf.f);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ] ]
8,335
static void spapr_alloc_htab(sPAPRMachineState *spapr) { long shift; int index; /* allocate hash page table. For now we always make this 16mb, * later we should probably make it scale to the size of guest * RAM */ shift = kvmppc_reset_htab(spapr->htab_shift); if (shift > 0) { /* Kernel handles htab, we don't need to allocate one */ if (shift != spapr->htab_shift) { error_setg(&error_abort, "Failed to allocate HTAB of requested size, try with smaller maxmem"); } spapr->htab_shift = shift; kvmppc_kern_htab = true; } else { /* Allocate htab */ spapr->htab = qemu_memalign(HTAB_SIZE(spapr), HTAB_SIZE(spapr)); /* And clear it */ memset(spapr->htab, 0, HTAB_SIZE(spapr)); for (index = 0; index < HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; index++) { DIRTY_HPTE(HPTE(spapr->htab, index)); } } }
true
qemu
b41d320fef705289d2b73f4949731eb2e189161d
static void spapr_alloc_htab(sPAPRMachineState *spapr) { long shift; int index; shift = kvmppc_reset_htab(spapr->htab_shift); if (shift > 0) { if (shift != spapr->htab_shift) { error_setg(&error_abort, "Failed to allocate HTAB of requested size, try with smaller maxmem"); } spapr->htab_shift = shift; kvmppc_kern_htab = true; } else { spapr->htab = qemu_memalign(HTAB_SIZE(spapr), HTAB_SIZE(spapr)); memset(spapr->htab, 0, HTAB_SIZE(spapr)); for (index = 0; index < HTAB_SIZE(spapr) / HASH_PTE_SIZE_64; index++) { DIRTY_HPTE(HPTE(spapr->htab, index)); } } }
{ "code": [ " if (shift > 0) {", " if (shift > 0) {" ], "line_no": [ 23, 23 ] }
static void FUNC_0(sPAPRMachineState *VAR_0) { long VAR_1; int VAR_2; VAR_1 = kvmppc_reset_htab(VAR_0->htab_shift); if (VAR_1 > 0) { if (VAR_1 != VAR_0->htab_shift) { error_setg(&error_abort, "Failed to allocate HTAB of requested size, try with smaller maxmem"); } VAR_0->htab_shift = VAR_1; kvmppc_kern_htab = true; } else { VAR_0->htab = qemu_memalign(HTAB_SIZE(VAR_0), HTAB_SIZE(VAR_0)); memset(VAR_0->htab, 0, HTAB_SIZE(VAR_0)); for (VAR_2 = 0; VAR_2 < HTAB_SIZE(VAR_0) / HASH_PTE_SIZE_64; VAR_2++) { DIRTY_HPTE(HPTE(VAR_0->htab, VAR_2)); } } }
[ "static void FUNC_0(sPAPRMachineState *VAR_0)\n{", "long VAR_1;", "int VAR_2;", "VAR_1 = kvmppc_reset_htab(VAR_0->htab_shift);", "if (VAR_1 > 0) {", "if (VAR_1 != VAR_0->htab_shift) {", "error_setg(&error_abort, \"Failed to allocate HTAB of requested size, try with smaller maxmem\");", "}", "VAR_0->htab_shift = VAR_1;", "kvmppc_kern_htab = true;", "} else {", "VAR_0->htab = qemu_memalign(HTAB_SIZE(VAR_0), HTAB_SIZE(VAR_0));", "memset(VAR_0->htab, 0, HTAB_SIZE(VAR_0));", "for (VAR_2 = 0; VAR_2 < HTAB_SIZE(VAR_0) / HASH_PTE_SIZE_64; VAR_2++) {", "DIRTY_HPTE(HPTE(VAR_0->htab, VAR_2));", "}", "}", "}" ]
[ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 19 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
8,336
static int qemu_rdma_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size) { QEMUFileRDMA *r = opaque; RDMAContext *rdma = r->rdma; RDMAControlHeader head; int ret = 0; CHECK_ERROR_STATE(); /* * First, we hold on to the last SEND message we * were given and dish out the bytes until we run * out of bytes. */ r->len = qemu_rdma_fill(r->rdma, buf, size, 0); if (r->len) { return r->len; } /* * Once we run out, we block and wait for another * SEND message to arrive. */ ret = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_QEMU_FILE); if (ret < 0) { rdma->error_state = ret; return ret; } /* * SEND was received with new bytes, now try again. */ return qemu_rdma_fill(r->rdma, buf, size, 0); }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
static int qemu_rdma_get_buffer(void *opaque, uint8_t *buf, int64_t pos, int size) { QEMUFileRDMA *r = opaque; RDMAContext *rdma = r->rdma; RDMAControlHeader head; int ret = 0; CHECK_ERROR_STATE(); r->len = qemu_rdma_fill(r->rdma, buf, size, 0); if (r->len) { return r->len; } ret = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_QEMU_FILE); if (ret < 0) { rdma->error_state = ret; return ret; } return qemu_rdma_fill(r->rdma, buf, size, 0); }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0, uint8_t *VAR_1, int64_t VAR_2, int VAR_3) { QEMUFileRDMA *r = VAR_0; RDMAContext *rdma = r->rdma; RDMAControlHeader head; int VAR_4 = 0; CHECK_ERROR_STATE(); r->len = qemu_rdma_fill(r->rdma, VAR_1, VAR_3, 0); if (r->len) { return r->len; } VAR_4 = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_QEMU_FILE); if (VAR_4 < 0) { rdma->error_state = VAR_4; return VAR_4; } return qemu_rdma_fill(r->rdma, VAR_1, VAR_3, 0); }
[ "static int FUNC_0(void *VAR_0, uint8_t *VAR_1,\nint64_t VAR_2, int VAR_3)\n{", "QEMUFileRDMA *r = VAR_0;", "RDMAContext *rdma = r->rdma;", "RDMAControlHeader head;", "int VAR_4 = 0;", "CHECK_ERROR_STATE();", "r->len = qemu_rdma_fill(r->rdma, VAR_1, VAR_3, 0);", "if (r->len) {", "return r->len;", "}", "VAR_4 = qemu_rdma_exchange_recv(rdma, &head, RDMA_CONTROL_QEMU_FILE);", "if (VAR_4 < 0) {", "rdma->error_state = VAR_4;", "return VAR_4;", "}", "return qemu_rdma_fill(r->rdma, VAR_1, VAR_3, 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 69 ], [ 71 ] ]
8,338
static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin) { av_free(bin->data); if (!(bin->data = av_malloc(length))) return AVERROR(ENOMEM); bin->size = length; bin->pos = avio_tell(pb); if (avio_read(pb, bin->data, length) != length) { av_freep(&bin->data); return AVERROR(EIO); } return 0; }
true
FFmpeg
30be1ea33e5525266ad871bed60b1893a53caeaf
static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin) { av_free(bin->data); if (!(bin->data = av_malloc(length))) return AVERROR(ENOMEM); bin->size = length; bin->pos = avio_tell(pb); if (avio_read(pb, bin->data, length) != length) { av_freep(&bin->data); return AVERROR(EIO); } return 0; }
{ "code": [ " if (!(bin->data = av_malloc(length)))" ], "line_no": [ 7 ] }
static int FUNC_0(AVIOContext *VAR_0, int VAR_1, EbmlBin *VAR_2) { av_free(VAR_2->data); if (!(VAR_2->data = av_malloc(VAR_1))) return AVERROR(ENOMEM); VAR_2->size = VAR_1; VAR_2->pos = avio_tell(VAR_0); if (avio_read(VAR_0, VAR_2->data, VAR_1) != VAR_1) { av_freep(&VAR_2->data); return AVERROR(EIO); } return 0; }
[ "static int FUNC_0(AVIOContext *VAR_0, int VAR_1, EbmlBin *VAR_2)\n{", "av_free(VAR_2->data);", "if (!(VAR_2->data = av_malloc(VAR_1)))\nreturn AVERROR(ENOMEM);", "VAR_2->size = VAR_1;", "VAR_2->pos = avio_tell(VAR_0);", "if (avio_read(VAR_0, VAR_2->data, VAR_1) != VAR_1) {", "av_freep(&VAR_2->data);", "return AVERROR(EIO);", "}", "return 0;", "}" ]
[ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
8,339
void avcodec_init(void) { static int inited = 0; if (inited != 0) return; inited = 1; dsputil_static_init(); }
false
FFmpeg
5e53486545726987ab4482321d4dcf7e23e7652f
void avcodec_init(void) { static int inited = 0; if (inited != 0) return; inited = 1; dsputil_static_init(); }
{ "code": [], "line_no": [] }
void FUNC_0(void) { static int VAR_0 = 0; if (VAR_0 != 0) return; VAR_0 = 1; dsputil_static_init(); }
[ "void FUNC_0(void)\n{", "static int VAR_0 = 0;", "if (VAR_0 != 0)\nreturn;", "VAR_0 = 1;", "dsputil_static_init();", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 17 ], [ 19 ] ]
8,341
void swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt) { double scale = s->dither.noise_scale; #define TMP_EXTRA 2 double *tmp = av_malloc_array(len + TMP_EXTRA, sizeof(double)); int i; for(i=0; i<len + TMP_EXTRA; i++){ double v; seed = seed* 1664525 + 1013904223; switch(s->dither.method){ case SWR_DITHER_RECTANGULAR: v= ((double)seed) / UINT_MAX - 0.5; break; default: av_assert0(s->dither.method < SWR_DITHER_NB); v = ((double)seed) / UINT_MAX; seed = seed*1664525 + 1013904223; v-= ((double)seed) / UINT_MAX; break; } tmp[i] = v; } for(i=0; i<len; i++){ double v; switch(s->dither.method){ default: av_assert0(s->dither.method < SWR_DITHER_NB); v = tmp[i]; break; case SWR_DITHER_TRIANGULAR_HIGHPASS : v = (- tmp[i] + 2*tmp[i+1] - tmp[i+2]) / sqrt(6); break; } v*= scale; switch(noise_fmt){ case AV_SAMPLE_FMT_S16P: ((int16_t*)dst)[i] = v; break; case AV_SAMPLE_FMT_S32P: ((int32_t*)dst)[i] = v; break; case AV_SAMPLE_FMT_FLTP: ((float *)dst)[i] = v; break; case AV_SAMPLE_FMT_DBLP: ((double *)dst)[i] = v; break; default: av_assert0(0); } } av_free(tmp); }
false
FFmpeg
196b885a5f0aa3ca022c1fa99509f47341239784
void swri_get_dither(SwrContext *s, void *dst, int len, unsigned seed, enum AVSampleFormat noise_fmt) { double scale = s->dither.noise_scale; #define TMP_EXTRA 2 double *tmp = av_malloc_array(len + TMP_EXTRA, sizeof(double)); int i; for(i=0; i<len + TMP_EXTRA; i++){ double v; seed = seed* 1664525 + 1013904223; switch(s->dither.method){ case SWR_DITHER_RECTANGULAR: v= ((double)seed) / UINT_MAX - 0.5; break; default: av_assert0(s->dither.method < SWR_DITHER_NB); v = ((double)seed) / UINT_MAX; seed = seed*1664525 + 1013904223; v-= ((double)seed) / UINT_MAX; break; } tmp[i] = v; } for(i=0; i<len; i++){ double v; switch(s->dither.method){ default: av_assert0(s->dither.method < SWR_DITHER_NB); v = tmp[i]; break; case SWR_DITHER_TRIANGULAR_HIGHPASS : v = (- tmp[i] + 2*tmp[i+1] - tmp[i+2]) / sqrt(6); break; } v*= scale; switch(noise_fmt){ case AV_SAMPLE_FMT_S16P: ((int16_t*)dst)[i] = v; break; case AV_SAMPLE_FMT_S32P: ((int32_t*)dst)[i] = v; break; case AV_SAMPLE_FMT_FLTP: ((float *)dst)[i] = v; break; case AV_SAMPLE_FMT_DBLP: ((double *)dst)[i] = v; break; default: av_assert0(0); } } av_free(tmp); }
{ "code": [], "line_no": [] }
void FUNC_0(SwrContext *VAR_0, void *VAR_1, int VAR_2, unsigned VAR_3, enum AVSampleFormat VAR_4) { double VAR_5 = VAR_0->dither.noise_scale; #define TMP_EXTRA 2 double *VAR_6 = av_malloc_array(VAR_2 + TMP_EXTRA, sizeof(double)); int VAR_7; for(VAR_7=0; VAR_7<VAR_2 + TMP_EXTRA; VAR_7++){ double VAR_9; VAR_3 = VAR_3* 1664525 + 1013904223; switch(VAR_0->dither.method){ case SWR_DITHER_RECTANGULAR: VAR_9= ((double)VAR_3) / UINT_MAX - 0.5; break; default: av_assert0(VAR_0->dither.method < SWR_DITHER_NB); VAR_9 = ((double)VAR_3) / UINT_MAX; VAR_3 = VAR_3*1664525 + 1013904223; VAR_9-= ((double)VAR_3) / UINT_MAX; break; } VAR_6[VAR_7] = VAR_9; } for(VAR_7=0; VAR_7<VAR_2; VAR_7++){ double VAR_9; switch(VAR_0->dither.method){ default: av_assert0(VAR_0->dither.method < SWR_DITHER_NB); VAR_9 = VAR_6[VAR_7]; break; case SWR_DITHER_TRIANGULAR_HIGHPASS : VAR_9 = (- VAR_6[VAR_7] + 2*VAR_6[VAR_7+1] - VAR_6[VAR_7+2]) / sqrt(6); break; } VAR_9*= VAR_5; switch(VAR_4){ case AV_SAMPLE_FMT_S16P: ((int16_t*)VAR_1)[VAR_7] = VAR_9; break; case AV_SAMPLE_FMT_S32P: ((int32_t*)VAR_1)[VAR_7] = VAR_9; break; case AV_SAMPLE_FMT_FLTP: ((float *)VAR_1)[VAR_7] = VAR_9; break; case AV_SAMPLE_FMT_DBLP: ((double *)VAR_1)[VAR_7] = VAR_9; break; default: av_assert0(0); } } av_free(VAR_6); }
[ "void FUNC_0(SwrContext *VAR_0, void *VAR_1, int VAR_2, unsigned VAR_3, enum AVSampleFormat VAR_4) {", "double VAR_5 = VAR_0->dither.noise_scale;", "#define TMP_EXTRA 2\ndouble *VAR_6 = av_malloc_array(VAR_2 + TMP_EXTRA, sizeof(double));", "int VAR_7;", "for(VAR_7=0; VAR_7<VAR_2 + TMP_EXTRA; VAR_7++){", "double VAR_9;", "VAR_3 = VAR_3* 1664525 + 1013904223;", "switch(VAR_0->dither.method){", "case SWR_DITHER_RECTANGULAR: VAR_9= ((double)VAR_3) / UINT_MAX - 0.5; break;", "default:\nav_assert0(VAR_0->dither.method < SWR_DITHER_NB);", "VAR_9 = ((double)VAR_3) / UINT_MAX;", "VAR_3 = VAR_3*1664525 + 1013904223;", "VAR_9-= ((double)VAR_3) / UINT_MAX;", "break;", "}", "VAR_6[VAR_7] = VAR_9;", "}", "for(VAR_7=0; VAR_7<VAR_2; VAR_7++){", "double VAR_9;", "switch(VAR_0->dither.method){", "default:\nav_assert0(VAR_0->dither.method < SWR_DITHER_NB);", "VAR_9 = VAR_6[VAR_7];", "break;", "case SWR_DITHER_TRIANGULAR_HIGHPASS :\nVAR_9 = (- VAR_6[VAR_7] + 2*VAR_6[VAR_7+1] - VAR_6[VAR_7+2]) / sqrt(6);", "break;", "}", "VAR_9*= VAR_5;", "switch(VAR_4){", "case AV_SAMPLE_FMT_S16P: ((int16_t*)VAR_1)[VAR_7] = VAR_9; break;", "case AV_SAMPLE_FMT_S32P: ((int32_t*)VAR_1)[VAR_7] = VAR_9; break;", "case AV_SAMPLE_FMT_FLTP: ((float *)VAR_1)[VAR_7] = VAR_9; break;", "case AV_SAMPLE_FMT_DBLP: ((double *)VAR_1)[VAR_7] = VAR_9; break;", "default: av_assert0(0);", "}", "}", "av_free(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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5, 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ] ]
8,342
static int hls_coding_quadtree(HEVCContext *s, int x0, int y0, int log2_cb_size, int cb_depth) { HEVCLocalContext *lc = s->HEVClc; const int cb_size = 1 << log2_cb_size; int ret; lc->ct.depth = cb_depth; if (x0 + cb_size <= s->sps->width && y0 + cb_size <= s->sps->height && log2_cb_size > s->sps->log2_min_cb_size) { SAMPLE(s->split_cu_flag, x0, y0) = ff_hevc_split_coding_unit_flag_decode(s, cb_depth, x0, y0); } else { SAMPLE(s->split_cu_flag, x0, y0) = (log2_cb_size > s->sps->log2_min_cb_size); } if (s->pps->cu_qp_delta_enabled_flag && log2_cb_size >= s->sps->log2_ctb_size - s->pps->diff_cu_qp_delta_depth) { lc->tu.is_cu_qp_delta_coded = 0; lc->tu.cu_qp_delta = 0; } if (SAMPLE(s->split_cu_flag, x0, y0)) { const int cb_size_split = cb_size >> 1; const int x1 = x0 + cb_size_split; const int y1 = y0 + cb_size_split; int more_data = 0; more_data = hls_coding_quadtree(s, x0, y0, log2_cb_size - 1, cb_depth + 1); if (more_data < 0) return more_data; if (more_data && x1 < s->sps->width) more_data = hls_coding_quadtree(s, x1, y0, log2_cb_size - 1, cb_depth + 1); if (more_data && y1 < s->sps->height) more_data = hls_coding_quadtree(s, x0, y1, log2_cb_size - 1, cb_depth + 1); if (more_data && x1 < s->sps->width && y1 < s->sps->height) { return hls_coding_quadtree(s, x1, y1, log2_cb_size - 1, cb_depth + 1); } if (more_data) return ((x1 + cb_size_split) < s->sps->width || (y1 + cb_size_split) < s->sps->height); else return 0; } else { ret = hls_coding_unit(s, x0, y0, log2_cb_size); if (ret < 0) return ret; if ((!((x0 + cb_size) % (1 << (s->sps->log2_ctb_size))) || (x0 + cb_size >= s->sps->width)) && (!((y0 + cb_size) % (1 << (s->sps->log2_ctb_size))) || (y0 + cb_size >= s->sps->height))) { int end_of_slice_flag = ff_hevc_end_of_slice_flag_decode(s); return !end_of_slice_flag; } else { return 1; } } return 0; }
true
FFmpeg
96c4ba2392b9cd55a5e84cb28db5c0c7e53cd390
static int hls_coding_quadtree(HEVCContext *s, int x0, int y0, int log2_cb_size, int cb_depth) { HEVCLocalContext *lc = s->HEVClc; const int cb_size = 1 << log2_cb_size; int ret; lc->ct.depth = cb_depth; if (x0 + cb_size <= s->sps->width && y0 + cb_size <= s->sps->height && log2_cb_size > s->sps->log2_min_cb_size) { SAMPLE(s->split_cu_flag, x0, y0) = ff_hevc_split_coding_unit_flag_decode(s, cb_depth, x0, y0); } else { SAMPLE(s->split_cu_flag, x0, y0) = (log2_cb_size > s->sps->log2_min_cb_size); } if (s->pps->cu_qp_delta_enabled_flag && log2_cb_size >= s->sps->log2_ctb_size - s->pps->diff_cu_qp_delta_depth) { lc->tu.is_cu_qp_delta_coded = 0; lc->tu.cu_qp_delta = 0; } if (SAMPLE(s->split_cu_flag, x0, y0)) { const int cb_size_split = cb_size >> 1; const int x1 = x0 + cb_size_split; const int y1 = y0 + cb_size_split; int more_data = 0; more_data = hls_coding_quadtree(s, x0, y0, log2_cb_size - 1, cb_depth + 1); if (more_data < 0) return more_data; if (more_data && x1 < s->sps->width) more_data = hls_coding_quadtree(s, x1, y0, log2_cb_size - 1, cb_depth + 1); if (more_data && y1 < s->sps->height) more_data = hls_coding_quadtree(s, x0, y1, log2_cb_size - 1, cb_depth + 1); if (more_data && x1 < s->sps->width && y1 < s->sps->height) { return hls_coding_quadtree(s, x1, y1, log2_cb_size - 1, cb_depth + 1); } if (more_data) return ((x1 + cb_size_split) < s->sps->width || (y1 + cb_size_split) < s->sps->height); else return 0; } else { ret = hls_coding_unit(s, x0, y0, log2_cb_size); if (ret < 0) return ret; if ((!((x0 + cb_size) % (1 << (s->sps->log2_ctb_size))) || (x0 + cb_size >= s->sps->width)) && (!((y0 + cb_size) % (1 << (s->sps->log2_ctb_size))) || (y0 + cb_size >= s->sps->height))) { int end_of_slice_flag = ff_hevc_end_of_slice_flag_decode(s); return !end_of_slice_flag; } else { return 1; } } return 0; }
{ "code": [ " if (more_data && x1 < s->sps->width)", " if (more_data && y1 < s->sps->height)" ], "line_no": [ 69, 73 ] }
static int FUNC_0(HEVCContext *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4) { HEVCLocalContext *lc = VAR_0->HEVClc; const int VAR_5 = 1 << VAR_3; int VAR_6; lc->ct.depth = VAR_4; if (VAR_1 + VAR_5 <= VAR_0->sps->width && VAR_2 + VAR_5 <= VAR_0->sps->height && VAR_3 > VAR_0->sps->log2_min_cb_size) { SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2) = ff_hevc_split_coding_unit_flag_decode(VAR_0, VAR_4, VAR_1, VAR_2); } else { SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2) = (VAR_3 > VAR_0->sps->log2_min_cb_size); } if (VAR_0->pps->cu_qp_delta_enabled_flag && VAR_3 >= VAR_0->sps->log2_ctb_size - VAR_0->pps->diff_cu_qp_delta_depth) { lc->tu.is_cu_qp_delta_coded = 0; lc->tu.cu_qp_delta = 0; } if (SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2)) { const int VAR_7 = VAR_5 >> 1; const int VAR_8 = VAR_1 + VAR_7; const int VAR_9 = VAR_2 + VAR_7; int VAR_10 = 0; VAR_10 = FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3 - 1, VAR_4 + 1); if (VAR_10 < 0) return VAR_10; if (VAR_10 && VAR_8 < VAR_0->sps->width) VAR_10 = FUNC_0(VAR_0, VAR_8, VAR_2, VAR_3 - 1, VAR_4 + 1); if (VAR_10 && VAR_9 < VAR_0->sps->height) VAR_10 = FUNC_0(VAR_0, VAR_1, VAR_9, VAR_3 - 1, VAR_4 + 1); if (VAR_10 && VAR_8 < VAR_0->sps->width && VAR_9 < VAR_0->sps->height) { return FUNC_0(VAR_0, VAR_8, VAR_9, VAR_3 - 1, VAR_4 + 1); } if (VAR_10) return ((VAR_8 + VAR_7) < VAR_0->sps->width || (VAR_9 + VAR_7) < VAR_0->sps->height); else return 0; } else { VAR_6 = hls_coding_unit(VAR_0, VAR_1, VAR_2, VAR_3); if (VAR_6 < 0) return VAR_6; if ((!((VAR_1 + VAR_5) % (1 << (VAR_0->sps->log2_ctb_size))) || (VAR_1 + VAR_5 >= VAR_0->sps->width)) && (!((VAR_2 + VAR_5) % (1 << (VAR_0->sps->log2_ctb_size))) || (VAR_2 + VAR_5 >= VAR_0->sps->height))) { int VAR_11 = ff_hevc_end_of_slice_flag_decode(VAR_0); return !VAR_11; } else { return 1; } } return 0; }
[ "static int FUNC_0(HEVCContext *VAR_0, int VAR_1, int VAR_2,\nint VAR_3, int VAR_4)\n{", "HEVCLocalContext *lc = VAR_0->HEVClc;", "const int VAR_5 = 1 << VAR_3;", "int VAR_6;", "lc->ct.depth = VAR_4;", "if (VAR_1 + VAR_5 <= VAR_0->sps->width &&\nVAR_2 + VAR_5 <= VAR_0->sps->height &&\nVAR_3 > VAR_0->sps->log2_min_cb_size) {", "SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2) =\nff_hevc_split_coding_unit_flag_decode(VAR_0, VAR_4, VAR_1, VAR_2);", "} else {", "SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2) =\n(VAR_3 > VAR_0->sps->log2_min_cb_size);", "}", "if (VAR_0->pps->cu_qp_delta_enabled_flag &&\nVAR_3 >= VAR_0->sps->log2_ctb_size - VAR_0->pps->diff_cu_qp_delta_depth) {", "lc->tu.is_cu_qp_delta_coded = 0;", "lc->tu.cu_qp_delta = 0;", "}", "if (SAMPLE(VAR_0->split_cu_flag, VAR_1, VAR_2)) {", "const int VAR_7 = VAR_5 >> 1;", "const int VAR_8 = VAR_1 + VAR_7;", "const int VAR_9 = VAR_2 + VAR_7;", "int VAR_10 = 0;", "VAR_10 = FUNC_0(VAR_0, VAR_1, VAR_2, VAR_3 - 1, VAR_4 + 1);", "if (VAR_10 < 0)\nreturn VAR_10;", "if (VAR_10 && VAR_8 < VAR_0->sps->width)\nVAR_10 = FUNC_0(VAR_0, VAR_8, VAR_2, VAR_3 - 1, VAR_4 + 1);", "if (VAR_10 && VAR_9 < VAR_0->sps->height)\nVAR_10 = FUNC_0(VAR_0, VAR_1, VAR_9, VAR_3 - 1, VAR_4 + 1);", "if (VAR_10 && VAR_8 < VAR_0->sps->width &&\nVAR_9 < VAR_0->sps->height) {", "return FUNC_0(VAR_0, VAR_8, VAR_9, VAR_3 - 1, VAR_4 + 1);", "}", "if (VAR_10)\nreturn ((VAR_8 + VAR_7) < VAR_0->sps->width ||\n(VAR_9 + VAR_7) < VAR_0->sps->height);", "else\nreturn 0;", "} else {", "VAR_6 = hls_coding_unit(VAR_0, VAR_1, VAR_2, VAR_3);", "if (VAR_6 < 0)\nreturn VAR_6;", "if ((!((VAR_1 + VAR_5) %\n(1 << (VAR_0->sps->log2_ctb_size))) ||\n(VAR_1 + VAR_5 >= VAR_0->sps->width)) &&\n(!((VAR_2 + VAR_5) %\n(1 << (VAR_0->sps->log2_ctb_size))) ||\n(VAR_2 + VAR_5 >= VAR_0->sps->height))) {", "int VAR_11 = ff_hevc_end_of_slice_flag_decode(VAR_0);", "return !VAR_11;", "} else {", "return 1;", "}", "}", "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, 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, 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63, 65 ], [ 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 ], [ 129 ], [ 131 ] ]
8,343
static void test_uuid_unparse_strdup(void) { int i; for (i = 0; i < ARRAY_SIZE(uuid_test_data); i++) { char *out; if (!uuid_test_data[i].check_unparse) { continue; } out = qemu_uuid_unparse_strdup(&uuid_test_data[i].uuid); g_assert_cmpstr(uuid_test_data[i].uuidstr, ==, out); } }
true
qemu
d9c05e507f7a6647cd7b106c8784f1f15a0e4f5c
static void test_uuid_unparse_strdup(void) { int i; for (i = 0; i < ARRAY_SIZE(uuid_test_data); i++) { char *out; if (!uuid_test_data[i].check_unparse) { continue; } out = qemu_uuid_unparse_strdup(&uuid_test_data[i].uuid); g_assert_cmpstr(uuid_test_data[i].uuidstr, ==, out); } }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { int VAR_0; for (VAR_0 = 0; VAR_0 < ARRAY_SIZE(uuid_test_data); VAR_0++) { char *out; if (!uuid_test_data[VAR_0].check_unparse) { continue; } out = qemu_uuid_unparse_strdup(&uuid_test_data[VAR_0].uuid); g_assert_cmpstr(uuid_test_data[VAR_0].uuidstr, ==, out); } }
[ "static void FUNC_0(void)\n{", "int VAR_0;", "for (VAR_0 = 0; VAR_0 < ARRAY_SIZE(uuid_test_data); VAR_0++) {", "char *out;", "if (!uuid_test_data[VAR_0].check_unparse) {", "continue;", "}", "out = qemu_uuid_unparse_strdup(&uuid_test_data[VAR_0].uuid);", "g_assert_cmpstr(uuid_test_data[VAR_0].uuidstr, ==, out);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 26 ], [ 28 ] ]
8,344
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { SmackVContext * const smk = avctx->priv_data; uint8_t *out; uint32_t *pal; GetBitContext gb; int blocks, blk, bw, bh; int i; int stride; if(buf_size == 769) return 0; if(smk->pic.data[0]) avctx->release_buffer(avctx, &smk->pic); smk->pic.reference = 1; smk->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if(avctx->reget_buffer(avctx, &smk->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } /* make the palette available on the way out */ pal = (uint32_t*)smk->pic.data[1]; smk->pic.palette_has_changed = buf[0] & 1; smk->pic.key_frame = !!(buf[0] & 2); if(smk->pic.key_frame) smk->pic.pict_type = FF_I_TYPE; else smk->pic.pict_type = FF_P_TYPE; buf++; for(i = 0; i < 256; i++) *pal++ = bytestream_get_be24(&buf); buf_size -= 769; last_reset(smk->mmap_tbl, smk->mmap_last); last_reset(smk->mclr_tbl, smk->mclr_last); last_reset(smk->full_tbl, smk->full_last); last_reset(smk->type_tbl, smk->type_last); init_get_bits(&gb, buf, buf_size * 8); blk = 0; bw = avctx->width >> 2; bh = avctx->height >> 2; blocks = bw * bh; out = smk->pic.data[0]; stride = smk->pic.linesize[0]; while(blk < blocks) { int type, run, mode; uint16_t pix; type = smk_get_code(&gb, smk->type_tbl, smk->type_last); run = block_runs[(type >> 2) & 0x3F]; switch(type & 3){ case SMK_BLK_MONO: while(run-- && blk < blocks){ int clr, map; int hi, lo; clr = smk_get_code(&gb, smk->mclr_tbl, smk->mclr_last); map = smk_get_code(&gb, smk->mmap_tbl, smk->mmap_last); out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4; hi = clr >> 8; lo = clr & 0xFF; for(i = 0; i < 4; i++) { if(map & 1) out[0] = hi; else out[0] = lo; if(map & 2) out[1] = hi; else out[1] = lo; if(map & 4) out[2] = hi; else out[2] = lo; if(map & 8) out[3] = hi; else out[3] = lo; map >>= 4; out += stride; } blk++; } break; case SMK_BLK_FULL: mode = 0; if(avctx->codec_tag == MKTAG('S', 'M', 'K', '4')) { // In case of Smacker v4 we have three modes if(get_bits1(&gb)) mode = 1; else if(get_bits1(&gb)) mode = 2; } while(run-- && blk < blocks){ out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4; switch(mode){ case 0: for(i = 0; i < 4; i++) { pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out+2,pix); pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out,pix); out += stride; } break; case 1: pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; break; case 2: for(i = 0; i < 2; i++) { uint16_t pix1, pix2; pix1 = smk_get_code(&gb, smk->full_tbl, smk->full_last); pix2 = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out,pix1); AV_WL16(out+2,pix2); out += stride; AV_WL16(out,pix1); AV_WL16(out+2,pix2); out += stride; } break; } blk++; } break; case SMK_BLK_SKIP: while(run-- && blk < blocks) blk++; break; case SMK_BLK_FILL: mode = type >> 8; while(run-- && blk < blocks){ uint32_t col; out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4; col = mode * 0x01010101; for(i = 0; i < 4; i++) { *((uint32_t*)out) = col; out += stride; } blk++; } break; } } *data_size = sizeof(AVFrame); *(AVFrame*)data = smk->pic; /* always report that the buffer was completely consumed */ return buf_size; }
true
FFmpeg
909063f74551141e181ff806fabe133ebc5e369e
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { SmackVContext * const smk = avctx->priv_data; uint8_t *out; uint32_t *pal; GetBitContext gb; int blocks, blk, bw, bh; int i; int stride; if(buf_size == 769) return 0; if(smk->pic.data[0]) avctx->release_buffer(avctx, &smk->pic); smk->pic.reference = 1; smk->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if(avctx->reget_buffer(avctx, &smk->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } pal = (uint32_t*)smk->pic.data[1]; smk->pic.palette_has_changed = buf[0] & 1; smk->pic.key_frame = !!(buf[0] & 2); if(smk->pic.key_frame) smk->pic.pict_type = FF_I_TYPE; else smk->pic.pict_type = FF_P_TYPE; buf++; for(i = 0; i < 256; i++) *pal++ = bytestream_get_be24(&buf); buf_size -= 769; last_reset(smk->mmap_tbl, smk->mmap_last); last_reset(smk->mclr_tbl, smk->mclr_last); last_reset(smk->full_tbl, smk->full_last); last_reset(smk->type_tbl, smk->type_last); init_get_bits(&gb, buf, buf_size * 8); blk = 0; bw = avctx->width >> 2; bh = avctx->height >> 2; blocks = bw * bh; out = smk->pic.data[0]; stride = smk->pic.linesize[0]; while(blk < blocks) { int type, run, mode; uint16_t pix; type = smk_get_code(&gb, smk->type_tbl, smk->type_last); run = block_runs[(type >> 2) & 0x3F]; switch(type & 3){ case SMK_BLK_MONO: while(run-- && blk < blocks){ int clr, map; int hi, lo; clr = smk_get_code(&gb, smk->mclr_tbl, smk->mclr_last); map = smk_get_code(&gb, smk->mmap_tbl, smk->mmap_last); out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4; hi = clr >> 8; lo = clr & 0xFF; for(i = 0; i < 4; i++) { if(map & 1) out[0] = hi; else out[0] = lo; if(map & 2) out[1] = hi; else out[1] = lo; if(map & 4) out[2] = hi; else out[2] = lo; if(map & 8) out[3] = hi; else out[3] = lo; map >>= 4; out += stride; } blk++; } break; case SMK_BLK_FULL: mode = 0; if(avctx->codec_tag == MKTAG('S', 'M', 'K', '4')) { if(get_bits1(&gb)) mode = 1; else if(get_bits1(&gb)) mode = 2; } while(run-- && blk < blocks){ out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4; switch(mode){ case 0: for(i = 0; i < 4; i++) { pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out+2,pix); pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out,pix); out += stride; } break; case 1: pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += stride; break; case 2: for(i = 0; i < 2; i++) { uint16_t pix1, pix2; pix1 = smk_get_code(&gb, smk->full_tbl, smk->full_last); pix2 = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out,pix1); AV_WL16(out+2,pix2); out += stride; AV_WL16(out,pix1); AV_WL16(out+2,pix2); out += stride; } break; } blk++; } break; case SMK_BLK_SKIP: while(run-- && blk < blocks) blk++; break; case SMK_BLK_FILL: mode = type >> 8; while(run-- && blk < blocks){ uint32_t col; out = smk->pic.data[0] + (blk / bw) * (stride * 4) + (blk % bw) * 4; col = mode * 0x01010101; for(i = 0; i < 4; i++) { *((uint32_t*)out) = col; out += stride; } blk++; } break; } } *data_size = sizeof(AVFrame); *(AVFrame*)data = smk->pic; return buf_size; }
{ "code": [ " if(buf_size == 769)" ], "line_no": [ 21 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, const uint8_t *VAR_3, int VAR_4) { SmackVContext * const smk = VAR_0->priv_data; uint8_t *out; uint32_t *pal; GetBitContext gb; int VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9; int VAR_10; if(VAR_4 == 769) return 0; if(smk->pic.VAR_1[0]) VAR_0->release_buffer(VAR_0, &smk->pic); smk->pic.reference = 1; smk->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if(VAR_0->reget_buffer(VAR_0, &smk->pic) < 0){ av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } pal = (uint32_t*)smk->pic.VAR_1[1]; smk->pic.palette_has_changed = VAR_3[0] & 1; smk->pic.key_frame = !!(VAR_3[0] & 2); if(smk->pic.key_frame) smk->pic.pict_type = FF_I_TYPE; else smk->pic.pict_type = FF_P_TYPE; VAR_3++; for(VAR_9 = 0; VAR_9 < 256; VAR_9++) *pal++ = bytestream_get_be24(&VAR_3); VAR_4 -= 769; last_reset(smk->mmap_tbl, smk->mmap_last); last_reset(smk->mclr_tbl, smk->mclr_last); last_reset(smk->full_tbl, smk->full_last); last_reset(smk->type_tbl, smk->type_last); init_get_bits(&gb, VAR_3, VAR_4 * 8); VAR_6 = 0; VAR_7 = VAR_0->width >> 2; VAR_8 = VAR_0->height >> 2; VAR_5 = VAR_7 * VAR_8; out = smk->pic.VAR_1[0]; VAR_10 = smk->pic.linesize[0]; while(VAR_6 < VAR_5) { int VAR_11, VAR_12, VAR_13; uint16_t pix; VAR_11 = smk_get_code(&gb, smk->type_tbl, smk->type_last); VAR_12 = block_runs[(VAR_11 >> 2) & 0x3F]; switch(VAR_11 & 3){ case SMK_BLK_MONO: while(VAR_12-- && VAR_6 < VAR_5){ int VAR_14, VAR_15; int VAR_16, VAR_17; VAR_14 = smk_get_code(&gb, smk->mclr_tbl, smk->mclr_last); VAR_15 = smk_get_code(&gb, smk->mmap_tbl, smk->mmap_last); out = smk->pic.VAR_1[0] + (VAR_6 / VAR_7) * (VAR_10 * 4) + (VAR_6 % VAR_7) * 4; VAR_16 = VAR_14 >> 8; VAR_17 = VAR_14 & 0xFF; for(VAR_9 = 0; VAR_9 < 4; VAR_9++) { if(VAR_15 & 1) out[0] = VAR_16; else out[0] = VAR_17; if(VAR_15 & 2) out[1] = VAR_16; else out[1] = VAR_17; if(VAR_15 & 4) out[2] = VAR_16; else out[2] = VAR_17; if(VAR_15 & 8) out[3] = VAR_16; else out[3] = VAR_17; VAR_15 >>= 4; out += VAR_10; } VAR_6++; } break; case SMK_BLK_FULL: VAR_13 = 0; if(VAR_0->codec_tag == MKTAG('S', 'M', 'K', '4')) { if(get_bits1(&gb)) VAR_13 = 1; else if(get_bits1(&gb)) VAR_13 = 2; } while(VAR_12-- && VAR_6 < VAR_5){ out = smk->pic.VAR_1[0] + (VAR_6 / VAR_7) * (VAR_10 * 4) + (VAR_6 % VAR_7) * 4; switch(VAR_13){ case 0: for(VAR_9 = 0; VAR_9 < 4; VAR_9++) { pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out+2,pix); pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out,pix); out += VAR_10; } break; case 1: pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += VAR_10; out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += VAR_10; pix = smk_get_code(&gb, smk->full_tbl, smk->full_last); out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += VAR_10; out[0] = out[1] = pix & 0xFF; out[2] = out[3] = pix >> 8; out += VAR_10; break; case 2: for(VAR_9 = 0; VAR_9 < 2; VAR_9++) { uint16_t pix1, pix2; pix1 = smk_get_code(&gb, smk->full_tbl, smk->full_last); pix2 = smk_get_code(&gb, smk->full_tbl, smk->full_last); AV_WL16(out,pix1); AV_WL16(out+2,pix2); out += VAR_10; AV_WL16(out,pix1); AV_WL16(out+2,pix2); out += VAR_10; } break; } VAR_6++; } break; case SMK_BLK_SKIP: while(VAR_12-- && VAR_6 < VAR_5) VAR_6++; break; case SMK_BLK_FILL: VAR_13 = VAR_11 >> 8; while(VAR_12-- && VAR_6 < VAR_5){ uint32_t col; out = smk->pic.VAR_1[0] + (VAR_6 / VAR_7) * (VAR_10 * 4) + (VAR_6 % VAR_7) * 4; col = VAR_13 * 0x01010101; for(VAR_9 = 0; VAR_9 < 4; VAR_9++) { *((uint32_t*)out) = col; out += VAR_10; } VAR_6++; } break; } } *VAR_2 = sizeof(AVFrame); *(AVFrame*)VAR_1 = smk->pic; return VAR_4; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, const uint8_t *VAR_3, int VAR_4)\n{", "SmackVContext * const smk = VAR_0->priv_data;", "uint8_t *out;", "uint32_t *pal;", "GetBitContext gb;", "int VAR_5, VAR_6, VAR_7, VAR_8;", "int VAR_9;", "int VAR_10;", "if(VAR_4 == 769)\nreturn 0;", "if(smk->pic.VAR_1[0])\nVAR_0->release_buffer(VAR_0, &smk->pic);", "smk->pic.reference = 1;", "smk->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;", "if(VAR_0->reget_buffer(VAR_0, &smk->pic) < 0){", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return -1;", "}", "pal = (uint32_t*)smk->pic.VAR_1[1];", "smk->pic.palette_has_changed = VAR_3[0] & 1;", "smk->pic.key_frame = !!(VAR_3[0] & 2);", "if(smk->pic.key_frame)\nsmk->pic.pict_type = FF_I_TYPE;", "else\nsmk->pic.pict_type = FF_P_TYPE;", "VAR_3++;", "for(VAR_9 = 0; VAR_9 < 256; VAR_9++)", "*pal++ = bytestream_get_be24(&VAR_3);", "VAR_4 -= 769;", "last_reset(smk->mmap_tbl, smk->mmap_last);", "last_reset(smk->mclr_tbl, smk->mclr_last);", "last_reset(smk->full_tbl, smk->full_last);", "last_reset(smk->type_tbl, smk->type_last);", "init_get_bits(&gb, VAR_3, VAR_4 * 8);", "VAR_6 = 0;", "VAR_7 = VAR_0->width >> 2;", "VAR_8 = VAR_0->height >> 2;", "VAR_5 = VAR_7 * VAR_8;", "out = smk->pic.VAR_1[0];", "VAR_10 = smk->pic.linesize[0];", "while(VAR_6 < VAR_5) {", "int VAR_11, VAR_12, VAR_13;", "uint16_t pix;", "VAR_11 = smk_get_code(&gb, smk->type_tbl, smk->type_last);", "VAR_12 = block_runs[(VAR_11 >> 2) & 0x3F];", "switch(VAR_11 & 3){", "case SMK_BLK_MONO:\nwhile(VAR_12-- && VAR_6 < VAR_5){", "int VAR_14, VAR_15;", "int VAR_16, VAR_17;", "VAR_14 = smk_get_code(&gb, smk->mclr_tbl, smk->mclr_last);", "VAR_15 = smk_get_code(&gb, smk->mmap_tbl, smk->mmap_last);", "out = smk->pic.VAR_1[0] + (VAR_6 / VAR_7) * (VAR_10 * 4) + (VAR_6 % VAR_7) * 4;", "VAR_16 = VAR_14 >> 8;", "VAR_17 = VAR_14 & 0xFF;", "for(VAR_9 = 0; VAR_9 < 4; VAR_9++) {", "if(VAR_15 & 1) out[0] = VAR_16; else out[0] = VAR_17;", "if(VAR_15 & 2) out[1] = VAR_16; else out[1] = VAR_17;", "if(VAR_15 & 4) out[2] = VAR_16; else out[2] = VAR_17;", "if(VAR_15 & 8) out[3] = VAR_16; else out[3] = VAR_17;", "VAR_15 >>= 4;", "out += VAR_10;", "}", "VAR_6++;", "}", "break;", "case SMK_BLK_FULL:\nVAR_13 = 0;", "if(VAR_0->codec_tag == MKTAG('S', 'M', 'K', '4')) {", "if(get_bits1(&gb)) VAR_13 = 1;", "else if(get_bits1(&gb)) VAR_13 = 2;", "}", "while(VAR_12-- && VAR_6 < VAR_5){", "out = smk->pic.VAR_1[0] + (VAR_6 / VAR_7) * (VAR_10 * 4) + (VAR_6 % VAR_7) * 4;", "switch(VAR_13){", "case 0:\nfor(VAR_9 = 0; VAR_9 < 4; VAR_9++) {", "pix = smk_get_code(&gb, smk->full_tbl, smk->full_last);", "AV_WL16(out+2,pix);", "pix = smk_get_code(&gb, smk->full_tbl, smk->full_last);", "AV_WL16(out,pix);", "out += VAR_10;", "}", "break;", "case 1:\npix = smk_get_code(&gb, smk->full_tbl, smk->full_last);", "out[0] = out[1] = pix & 0xFF;", "out[2] = out[3] = pix >> 8;", "out += VAR_10;", "out[0] = out[1] = pix & 0xFF;", "out[2] = out[3] = pix >> 8;", "out += VAR_10;", "pix = smk_get_code(&gb, smk->full_tbl, smk->full_last);", "out[0] = out[1] = pix & 0xFF;", "out[2] = out[3] = pix >> 8;", "out += VAR_10;", "out[0] = out[1] = pix & 0xFF;", "out[2] = out[3] = pix >> 8;", "out += VAR_10;", "break;", "case 2:\nfor(VAR_9 = 0; VAR_9 < 2; VAR_9++) {", "uint16_t pix1, pix2;", "pix1 = smk_get_code(&gb, smk->full_tbl, smk->full_last);", "pix2 = smk_get_code(&gb, smk->full_tbl, smk->full_last);", "AV_WL16(out,pix1);", "AV_WL16(out+2,pix2);", "out += VAR_10;", "AV_WL16(out,pix1);", "AV_WL16(out+2,pix2);", "out += VAR_10;", "}", "break;", "}", "VAR_6++;", "}", "break;", "case SMK_BLK_SKIP:\nwhile(VAR_12-- && VAR_6 < VAR_5)\nVAR_6++;", "break;", "case SMK_BLK_FILL:\nVAR_13 = VAR_11 >> 8;", "while(VAR_12-- && VAR_6 < VAR_5){", "uint32_t col;", "out = smk->pic.VAR_1[0] + (VAR_6 / VAR_7) * (VAR_10 * 4) + (VAR_6 % VAR_7) * 4;", "col = VAR_13 * 0x01010101;", "for(VAR_9 = 0; VAR_9 < 4; VAR_9++) {", "*((uint32_t*)out) = col;", "out += VAR_10;", "}", "VAR_6++;", "}", "break;", "}", "}", "*VAR_2 = sizeof(AVFrame);", "*(AVFrame*)VAR_1 = smk->pic;", "return VAR_4;", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25, 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55 ], [ 57, 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 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 ], [ 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 ], [ 247 ], [ 249 ], [ 251 ], [ 253, 255, 257 ], [ 259 ], [ 261, 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 291 ], [ 295 ], [ 297 ], [ 303 ], [ 305 ] ]
8,345
static void core_region_del(MemoryListener *listener, MemoryRegionSection *section) { cpu_register_physical_memory_log(section, false); }
true
qemu
54688b1ec1f468c7272b837ff57298068aaedf5f
static void core_region_del(MemoryListener *listener, MemoryRegionSection *section) { cpu_register_physical_memory_log(section, false); }
{ "code": [ " cpu_register_physical_memory_log(section, false);" ], "line_no": [ 7 ] }
static void FUNC_0(MemoryListener *VAR_0, MemoryRegionSection *VAR_1) { cpu_register_physical_memory_log(VAR_1, false); }
[ "static void FUNC_0(MemoryListener *VAR_0,\nMemoryRegionSection *VAR_1)\n{", "cpu_register_physical_memory_log(VAR_1, false);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
8,346
void do_store_msr (CPUPPCState *env, target_ulong value) { int enter_pm; value &= env->msr_mask; if (((value >> MSR_IR) & 1) != msr_ir || ((value >> MSR_DR) & 1) != msr_dr) { /* Flush all tlb when changing translation mode */ tlb_flush(env, 1); env->interrupt_request |= CPU_INTERRUPT_EXITTB; } #if 0 if (loglevel != 0) { fprintf(logfile, "%s: T0 %08lx\n", __func__, value); } #endif switch (PPC_EXCP(env)) { case PPC_FLAGS_EXCP_602: case PPC_FLAGS_EXCP_603: if (((value >> MSR_TGPR) & 1) != msr_tgpr) { /* Swap temporary saved registers with GPRs */ swap_gpr_tgpr(env); } break; default: break; } #if defined (TARGET_PPC64) msr_sf = (value >> MSR_SF) & 1; msr_isf = (value >> MSR_ISF) & 1; msr_hv = (value >> MSR_HV) & 1; #endif msr_ucle = (value >> MSR_UCLE) & 1; msr_vr = (value >> MSR_VR) & 1; /* VR / SPE */ msr_ap = (value >> MSR_AP) & 1; msr_sa = (value >> MSR_SA) & 1; msr_key = (value >> MSR_KEY) & 1; msr_pow = (value >> MSR_POW) & 1; /* POW / WE */ msr_tlb = (value >> MSR_TLB) & 1; /* TLB / TGPR / CE */ msr_ile = (value >> MSR_ILE) & 1; msr_ee = (value >> MSR_EE) & 1; msr_pr = (value >> MSR_PR) & 1; msr_fp = (value >> MSR_FP) & 1; msr_me = (value >> MSR_ME) & 1; msr_fe0 = (value >> MSR_FE0) & 1; msr_se = (value >> MSR_SE) & 1; /* SE / DWE / UBLE */ msr_be = (value >> MSR_BE) & 1; /* BE / DE */ msr_fe1 = (value >> MSR_FE1) & 1; msr_al = (value >> MSR_AL) & 1; msr_ip = (value >> MSR_IP) & 1; msr_ir = (value >> MSR_IR) & 1; /* IR / IS */ msr_dr = (value >> MSR_DR) & 1; /* DR / DS */ msr_pe = (value >> MSR_PE) & 1; /* PE / EP */ msr_px = (value >> MSR_PX) & 1; /* PX / PMM */ msr_ri = (value >> MSR_RI) & 1; msr_le = (value >> MSR_LE) & 1; do_compute_hflags(env); enter_pm = 0; switch (PPC_EXCP(env)) { case PPC_FLAGS_EXCP_603: /* Don't handle SLEEP mode: we should disable all clocks... * No dynamic power-management. */ if (msr_pow == 1 && (env->spr[SPR_HID0] & 0x00C00000) != 0) enter_pm = 1; break; case PPC_FLAGS_EXCP_604: if (msr_pow == 1) enter_pm = 1; break; case PPC_FLAGS_EXCP_7x0: if (msr_pow == 1 && (env->spr[SPR_HID0] & 0x00E00000) != 0) enter_pm = 1; break; default: break; } if (enter_pm) { /* power save: exit cpu loop */ env->halted = 1; env->exception_index = EXCP_HLT; cpu_loop_exit(); } }
true
qemu
c19dbb9426a34a8e8cfdc5c285e8562ff3fe4f7a
void do_store_msr (CPUPPCState *env, target_ulong value) { int enter_pm; value &= env->msr_mask; if (((value >> MSR_IR) & 1) != msr_ir || ((value >> MSR_DR) & 1) != msr_dr) { tlb_flush(env, 1); env->interrupt_request |= CPU_INTERRUPT_EXITTB; } #if 0 if (loglevel != 0) { fprintf(logfile, "%s: T0 %08lx\n", __func__, value); } #endif switch (PPC_EXCP(env)) { case PPC_FLAGS_EXCP_602: case PPC_FLAGS_EXCP_603: if (((value >> MSR_TGPR) & 1) != msr_tgpr) { swap_gpr_tgpr(env); } break; default: break; } #if defined (TARGET_PPC64) msr_sf = (value >> MSR_SF) & 1; msr_isf = (value >> MSR_ISF) & 1; msr_hv = (value >> MSR_HV) & 1; #endif msr_ucle = (value >> MSR_UCLE) & 1; msr_vr = (value >> MSR_VR) & 1; msr_ap = (value >> MSR_AP) & 1; msr_sa = (value >> MSR_SA) & 1; msr_key = (value >> MSR_KEY) & 1; msr_pow = (value >> MSR_POW) & 1; msr_tlb = (value >> MSR_TLB) & 1; msr_ile = (value >> MSR_ILE) & 1; msr_ee = (value >> MSR_EE) & 1; msr_pr = (value >> MSR_PR) & 1; msr_fp = (value >> MSR_FP) & 1; msr_me = (value >> MSR_ME) & 1; msr_fe0 = (value >> MSR_FE0) & 1; msr_se = (value >> MSR_SE) & 1; msr_be = (value >> MSR_BE) & 1; msr_fe1 = (value >> MSR_FE1) & 1; msr_al = (value >> MSR_AL) & 1; msr_ip = (value >> MSR_IP) & 1; msr_ir = (value >> MSR_IR) & 1; msr_dr = (value >> MSR_DR) & 1; msr_pe = (value >> MSR_PE) & 1; msr_px = (value >> MSR_PX) & 1; msr_ri = (value >> MSR_RI) & 1; msr_le = (value >> MSR_LE) & 1; do_compute_hflags(env); enter_pm = 0; switch (PPC_EXCP(env)) { case PPC_FLAGS_EXCP_603: if (msr_pow == 1 && (env->spr[SPR_HID0] & 0x00C00000) != 0) enter_pm = 1; break; case PPC_FLAGS_EXCP_604: if (msr_pow == 1) enter_pm = 1; break; case PPC_FLAGS_EXCP_7x0: if (msr_pow == 1 && (env->spr[SPR_HID0] & 0x00E00000) != 0) enter_pm = 1; break; default: break; } if (enter_pm) { env->halted = 1; env->exception_index = EXCP_HLT; cpu_loop_exit(); } }
{ "code": [ " env->halted = 1;", " env->exception_index = EXCP_HLT;", " cpu_loop_exit();" ], "line_no": [ 161, 163, 165 ] }
void FUNC_0 (CPUPPCState *VAR_0, target_ulong VAR_1) { int VAR_2; VAR_1 &= VAR_0->msr_mask; if (((VAR_1 >> MSR_IR) & 1) != msr_ir || ((VAR_1 >> MSR_DR) & 1) != msr_dr) { tlb_flush(VAR_0, 1); VAR_0->interrupt_request |= CPU_INTERRUPT_EXITTB; } #if 0 if (loglevel != 0) { fprintf(logfile, "%s: T0 %08lx\n", __func__, VAR_1); } #endif switch (PPC_EXCP(VAR_0)) { case PPC_FLAGS_EXCP_602: case PPC_FLAGS_EXCP_603: if (((VAR_1 >> MSR_TGPR) & 1) != msr_tgpr) { swap_gpr_tgpr(VAR_0); } break; default: break; } #if defined (TARGET_PPC64) msr_sf = (VAR_1 >> MSR_SF) & 1; msr_isf = (VAR_1 >> MSR_ISF) & 1; msr_hv = (VAR_1 >> MSR_HV) & 1; #endif msr_ucle = (VAR_1 >> MSR_UCLE) & 1; msr_vr = (VAR_1 >> MSR_VR) & 1; msr_ap = (VAR_1 >> MSR_AP) & 1; msr_sa = (VAR_1 >> MSR_SA) & 1; msr_key = (VAR_1 >> MSR_KEY) & 1; msr_pow = (VAR_1 >> MSR_POW) & 1; msr_tlb = (VAR_1 >> MSR_TLB) & 1; msr_ile = (VAR_1 >> MSR_ILE) & 1; msr_ee = (VAR_1 >> MSR_EE) & 1; msr_pr = (VAR_1 >> MSR_PR) & 1; msr_fp = (VAR_1 >> MSR_FP) & 1; msr_me = (VAR_1 >> MSR_ME) & 1; msr_fe0 = (VAR_1 >> MSR_FE0) & 1; msr_se = (VAR_1 >> MSR_SE) & 1; msr_be = (VAR_1 >> MSR_BE) & 1; msr_fe1 = (VAR_1 >> MSR_FE1) & 1; msr_al = (VAR_1 >> MSR_AL) & 1; msr_ip = (VAR_1 >> MSR_IP) & 1; msr_ir = (VAR_1 >> MSR_IR) & 1; msr_dr = (VAR_1 >> MSR_DR) & 1; msr_pe = (VAR_1 >> MSR_PE) & 1; msr_px = (VAR_1 >> MSR_PX) & 1; msr_ri = (VAR_1 >> MSR_RI) & 1; msr_le = (VAR_1 >> MSR_LE) & 1; do_compute_hflags(VAR_0); VAR_2 = 0; switch (PPC_EXCP(VAR_0)) { case PPC_FLAGS_EXCP_603: if (msr_pow == 1 && (VAR_0->spr[SPR_HID0] & 0x00C00000) != 0) VAR_2 = 1; break; case PPC_FLAGS_EXCP_604: if (msr_pow == 1) VAR_2 = 1; break; case PPC_FLAGS_EXCP_7x0: if (msr_pow == 1 && (VAR_0->spr[SPR_HID0] & 0x00E00000) != 0) VAR_2 = 1; break; default: break; } if (VAR_2) { VAR_0->halted = 1; VAR_0->exception_index = EXCP_HLT; cpu_loop_exit(); } }
[ "void FUNC_0 (CPUPPCState *VAR_0, target_ulong VAR_1)\n{", "int VAR_2;", "VAR_1 &= VAR_0->msr_mask;", "if (((VAR_1 >> MSR_IR) & 1) != msr_ir ||\n((VAR_1 >> MSR_DR) & 1) != msr_dr) {", "tlb_flush(VAR_0, 1);", "VAR_0->interrupt_request |= CPU_INTERRUPT_EXITTB;", "}", "#if 0\nif (loglevel != 0) {", "fprintf(logfile, \"%s: T0 %08lx\\n\", __func__, VAR_1);", "}", "#endif\nswitch (PPC_EXCP(VAR_0)) {", "case PPC_FLAGS_EXCP_602:\ncase PPC_FLAGS_EXCP_603:\nif (((VAR_1 >> MSR_TGPR) & 1) != msr_tgpr) {", "swap_gpr_tgpr(VAR_0);", "}", "break;", "default:\nbreak;", "}", "#if defined (TARGET_PPC64)\nmsr_sf = (VAR_1 >> MSR_SF) & 1;", "msr_isf = (VAR_1 >> MSR_ISF) & 1;", "msr_hv = (VAR_1 >> MSR_HV) & 1;", "#endif\nmsr_ucle = (VAR_1 >> MSR_UCLE) & 1;", "msr_vr = (VAR_1 >> MSR_VR) & 1;", "msr_ap = (VAR_1 >> MSR_AP) & 1;", "msr_sa = (VAR_1 >> MSR_SA) & 1;", "msr_key = (VAR_1 >> MSR_KEY) & 1;", "msr_pow = (VAR_1 >> MSR_POW) & 1;", "msr_tlb = (VAR_1 >> MSR_TLB) & 1;", "msr_ile = (VAR_1 >> MSR_ILE) & 1;", "msr_ee = (VAR_1 >> MSR_EE) & 1;", "msr_pr = (VAR_1 >> MSR_PR) & 1;", "msr_fp = (VAR_1 >> MSR_FP) & 1;", "msr_me = (VAR_1 >> MSR_ME) & 1;", "msr_fe0 = (VAR_1 >> MSR_FE0) & 1;", "msr_se = (VAR_1 >> MSR_SE) & 1;", "msr_be = (VAR_1 >> MSR_BE) & 1;", "msr_fe1 = (VAR_1 >> MSR_FE1) & 1;", "msr_al = (VAR_1 >> MSR_AL) & 1;", "msr_ip = (VAR_1 >> MSR_IP) & 1;", "msr_ir = (VAR_1 >> MSR_IR) & 1;", "msr_dr = (VAR_1 >> MSR_DR) & 1;", "msr_pe = (VAR_1 >> MSR_PE) & 1;", "msr_px = (VAR_1 >> MSR_PX) & 1;", "msr_ri = (VAR_1 >> MSR_RI) & 1;", "msr_le = (VAR_1 >> MSR_LE) & 1;", "do_compute_hflags(VAR_0);", "VAR_2 = 0;", "switch (PPC_EXCP(VAR_0)) {", "case PPC_FLAGS_EXCP_603:\nif (msr_pow == 1 && (VAR_0->spr[SPR_HID0] & 0x00C00000) != 0)\nVAR_2 = 1;", "break;", "case PPC_FLAGS_EXCP_604:\nif (msr_pow == 1)\nVAR_2 = 1;", "break;", "case PPC_FLAGS_EXCP_7x0:\nif (msr_pow == 1 && (VAR_0->spr[SPR_HID0] & 0x00E00000) != 0)\nVAR_2 = 1;", "break;", "default:\nbreak;", "}", "if (VAR_2) {", "VAR_0->halted = 1;", "VAR_0->exception_index = EXCP_HLT;", "cpu_loop_exit();", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31, 33 ], [ 35, 37, 39 ], [ 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 ], [ 117 ], [ 119 ], [ 121, 129, 131 ], [ 133 ], [ 135, 137, 139 ], [ 141 ], [ 143, 145, 147 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ] ]
8,347
static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame) { const uint8_t* as_pack; int freq, stype, smpls, quant, i, ach; as_pack = dv_extract_pack(frame, dv_audio_source); if (!as_pack || !c->sys) { /* No audio ? */ c->ach = 0; smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */ freq = (as_pack[4] >> 3) & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */ stype = (as_pack[3] & 0x1f); /* 0 - 2CH, 2 - 4CH, 3 - 8CH */ quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */ if (stype > 3) { av_log(c->fctx, AV_LOG_ERROR, "stype %d is invalid\n", stype); c->ach = 0; /* note: ach counts PAIRS of channels (i.e. stereo channels) */ ach = ((int[4]){ 1, 0, 2, 4})[stype]; if (ach == 1 && quant && freq == 2) ach = 2; /* Dynamic handling of the audio streams in DV */ for (i = 0; i < ach; i++) { if (!c->ast[i]) { c->ast[i] = avformat_new_stream(c->fctx, NULL); if (!c->ast[i]) break; avpriv_set_pts_info(c->ast[i], 64, 1, 30000); c->ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO; c->ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE; av_init_packet(&c->audio_pkt[i]); c->audio_pkt[i].size = 0; c->audio_pkt[i].data = c->audio_buf[i]; c->audio_pkt[i].stream_index = c->ast[i]->index; c->audio_pkt[i].flags |= AV_PKT_FLAG_KEY; c->ast[i]->codec->sample_rate = dv_audio_frequency[freq]; c->ast[i]->codec->channels = 2; c->ast[i]->codec->bit_rate = 2 * dv_audio_frequency[freq] * 16; c->ast[i]->start_time = 0; c->ach = i; return (c->sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */;
true
FFmpeg
0ab3687924457cb4fd81897bd39ab3cc5b699588
static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame) { const uint8_t* as_pack; int freq, stype, smpls, quant, i, ach; as_pack = dv_extract_pack(frame, dv_audio_source); if (!as_pack || !c->sys) { c->ach = 0; smpls = as_pack[1] & 0x3f; freq = (as_pack[4] >> 3) & 0x07; stype = (as_pack[3] & 0x1f); quant = as_pack[4] & 0x07; if (stype > 3) { av_log(c->fctx, AV_LOG_ERROR, "stype %d is invalid\n", stype); c->ach = 0; ach = ((int[4]){ 1, 0, 2, 4})[stype]; if (ach == 1 && quant && freq == 2) ach = 2; for (i = 0; i < ach; i++) { if (!c->ast[i]) { c->ast[i] = avformat_new_stream(c->fctx, NULL); if (!c->ast[i]) break; avpriv_set_pts_info(c->ast[i], 64, 1, 30000); c->ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO; c->ast[i]->codec->codec_id = CODEC_ID_PCM_S16LE; av_init_packet(&c->audio_pkt[i]); c->audio_pkt[i].size = 0; c->audio_pkt[i].data = c->audio_buf[i]; c->audio_pkt[i].stream_index = c->ast[i]->index; c->audio_pkt[i].flags |= AV_PKT_FLAG_KEY; c->ast[i]->codec->sample_rate = dv_audio_frequency[freq]; c->ast[i]->codec->channels = 2; c->ast[i]->codec->bit_rate = 2 * dv_audio_frequency[freq] * 16; c->ast[i]->start_time = 0; c->ach = i; return (c->sys->audio_min_samples[freq] + smpls) * 4; ;
{ "code": [], "line_no": [] }
static int FUNC_0(DVDemuxContext* VAR_0, uint8_t* VAR_1) { const uint8_t* VAR_2; int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; VAR_2 = dv_extract_pack(VAR_1, dv_audio_source); if (!VAR_2 || !VAR_0->sys) { VAR_0->VAR_8 = 0; VAR_5 = VAR_2[1] & 0x3f; VAR_3 = (VAR_2[4] >> 3) & 0x07; VAR_4 = (VAR_2[3] & 0x1f); VAR_6 = VAR_2[4] & 0x07; if (VAR_4 > 3) { av_log(VAR_0->fctx, AV_LOG_ERROR, "VAR_4 %d is invalid\n", VAR_4); VAR_0->VAR_8 = 0; VAR_8 = ((int[4]){ 1, 0, 2, 4})[VAR_4]; if (VAR_8 == 1 && VAR_6 && VAR_3 == 2) VAR_8 = 2; for (VAR_7 = 0; VAR_7 < VAR_8; VAR_7++) { if (!VAR_0->ast[VAR_7]) { VAR_0->ast[VAR_7] = avformat_new_stream(VAR_0->fctx, NULL); if (!VAR_0->ast[VAR_7]) break; avpriv_set_pts_info(VAR_0->ast[VAR_7], 64, 1, 30000); VAR_0->ast[VAR_7]->codec->codec_type = AVMEDIA_TYPE_AUDIO; VAR_0->ast[VAR_7]->codec->codec_id = CODEC_ID_PCM_S16LE; av_init_packet(&VAR_0->audio_pkt[VAR_7]); VAR_0->audio_pkt[VAR_7].size = 0; VAR_0->audio_pkt[VAR_7].data = VAR_0->audio_buf[VAR_7]; VAR_0->audio_pkt[VAR_7].stream_index = VAR_0->ast[VAR_7]->index; VAR_0->audio_pkt[VAR_7].flags |= AV_PKT_FLAG_KEY; VAR_0->ast[VAR_7]->codec->sample_rate = dv_audio_frequency[VAR_3]; VAR_0->ast[VAR_7]->codec->channels = 2; VAR_0->ast[VAR_7]->codec->bit_rate = 2 * dv_audio_frequency[VAR_3] * 16; VAR_0->ast[VAR_7]->start_time = 0; VAR_0->VAR_8 = VAR_7; return (VAR_0->sys->audio_min_samples[VAR_3] + VAR_5) * 4; ;
[ "static int FUNC_0(DVDemuxContext* VAR_0, uint8_t* VAR_1)\n{", "const uint8_t* VAR_2;", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;", "VAR_2 = dv_extract_pack(VAR_1, dv_audio_source);", "if (!VAR_2 || !VAR_0->sys) {", "VAR_0->VAR_8 = 0;", "VAR_5 = VAR_2[1] & 0x3f;", "VAR_3 = (VAR_2[4] >> 3) & 0x07;", "VAR_4 = (VAR_2[3] & 0x1f);", "VAR_6 = VAR_2[4] & 0x07;", "if (VAR_4 > 3) {", "av_log(VAR_0->fctx, AV_LOG_ERROR, \"VAR_4 %d is invalid\\n\", VAR_4);", "VAR_0->VAR_8 = 0;", "VAR_8 = ((int[4]){ 1, 0, 2, 4})[VAR_4];", "if (VAR_8 == 1 && VAR_6 && VAR_3 == 2)\nVAR_8 = 2;", "for (VAR_7 = 0; VAR_7 < VAR_8; VAR_7++) {", "if (!VAR_0->ast[VAR_7]) {", "VAR_0->ast[VAR_7] = avformat_new_stream(VAR_0->fctx, NULL);", "if (!VAR_0->ast[VAR_7])\nbreak;", "avpriv_set_pts_info(VAR_0->ast[VAR_7], 64, 1, 30000);", "VAR_0->ast[VAR_7]->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "VAR_0->ast[VAR_7]->codec->codec_id = CODEC_ID_PCM_S16LE;", "av_init_packet(&VAR_0->audio_pkt[VAR_7]);", "VAR_0->audio_pkt[VAR_7].size = 0;", "VAR_0->audio_pkt[VAR_7].data = VAR_0->audio_buf[VAR_7];", "VAR_0->audio_pkt[VAR_7].stream_index = VAR_0->ast[VAR_7]->index;", "VAR_0->audio_pkt[VAR_7].flags |= AV_PKT_FLAG_KEY;", "VAR_0->ast[VAR_7]->codec->sample_rate = dv_audio_frequency[VAR_3];", "VAR_0->ast[VAR_7]->codec->channels = 2;", "VAR_0->ast[VAR_7]->codec->bit_rate = 2 * dv_audio_frequency[VAR_3] * 16;", "VAR_0->ast[VAR_7]->start_time = 0;", "VAR_0->VAR_8 = VAR_7;", "return (VAR_0->sys->audio_min_samples[VAR_3] + VAR_5) * 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 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 16 ], [ 17, 18 ], [ 20 ], [ 21 ], [ 22 ], [ 23, 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34 ], [ 35 ], [ 36 ], [ 37 ], [ 38 ] ]
8,348
QEMUFile *qemu_fopen_socket(int fd, const char *mode) { QEMUFileSocket *s; if (qemu_file_mode_is_not_valid(mode)) { return NULL; } s = g_malloc0(sizeof(QEMUFileSocket)); s->fd = fd; if (mode[0] == 'w') { qemu_set_block(s->fd); s->file = qemu_fopen_ops(s, &socket_write_ops); } else { s->file = qemu_fopen_ops(s, &socket_read_ops); } return s->file; }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
QEMUFile *qemu_fopen_socket(int fd, const char *mode) { QEMUFileSocket *s; if (qemu_file_mode_is_not_valid(mode)) { return NULL; } s = g_malloc0(sizeof(QEMUFileSocket)); s->fd = fd; if (mode[0] == 'w') { qemu_set_block(s->fd); s->file = qemu_fopen_ops(s, &socket_write_ops); } else { s->file = qemu_fopen_ops(s, &socket_read_ops); } return s->file; }
{ "code": [], "line_no": [] }
QEMUFile *FUNC_0(int fd, const char *mode) { QEMUFileSocket *s; if (qemu_file_mode_is_not_valid(mode)) { return NULL; } s = g_malloc0(sizeof(QEMUFileSocket)); s->fd = fd; if (mode[0] == 'w') { qemu_set_block(s->fd); s->file = qemu_fopen_ops(s, &socket_write_ops); } else { s->file = qemu_fopen_ops(s, &socket_read_ops); } return s->file; }
[ "QEMUFile *FUNC_0(int fd, const char *mode)\n{", "QEMUFileSocket *s;", "if (qemu_file_mode_is_not_valid(mode)) {", "return NULL;", "}", "s = g_malloc0(sizeof(QEMUFileSocket));", "s->fd = fd;", "if (mode[0] == 'w') {", "qemu_set_block(s->fd);", "s->file = qemu_fopen_ops(s, &socket_write_ops);", "} else {", "s->file = qemu_fopen_ops(s, &socket_read_ops);", "}", "return s->file;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ] ]
8,349
static void aio_rfifolock_cb(void *opaque) { /* Kick owner thread in case they are blocked in aio_poll() */ aio_notify(opaque); }
true
qemu
ca96ac44dcd290566090b2435bc828fded356ad9
static void aio_rfifolock_cb(void *opaque) { aio_notify(opaque); }
{ "code": [ " aio_notify(opaque);" ], "line_no": [ 7 ] }
static void FUNC_0(void *VAR_0) { aio_notify(VAR_0); }
[ "static void FUNC_0(void *VAR_0)\n{", "aio_notify(VAR_0);", "}" ]
[ 0, 1, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ] ]
8,350
int nbd_receive_negotiate(QIOChannel *ioc, const char *name, QCryptoTLSCreds *tlscreds, const char *hostname, QIOChannel **outioc, NBDExportInfo *info, Error **errp) { char buf[256]; uint64_t magic; int rc; bool zeroes = true; bool structured_reply = info->structured_reply; trace_nbd_receive_negotiate(tlscreds, hostname ? hostname : "<null>"); info->structured_reply = false; rc = -EINVAL; if (outioc) { *outioc = NULL; if (tlscreds && !outioc) { error_setg(errp, "Output I/O channel required for TLS"); if (nbd_read(ioc, buf, 8, errp) < 0) { error_prepend(errp, "Failed to read data"); buf[8] = '\0'; if (strlen(buf) == 0) { error_setg(errp, "Server connection closed unexpectedly"); magic = ldq_be_p(buf); trace_nbd_receive_negotiate_magic(magic); if (memcmp(buf, "NBDMAGIC", 8) != 0) { error_setg(errp, "Invalid magic received"); if (nbd_read(ioc, &magic, sizeof(magic), errp) < 0) { error_prepend(errp, "Failed to read magic"); magic = be64_to_cpu(magic); trace_nbd_receive_negotiate_magic(magic); if (magic == NBD_OPTS_MAGIC) { uint32_t clientflags = 0; uint16_t globalflags; bool fixedNewStyle = false; if (nbd_read(ioc, &globalflags, sizeof(globalflags), errp) < 0) { error_prepend(errp, "Failed to read server flags"); globalflags = be16_to_cpu(globalflags); trace_nbd_receive_negotiate_server_flags(globalflags); if (globalflags & NBD_FLAG_FIXED_NEWSTYLE) { fixedNewStyle = true; clientflags |= NBD_FLAG_C_FIXED_NEWSTYLE; if (globalflags & NBD_FLAG_NO_ZEROES) { zeroes = false; clientflags |= NBD_FLAG_C_NO_ZEROES; /* client requested flags */ clientflags = cpu_to_be32(clientflags); if (nbd_write(ioc, &clientflags, sizeof(clientflags), errp) < 0) { error_prepend(errp, "Failed to send clientflags field"); if (tlscreds) { if (fixedNewStyle) { *outioc = nbd_receive_starttls(ioc, tlscreds, hostname, errp); if (!*outioc) { ioc = *outioc; } else { error_setg(errp, "Server does not support STARTTLS"); if (!name) { trace_nbd_receive_negotiate_default_name(); name = ""; if (fixedNewStyle) { int result; /* Try NBD_OPT_GO first - if it works, we are done (it * also gives us a good message if the server requires * TLS). If it is not available, fall back to * NBD_OPT_LIST for nicer error messages about a missing * export, then use NBD_OPT_EXPORT_NAME. */ result = nbd_opt_go(ioc, name, info, errp); if (result > 0) { return 0; /* Check our desired export is present in the * server export list. Since NBD_OPT_EXPORT_NAME * cannot return an error message, running this * query gives us better error reporting if the * export name is not available. */ if (nbd_receive_query_exports(ioc, name, errp) < 0) { /* write the export name request */ if (nbd_send_option_request(ioc, NBD_OPT_EXPORT_NAME, -1, name, errp) < 0) { /* Read the response */ if (nbd_read(ioc, &info->size, sizeof(info->size), errp) < 0) { error_prepend(errp, "Failed to read export length"); be64_to_cpus(&info->size); if (nbd_read(ioc, &info->flags, sizeof(info->flags), errp) < 0) { error_prepend(errp, "Failed to read export flags"); be16_to_cpus(&info->flags); } else if (magic == NBD_CLIENT_MAGIC) { uint32_t oldflags; if (name) { error_setg(errp, "Server does not support export names"); if (tlscreds) { error_setg(errp, "Server does not support STARTTLS"); if (nbd_read(ioc, &info->size, sizeof(info->size), errp) < 0) { error_prepend(errp, "Failed to read export length"); be64_to_cpus(&info->size); if (nbd_read(ioc, &oldflags, sizeof(oldflags), errp) < 0) { error_prepend(errp, "Failed to read export flags"); be32_to_cpus(&oldflags); if (oldflags & ~0xffff) { error_setg(errp, "Unexpected export flags %0x" PRIx32, oldflags); info->flags = oldflags; } else { error_setg(errp, "Bad magic received"); trace_nbd_receive_negotiate_size_flags(info->size, info->flags); if (zeroes && nbd_drop(ioc, 124, errp) < 0) { error_prepend(errp, "Failed to read reserved block"); rc = 0; fail: return rc;
true
qemu
f140e3000371e67ff4e00df3213e2d576d9c91be
int nbd_receive_negotiate(QIOChannel *ioc, const char *name, QCryptoTLSCreds *tlscreds, const char *hostname, QIOChannel **outioc, NBDExportInfo *info, Error **errp) { char buf[256]; uint64_t magic; int rc; bool zeroes = true; bool structured_reply = info->structured_reply; trace_nbd_receive_negotiate(tlscreds, hostname ? hostname : "<null>"); info->structured_reply = false; rc = -EINVAL; if (outioc) { *outioc = NULL; if (tlscreds && !outioc) { error_setg(errp, "Output I/O channel required for TLS"); if (nbd_read(ioc, buf, 8, errp) < 0) { error_prepend(errp, "Failed to read data"); buf[8] = '\0'; if (strlen(buf) == 0) { error_setg(errp, "Server connection closed unexpectedly"); magic = ldq_be_p(buf); trace_nbd_receive_negotiate_magic(magic); if (memcmp(buf, "NBDMAGIC", 8) != 0) { error_setg(errp, "Invalid magic received"); if (nbd_read(ioc, &magic, sizeof(magic), errp) < 0) { error_prepend(errp, "Failed to read magic"); magic = be64_to_cpu(magic); trace_nbd_receive_negotiate_magic(magic); if (magic == NBD_OPTS_MAGIC) { uint32_t clientflags = 0; uint16_t globalflags; bool fixedNewStyle = false; if (nbd_read(ioc, &globalflags, sizeof(globalflags), errp) < 0) { error_prepend(errp, "Failed to read server flags"); globalflags = be16_to_cpu(globalflags); trace_nbd_receive_negotiate_server_flags(globalflags); if (globalflags & NBD_FLAG_FIXED_NEWSTYLE) { fixedNewStyle = true; clientflags |= NBD_FLAG_C_FIXED_NEWSTYLE; if (globalflags & NBD_FLAG_NO_ZEROES) { zeroes = false; clientflags |= NBD_FLAG_C_NO_ZEROES; clientflags = cpu_to_be32(clientflags); if (nbd_write(ioc, &clientflags, sizeof(clientflags), errp) < 0) { error_prepend(errp, "Failed to send clientflags field"); if (tlscreds) { if (fixedNewStyle) { *outioc = nbd_receive_starttls(ioc, tlscreds, hostname, errp); if (!*outioc) { ioc = *outioc; } else { error_setg(errp, "Server does not support STARTTLS"); if (!name) { trace_nbd_receive_negotiate_default_name(); name = ""; if (fixedNewStyle) { int result; result = nbd_opt_go(ioc, name, info, errp); if (result > 0) { return 0; if (nbd_receive_query_exports(ioc, name, errp) < 0) { if (nbd_send_option_request(ioc, NBD_OPT_EXPORT_NAME, -1, name, errp) < 0) { if (nbd_read(ioc, &info->size, sizeof(info->size), errp) < 0) { error_prepend(errp, "Failed to read export length"); be64_to_cpus(&info->size); if (nbd_read(ioc, &info->flags, sizeof(info->flags), errp) < 0) { error_prepend(errp, "Failed to read export flags"); be16_to_cpus(&info->flags); } else if (magic == NBD_CLIENT_MAGIC) { uint32_t oldflags; if (name) { error_setg(errp, "Server does not support export names"); if (tlscreds) { error_setg(errp, "Server does not support STARTTLS"); if (nbd_read(ioc, &info->size, sizeof(info->size), errp) < 0) { error_prepend(errp, "Failed to read export length"); be64_to_cpus(&info->size); if (nbd_read(ioc, &oldflags, sizeof(oldflags), errp) < 0) { error_prepend(errp, "Failed to read export flags"); be32_to_cpus(&oldflags); if (oldflags & ~0xffff) { error_setg(errp, "Unexpected export flags %0x" PRIx32, oldflags); info->flags = oldflags; } else { error_setg(errp, "Bad magic received"); trace_nbd_receive_negotiate_size_flags(info->size, info->flags); if (zeroes && nbd_drop(ioc, 124, errp) < 0) { error_prepend(errp, "Failed to read reserved block"); rc = 0; fail: return rc;
{ "code": [ " } else {" ], "line_no": [ 101 ] }
int FUNC_0(QIOChannel *VAR_0, const char *VAR_1, QCryptoTLSCreds *VAR_2, const char *VAR_3, QIOChannel **VAR_4, NBDExportInfo *VAR_5, Error **VAR_6) { char VAR_7[256]; uint64_t magic; int VAR_8; bool zeroes = true; bool structured_reply = VAR_5->structured_reply; trace_nbd_receive_negotiate(VAR_2, VAR_3 ? VAR_3 : "<null>"); VAR_5->structured_reply = false; VAR_8 = -EINVAL; if (VAR_4) { *VAR_4 = NULL; if (VAR_2 && !VAR_4) { error_setg(VAR_6, "Output I/O channel required for TLS"); if (nbd_read(VAR_0, VAR_7, 8, VAR_6) < 0) { error_prepend(VAR_6, "Failed to read data"); VAR_7[8] = '\0'; if (strlen(VAR_7) == 0) { error_setg(VAR_6, "Server connection closed unexpectedly"); magic = ldq_be_p(VAR_7); trace_nbd_receive_negotiate_magic(magic); if (memcmp(VAR_7, "NBDMAGIC", 8) != 0) { error_setg(VAR_6, "Invalid magic received"); if (nbd_read(VAR_0, &magic, sizeof(magic), VAR_6) < 0) { error_prepend(VAR_6, "Failed to read magic"); magic = be64_to_cpu(magic); trace_nbd_receive_negotiate_magic(magic); if (magic == NBD_OPTS_MAGIC) { uint32_t clientflags = 0; uint16_t globalflags; bool fixedNewStyle = false; if (nbd_read(VAR_0, &globalflags, sizeof(globalflags), VAR_6) < 0) { error_prepend(VAR_6, "Failed to read server flags"); globalflags = be16_to_cpu(globalflags); trace_nbd_receive_negotiate_server_flags(globalflags); if (globalflags & NBD_FLAG_FIXED_NEWSTYLE) { fixedNewStyle = true; clientflags |= NBD_FLAG_C_FIXED_NEWSTYLE; if (globalflags & NBD_FLAG_NO_ZEROES) { zeroes = false; clientflags |= NBD_FLAG_C_NO_ZEROES; clientflags = cpu_to_be32(clientflags); if (nbd_write(VAR_0, &clientflags, sizeof(clientflags), VAR_6) < 0) { error_prepend(VAR_6, "Failed to send clientflags field"); if (VAR_2) { if (fixedNewStyle) { *VAR_4 = nbd_receive_starttls(VAR_0, VAR_2, VAR_3, VAR_6); if (!*VAR_4) { VAR_0 = *VAR_4; } else { error_setg(VAR_6, "Server does not support STARTTLS"); if (!VAR_1) { trace_nbd_receive_negotiate_default_name(); VAR_1 = ""; if (fixedNewStyle) { int VAR_9; VAR_9 = nbd_opt_go(VAR_0, VAR_1, VAR_5, VAR_6); if (VAR_9 > 0) { return 0; if (nbd_receive_query_exports(VAR_0, VAR_1, VAR_6) < 0) { if (nbd_send_option_request(VAR_0, NBD_OPT_EXPORT_NAME, -1, VAR_1, VAR_6) < 0) { if (nbd_read(VAR_0, &VAR_5->size, sizeof(VAR_5->size), VAR_6) < 0) { error_prepend(VAR_6, "Failed to read export length"); be64_to_cpus(&VAR_5->size); if (nbd_read(VAR_0, &VAR_5->flags, sizeof(VAR_5->flags), VAR_6) < 0) { error_prepend(VAR_6, "Failed to read export flags"); be16_to_cpus(&VAR_5->flags); } else if (magic == NBD_CLIENT_MAGIC) { uint32_t oldflags; if (VAR_1) { error_setg(VAR_6, "Server does not support export names"); if (VAR_2) { error_setg(VAR_6, "Server does not support STARTTLS"); if (nbd_read(VAR_0, &VAR_5->size, sizeof(VAR_5->size), VAR_6) < 0) { error_prepend(VAR_6, "Failed to read export length"); be64_to_cpus(&VAR_5->size); if (nbd_read(VAR_0, &oldflags, sizeof(oldflags), VAR_6) < 0) { error_prepend(VAR_6, "Failed to read export flags"); be32_to_cpus(&oldflags); if (oldflags & ~0xffff) { error_setg(VAR_6, "Unexpected export flags %0x" PRIx32, oldflags); VAR_5->flags = oldflags; } else { error_setg(VAR_6, "Bad magic received"); trace_nbd_receive_negotiate_size_flags(VAR_5->size, VAR_5->flags); if (zeroes && nbd_drop(VAR_0, 124, VAR_6) < 0) { error_prepend(VAR_6, "Failed to read reserved block"); VAR_8 = 0; fail: return VAR_8;
[ "int FUNC_0(QIOChannel *VAR_0, const char *VAR_1,\nQCryptoTLSCreds *VAR_2, const char *VAR_3,\nQIOChannel **VAR_4, NBDExportInfo *VAR_5,\nError **VAR_6)\n{", "char VAR_7[256];", "uint64_t magic;", "int VAR_8;", "bool zeroes = true;", "bool structured_reply = VAR_5->structured_reply;", "trace_nbd_receive_negotiate(VAR_2, VAR_3 ? VAR_3 : \"<null>\");", "VAR_5->structured_reply = false;", "VAR_8 = -EINVAL;", "if (VAR_4) {", "*VAR_4 = NULL;", "if (VAR_2 && !VAR_4) {", "error_setg(VAR_6, \"Output I/O channel required for TLS\");", "if (nbd_read(VAR_0, VAR_7, 8, VAR_6) < 0) {", "error_prepend(VAR_6, \"Failed to read data\");", "VAR_7[8] = '\\0';", "if (strlen(VAR_7) == 0) {", "error_setg(VAR_6, \"Server connection closed unexpectedly\");", "magic = ldq_be_p(VAR_7);", "trace_nbd_receive_negotiate_magic(magic);", "if (memcmp(VAR_7, \"NBDMAGIC\", 8) != 0) {", "error_setg(VAR_6, \"Invalid magic received\");", "if (nbd_read(VAR_0, &magic, sizeof(magic), VAR_6) < 0) {", "error_prepend(VAR_6, \"Failed to read magic\");", "magic = be64_to_cpu(magic);", "trace_nbd_receive_negotiate_magic(magic);", "if (magic == NBD_OPTS_MAGIC) {", "uint32_t clientflags = 0;", "uint16_t globalflags;", "bool fixedNewStyle = false;", "if (nbd_read(VAR_0, &globalflags, sizeof(globalflags), VAR_6) < 0) {", "error_prepend(VAR_6, \"Failed to read server flags\");", "globalflags = be16_to_cpu(globalflags);", "trace_nbd_receive_negotiate_server_flags(globalflags);", "if (globalflags & NBD_FLAG_FIXED_NEWSTYLE) {", "fixedNewStyle = true;", "clientflags |= NBD_FLAG_C_FIXED_NEWSTYLE;", "if (globalflags & NBD_FLAG_NO_ZEROES) {", "zeroes = false;", "clientflags |= NBD_FLAG_C_NO_ZEROES;", "clientflags = cpu_to_be32(clientflags);", "if (nbd_write(VAR_0, &clientflags, sizeof(clientflags), VAR_6) < 0) {", "error_prepend(VAR_6, \"Failed to send clientflags field\");", "if (VAR_2) {", "if (fixedNewStyle) {", "*VAR_4 = nbd_receive_starttls(VAR_0, VAR_2, VAR_3, VAR_6);", "if (!*VAR_4) {", "VAR_0 = *VAR_4;", "} else {", "error_setg(VAR_6, \"Server does not support STARTTLS\");", "if (!VAR_1) {", "trace_nbd_receive_negotiate_default_name();", "VAR_1 = \"\";", "if (fixedNewStyle) {", "int VAR_9;", "VAR_9 = nbd_opt_go(VAR_0, VAR_1, VAR_5, VAR_6);", "if (VAR_9 > 0) {", "return 0;", "if (nbd_receive_query_exports(VAR_0, VAR_1, VAR_6) < 0) {", "if (nbd_send_option_request(VAR_0, NBD_OPT_EXPORT_NAME, -1, VAR_1,\nVAR_6) < 0) {", "if (nbd_read(VAR_0, &VAR_5->size, sizeof(VAR_5->size), VAR_6) < 0) {", "error_prepend(VAR_6, \"Failed to read export length\");", "be64_to_cpus(&VAR_5->size);", "if (nbd_read(VAR_0, &VAR_5->flags, sizeof(VAR_5->flags), VAR_6) < 0) {", "error_prepend(VAR_6, \"Failed to read export flags\");", "be16_to_cpus(&VAR_5->flags);", "} else if (magic == NBD_CLIENT_MAGIC) {", "uint32_t oldflags;", "if (VAR_1) {", "error_setg(VAR_6, \"Server does not support export names\");", "if (VAR_2) {", "error_setg(VAR_6, \"Server does not support STARTTLS\");", "if (nbd_read(VAR_0, &VAR_5->size, sizeof(VAR_5->size), VAR_6) < 0) {", "error_prepend(VAR_6, \"Failed to read export length\");", "be64_to_cpus(&VAR_5->size);", "if (nbd_read(VAR_0, &oldflags, sizeof(oldflags), VAR_6) < 0) {", "error_prepend(VAR_6, \"Failed to read export flags\");", "be32_to_cpus(&oldflags);", "if (oldflags & ~0xffff) {", "error_setg(VAR_6, \"Unexpected export flags %0x\" PRIx32, oldflags);", "VAR_5->flags = oldflags;", "} else {", "error_setg(VAR_6, \"Bad magic received\");", "trace_nbd_receive_negotiate_size_flags(VAR_5->size, VAR_5->flags);", "if (zeroes && nbd_drop(VAR_0, 124, VAR_6) < 0) {", "error_prepend(VAR_6, \"Failed to read reserved block\");", "VAR_8 = 0;", "fail:\nreturn VAR_8;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 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 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60 ], [ 66 ], [ 67 ], [ 68 ], [ 75 ], [ 77, 78 ], [ 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 ] ]
8,351
static int get_codec_data(AVIOContext *pb, AVStream *vst, AVStream *ast, int myth) { nuv_frametype frametype; if (!vst && !myth) return 1; // no codec data needed while (!pb->eof_reached) { int size, subtype; frametype = avio_r8(pb); switch (frametype) { case NUV_EXTRADATA: subtype = avio_r8(pb); avio_skip(pb, 6); size = PKTSIZE(avio_rl32(pb)); if (vst && subtype == 'R') { vst->codec->extradata_size = size; vst->codec->extradata = av_malloc(size); avio_read(pb, vst->codec->extradata, size); size = 0; if (!myth) return 1; } break; case NUV_MYTHEXT: avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); if (size != 128 * 4) break; avio_rl32(pb); // version if (vst) { vst->codec->codec_tag = avio_rl32(pb); vst->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag); if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G')) vst->codec->codec_id = AV_CODEC_ID_NUV; } else avio_skip(pb, 4); if (ast) { int id; ast->codec->codec_tag = avio_rl32(pb); ast->codec->sample_rate = avio_rl32(pb); ast->codec->bits_per_coded_sample = avio_rl32(pb); ast->codec->channels = avio_rl32(pb); ast->codec->channel_layout = 0; id = ff_wav_codec_get_id(ast->codec->codec_tag, ast->codec->bits_per_coded_sample); if (id == AV_CODEC_ID_NONE) { id = ff_codec_get_id(nuv_audio_tags, ast->codec->codec_tag); if (id == AV_CODEC_ID_PCM_S16LE) id = ff_get_pcm_codec_id(ast->codec->bits_per_coded_sample, 0, 0, ~1); } ast->codec->codec_id = id; ast->need_parsing = AVSTREAM_PARSE_FULL; } else avio_skip(pb, 4 * 4); size -= 6 * 4; avio_skip(pb, size); return 1; case NUV_SEEKP: size = 11; break; default: avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); break; } avio_skip(pb, size); } return 0; }
true
FFmpeg
ab87d9b6677c5757d467f532e681b056d3e77e6b
static int get_codec_data(AVIOContext *pb, AVStream *vst, AVStream *ast, int myth) { nuv_frametype frametype; if (!vst && !myth) return 1; while (!pb->eof_reached) { int size, subtype; frametype = avio_r8(pb); switch (frametype) { case NUV_EXTRADATA: subtype = avio_r8(pb); avio_skip(pb, 6); size = PKTSIZE(avio_rl32(pb)); if (vst && subtype == 'R') { vst->codec->extradata_size = size; vst->codec->extradata = av_malloc(size); avio_read(pb, vst->codec->extradata, size); size = 0; if (!myth) return 1; } break; case NUV_MYTHEXT: avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); if (size != 128 * 4) break; avio_rl32(pb); if (vst) { vst->codec->codec_tag = avio_rl32(pb); vst->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag); if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G')) vst->codec->codec_id = AV_CODEC_ID_NUV; } else avio_skip(pb, 4); if (ast) { int id; ast->codec->codec_tag = avio_rl32(pb); ast->codec->sample_rate = avio_rl32(pb); ast->codec->bits_per_coded_sample = avio_rl32(pb); ast->codec->channels = avio_rl32(pb); ast->codec->channel_layout = 0; id = ff_wav_codec_get_id(ast->codec->codec_tag, ast->codec->bits_per_coded_sample); if (id == AV_CODEC_ID_NONE) { id = ff_codec_get_id(nuv_audio_tags, ast->codec->codec_tag); if (id == AV_CODEC_ID_PCM_S16LE) id = ff_get_pcm_codec_id(ast->codec->bits_per_coded_sample, 0, 0, ~1); } ast->codec->codec_id = id; ast->need_parsing = AVSTREAM_PARSE_FULL; } else avio_skip(pb, 4 * 4); size -= 6 * 4; avio_skip(pb, size); return 1; case NUV_SEEKP: size = 11; break; default: avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); break; } avio_skip(pb, size); } return 0; }
{ "code": [ " vst->codec->extradata = av_malloc(size);", " return 1;", " return 1;" ], "line_no": [ 37, 45, 131 ] }
static int FUNC_0(AVIOContext *VAR_0, AVStream *VAR_1, AVStream *VAR_2, int VAR_3) { nuv_frametype frametype; if (!VAR_1 && !VAR_3) return 1; while (!VAR_0->eof_reached) { int VAR_4, VAR_5; frametype = avio_r8(VAR_0); switch (frametype) { case NUV_EXTRADATA: VAR_5 = avio_r8(VAR_0); avio_skip(VAR_0, 6); VAR_4 = PKTSIZE(avio_rl32(VAR_0)); if (VAR_1 && VAR_5 == 'R') { VAR_1->codec->extradata_size = VAR_4; VAR_1->codec->extradata = av_malloc(VAR_4); avio_read(VAR_0, VAR_1->codec->extradata, VAR_4); VAR_4 = 0; if (!VAR_3) return 1; } break; case NUV_MYTHEXT: avio_skip(VAR_0, 7); VAR_4 = PKTSIZE(avio_rl32(VAR_0)); if (VAR_4 != 128 * 4) break; avio_rl32(VAR_0); if (VAR_1) { VAR_1->codec->codec_tag = avio_rl32(VAR_0); VAR_1->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, VAR_1->codec->codec_tag); if (VAR_1->codec->codec_tag == MKTAG('R', 'J', 'P', 'G')) VAR_1->codec->codec_id = AV_CODEC_ID_NUV; } else avio_skip(VAR_0, 4); if (VAR_2) { int VAR_6; VAR_2->codec->codec_tag = avio_rl32(VAR_0); VAR_2->codec->sample_rate = avio_rl32(VAR_0); VAR_2->codec->bits_per_coded_sample = avio_rl32(VAR_0); VAR_2->codec->channels = avio_rl32(VAR_0); VAR_2->codec->channel_layout = 0; VAR_6 = ff_wav_codec_get_id(VAR_2->codec->codec_tag, VAR_2->codec->bits_per_coded_sample); if (VAR_6 == AV_CODEC_ID_NONE) { VAR_6 = ff_codec_get_id(nuv_audio_tags, VAR_2->codec->codec_tag); if (VAR_6 == AV_CODEC_ID_PCM_S16LE) VAR_6 = ff_get_pcm_codec_id(VAR_2->codec->bits_per_coded_sample, 0, 0, ~1); } VAR_2->codec->codec_id = VAR_6; VAR_2->need_parsing = AVSTREAM_PARSE_FULL; } else avio_skip(VAR_0, 4 * 4); VAR_4 -= 6 * 4; avio_skip(VAR_0, VAR_4); return 1; case NUV_SEEKP: VAR_4 = 11; break; default: avio_skip(VAR_0, 7); VAR_4 = PKTSIZE(avio_rl32(VAR_0)); break; } avio_skip(VAR_0, VAR_4); } return 0; }
[ "static int FUNC_0(AVIOContext *VAR_0, AVStream *VAR_1,\nAVStream *VAR_2, int VAR_3)\n{", "nuv_frametype frametype;", "if (!VAR_1 && !VAR_3)\nreturn 1;", "while (!VAR_0->eof_reached) {", "int VAR_4, VAR_5;", "frametype = avio_r8(VAR_0);", "switch (frametype) {", "case NUV_EXTRADATA:\nVAR_5 = avio_r8(VAR_0);", "avio_skip(VAR_0, 6);", "VAR_4 = PKTSIZE(avio_rl32(VAR_0));", "if (VAR_1 && VAR_5 == 'R') {", "VAR_1->codec->extradata_size = VAR_4;", "VAR_1->codec->extradata = av_malloc(VAR_4);", "avio_read(VAR_0, VAR_1->codec->extradata, VAR_4);", "VAR_4 = 0;", "if (!VAR_3)\nreturn 1;", "}", "break;", "case NUV_MYTHEXT:\navio_skip(VAR_0, 7);", "VAR_4 = PKTSIZE(avio_rl32(VAR_0));", "if (VAR_4 != 128 * 4)\nbreak;", "avio_rl32(VAR_0);", "if (VAR_1) {", "VAR_1->codec->codec_tag = avio_rl32(VAR_0);", "VAR_1->codec->codec_id =\nff_codec_get_id(ff_codec_bmp_tags, VAR_1->codec->codec_tag);", "if (VAR_1->codec->codec_tag == MKTAG('R', 'J', 'P', 'G'))\nVAR_1->codec->codec_id = AV_CODEC_ID_NUV;", "} else", "avio_skip(VAR_0, 4);", "if (VAR_2) {", "int VAR_6;", "VAR_2->codec->codec_tag = avio_rl32(VAR_0);", "VAR_2->codec->sample_rate = avio_rl32(VAR_0);", "VAR_2->codec->bits_per_coded_sample = avio_rl32(VAR_0);", "VAR_2->codec->channels = avio_rl32(VAR_0);", "VAR_2->codec->channel_layout = 0;", "VAR_6 = ff_wav_codec_get_id(VAR_2->codec->codec_tag,\nVAR_2->codec->bits_per_coded_sample);", "if (VAR_6 == AV_CODEC_ID_NONE) {", "VAR_6 = ff_codec_get_id(nuv_audio_tags, VAR_2->codec->codec_tag);", "if (VAR_6 == AV_CODEC_ID_PCM_S16LE)\nVAR_6 = ff_get_pcm_codec_id(VAR_2->codec->bits_per_coded_sample,\n0, 0, ~1);", "}", "VAR_2->codec->codec_id = VAR_6;", "VAR_2->need_parsing = AVSTREAM_PARSE_FULL;", "} else", "avio_skip(VAR_0, 4 * 4);", "VAR_4 -= 6 * 4;", "avio_skip(VAR_0, VAR_4);", "return 1;", "case NUV_SEEKP:\nVAR_4 = 11;", "break;", "default:\navio_skip(VAR_0, 7);", "VAR_4 = PKTSIZE(avio_rl32(VAR_0));", "break;", "}", "avio_skip(VAR_0, VAR_4);", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 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 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107, 109, 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ] ]