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
15,068
static int compare_litqobj_to_qobj(LiteralQObject *lhs, QObject *rhs) { if (lhs->type != qobject_type(rhs)) { return 0; } switch (lhs->type) { case QTYPE_QINT: return lhs->value.qint == qint_get_int(qobject_to_qint(rhs)); case QTYPE_QSTRING: return (strcmp(lhs->value.qstr, qstring_get_str(qobject_to_qstring(rhs))) == 0); case QTYPE_QDICT: { int i; for (i = 0; lhs->value.qdict[i].key; i++) { QObject *obj = qdict_get(qobject_to_qdict(rhs), lhs->value.qdict[i].key); if (!compare_litqobj_to_qobj(&lhs->value.qdict[i].value, obj)) { return 0; } } return 1; } case QTYPE_QLIST: { QListCompareHelper helper; helper.index = 0; helper.objs = lhs->value.qlist; helper.result = 1; qlist_iter(qobject_to_qlist(rhs), compare_helper, &helper); return helper.result; } default: break; } return 0; }
false
qemu
9eaaf971683c99ed197fa1b7d1a3ca9baabfb3ee
static int compare_litqobj_to_qobj(LiteralQObject *lhs, QObject *rhs) { if (lhs->type != qobject_type(rhs)) { return 0; } switch (lhs->type) { case QTYPE_QINT: return lhs->value.qint == qint_get_int(qobject_to_qint(rhs)); case QTYPE_QSTRING: return (strcmp(lhs->value.qstr, qstring_get_str(qobject_to_qstring(rhs))) == 0); case QTYPE_QDICT: { int i; for (i = 0; lhs->value.qdict[i].key; i++) { QObject *obj = qdict_get(qobject_to_qdict(rhs), lhs->value.qdict[i].key); if (!compare_litqobj_to_qobj(&lhs->value.qdict[i].value, obj)) { return 0; } } return 1; } case QTYPE_QLIST: { QListCompareHelper helper; helper.index = 0; helper.objs = lhs->value.qlist; helper.result = 1; qlist_iter(qobject_to_qlist(rhs), compare_helper, &helper); return helper.result; } default: break; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(LiteralQObject *VAR_0, QObject *VAR_1) { if (VAR_0->type != qobject_type(VAR_1)) { return 0; } switch (VAR_0->type) { case QTYPE_QINT: return VAR_0->value.qint == qint_get_int(qobject_to_qint(VAR_1)); case QTYPE_QSTRING: return (strcmp(VAR_0->value.qstr, qstring_get_str(qobject_to_qstring(VAR_1))) == 0); case QTYPE_QDICT: { int VAR_2; for (VAR_2 = 0; VAR_0->value.qdict[VAR_2].key; VAR_2++) { QObject *obj = qdict_get(qobject_to_qdict(VAR_1), VAR_0->value.qdict[VAR_2].key); if (!FUNC_0(&VAR_0->value.qdict[VAR_2].value, obj)) { return 0; } } return 1; } case QTYPE_QLIST: { QListCompareHelper helper; helper.index = 0; helper.objs = VAR_0->value.qlist; helper.result = 1; qlist_iter(qobject_to_qlist(VAR_1), compare_helper, &helper); return helper.result; } default: break; } return 0; }
[ "static int FUNC_0(LiteralQObject *VAR_0, QObject *VAR_1)\n{", "if (VAR_0->type != qobject_type(VAR_1)) {", "return 0;", "}", "switch (VAR_0->type) {", "case QTYPE_QINT:\nreturn VAR_0->value.qint == qint_get_int(qobject_to_qint(VAR_1));", "case QTYPE_QSTRING:\nreturn (strcmp(VAR_0->value.qstr, qstring_get_str(qobject_to_qstring(VAR_1))) == 0);", "case QTYPE_QDICT: {", "int VAR_2;", "for (VAR_2 = 0; VAR_0->value.qdict[VAR_2].key; VAR_2++) {", "QObject *obj = qdict_get(qobject_to_qdict(VAR_1), VAR_0->value.qdict[VAR_2].key);", "if (!FUNC_0(&VAR_0->value.qdict[VAR_2].value, obj)) {", "return 0;", "}", "}", "return 1;", "}", "case QTYPE_QLIST: {", "QListCompareHelper helper;", "helper.index = 0;", "helper.objs = VAR_0->value.qlist;", "helper.result = 1;", "qlist_iter(qobject_to_qlist(VAR_1), compare_helper, &helper);", "return helper.result;", "}", "default:\nbreak;", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ], [ 71, 73 ], [ 75 ], [ 79 ], [ 81 ] ]
15,070
static void trigger_prot_fault(CPUS390XState *env, target_ulong vaddr, uint64_t asc, int rw, bool exc) { uint64_t tec; tec = vaddr | (rw == MMU_DATA_STORE ? FS_WRITE : FS_READ) | 4 | asc >> 46; DPRINTF("%s: trans_exc_code=%016" PRIx64 "\n", __func__, tec); if (!exc) { return; } trigger_access_exception(env, PGM_PROTECTION, ILEN_LATER_INC, tec); }
false
qemu
becf8217deb2afc347d5172d9f30c8a8964b8b27
static void trigger_prot_fault(CPUS390XState *env, target_ulong vaddr, uint64_t asc, int rw, bool exc) { uint64_t tec; tec = vaddr | (rw == MMU_DATA_STORE ? FS_WRITE : FS_READ) | 4 | asc >> 46; DPRINTF("%s: trans_exc_code=%016" PRIx64 "\n", __func__, tec); if (!exc) { return; } trigger_access_exception(env, PGM_PROTECTION, ILEN_LATER_INC, tec); }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUS390XState *VAR_0, target_ulong VAR_1, uint64_t VAR_2, int VAR_3, bool VAR_4) { uint64_t tec; tec = VAR_1 | (VAR_3 == MMU_DATA_STORE ? FS_WRITE : FS_READ) | 4 | VAR_2 >> 46; DPRINTF("%s: trans_exc_code=%016" PRIx64 "\n", __func__, tec); if (!VAR_4) { return; } trigger_access_exception(VAR_0, PGM_PROTECTION, ILEN_LATER_INC, tec); }
[ "static void FUNC_0(CPUS390XState *VAR_0, target_ulong VAR_1,\nuint64_t VAR_2, int VAR_3, bool VAR_4)\n{", "uint64_t tec;", "tec = VAR_1 | (VAR_3 == MMU_DATA_STORE ? FS_WRITE : FS_READ) | 4 | VAR_2 >> 46;", "DPRINTF(\"%s: trans_exc_code=%016\" PRIx64 \"\\n\", __func__, tec);", "if (!VAR_4) {", "return;", "}", "trigger_access_exception(VAR_0, PGM_PROTECTION, ILEN_LATER_INC, tec);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ] ]
15,071
static int check_oflag_copied(BlockDriverState *bs, BdrvCheckResult *res) { BDRVQcowState *s = bs->opaque; uint64_t *l2_table = qemu_blockalign(bs, s->cluster_size); int ret; int refcount; int i, j; for (i = 0; i < s->l1_size; i++) { uint64_t l1_entry = s->l1_table[i]; uint64_t l2_offset = l1_entry & L1E_OFFSET_MASK; if (!l2_offset) { continue; } refcount = get_refcount(bs, l2_offset >> s->cluster_bits); if (refcount < 0) { /* don't print message nor increment check_errors */ continue; } if ((refcount == 1) != ((l1_entry & QCOW_OFLAG_COPIED) != 0)) { fprintf(stderr, "ERROR OFLAG_COPIED L2 cluster: l1_index=%d " "l1_entry=%" PRIx64 " refcount=%d\n", i, l1_entry, refcount); res->corruptions++; } ret = bdrv_pread(bs->file, l2_offset, l2_table, s->l2_size * sizeof(uint64_t)); if (ret < 0) { fprintf(stderr, "ERROR: Could not read L2 table: %s\n", strerror(-ret)); res->check_errors++; goto fail; } for (j = 0; j < s->l2_size; j++) { uint64_t l2_entry = be64_to_cpu(l2_table[j]); uint64_t data_offset = l2_entry & L2E_OFFSET_MASK; int cluster_type = qcow2_get_cluster_type(l2_entry); if ((cluster_type == QCOW2_CLUSTER_NORMAL) || ((cluster_type == QCOW2_CLUSTER_ZERO) && (data_offset != 0))) { refcount = get_refcount(bs, data_offset >> s->cluster_bits); if (refcount < 0) { /* don't print message nor increment check_errors */ continue; } if ((refcount == 1) != ((l2_entry & QCOW_OFLAG_COPIED) != 0)) { fprintf(stderr, "ERROR OFLAG_COPIED data cluster: " "l2_entry=%" PRIx64 " refcount=%d\n", l2_entry, refcount); res->corruptions++; } } } } ret = 0; fail: qemu_vfree(l2_table); return ret; }
false
qemu
e23e400ec62a03dea58ddb38479b4f1ef86f556d
static int check_oflag_copied(BlockDriverState *bs, BdrvCheckResult *res) { BDRVQcowState *s = bs->opaque; uint64_t *l2_table = qemu_blockalign(bs, s->cluster_size); int ret; int refcount; int i, j; for (i = 0; i < s->l1_size; i++) { uint64_t l1_entry = s->l1_table[i]; uint64_t l2_offset = l1_entry & L1E_OFFSET_MASK; if (!l2_offset) { continue; } refcount = get_refcount(bs, l2_offset >> s->cluster_bits); if (refcount < 0) { continue; } if ((refcount == 1) != ((l1_entry & QCOW_OFLAG_COPIED) != 0)) { fprintf(stderr, "ERROR OFLAG_COPIED L2 cluster: l1_index=%d " "l1_entry=%" PRIx64 " refcount=%d\n", i, l1_entry, refcount); res->corruptions++; } ret = bdrv_pread(bs->file, l2_offset, l2_table, s->l2_size * sizeof(uint64_t)); if (ret < 0) { fprintf(stderr, "ERROR: Could not read L2 table: %s\n", strerror(-ret)); res->check_errors++; goto fail; } for (j = 0; j < s->l2_size; j++) { uint64_t l2_entry = be64_to_cpu(l2_table[j]); uint64_t data_offset = l2_entry & L2E_OFFSET_MASK; int cluster_type = qcow2_get_cluster_type(l2_entry); if ((cluster_type == QCOW2_CLUSTER_NORMAL) || ((cluster_type == QCOW2_CLUSTER_ZERO) && (data_offset != 0))) { refcount = get_refcount(bs, data_offset >> s->cluster_bits); if (refcount < 0) { continue; } if ((refcount == 1) != ((l2_entry & QCOW_OFLAG_COPIED) != 0)) { fprintf(stderr, "ERROR OFLAG_COPIED data cluster: " "l2_entry=%" PRIx64 " refcount=%d\n", l2_entry, refcount); res->corruptions++; } } } } ret = 0; fail: qemu_vfree(l2_table); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1) { BDRVQcowState *s = VAR_0->opaque; uint64_t *l2_table = qemu_blockalign(VAR_0, s->cluster_size); int VAR_2; int VAR_3; int VAR_4, VAR_5; for (VAR_4 = 0; VAR_4 < s->l1_size; VAR_4++) { uint64_t l1_entry = s->l1_table[VAR_4]; uint64_t l2_offset = l1_entry & L1E_OFFSET_MASK; if (!l2_offset) { continue; } VAR_3 = get_refcount(VAR_0, l2_offset >> s->cluster_bits); if (VAR_3 < 0) { continue; } if ((VAR_3 == 1) != ((l1_entry & QCOW_OFLAG_COPIED) != 0)) { fprintf(stderr, "ERROR OFLAG_COPIED L2 cluster: l1_index=%d " "l1_entry=%" PRIx64 " VAR_3=%d\n", VAR_4, l1_entry, VAR_3); VAR_1->corruptions++; } VAR_2 = bdrv_pread(VAR_0->file, l2_offset, l2_table, s->l2_size * sizeof(uint64_t)); if (VAR_2 < 0) { fprintf(stderr, "ERROR: Could not read L2 table: %s\n", strerror(-VAR_2)); VAR_1->check_errors++; goto fail; } for (VAR_5 = 0; VAR_5 < s->l2_size; VAR_5++) { uint64_t l2_entry = be64_to_cpu(l2_table[VAR_5]); uint64_t data_offset = l2_entry & L2E_OFFSET_MASK; int cluster_type = qcow2_get_cluster_type(l2_entry); if ((cluster_type == QCOW2_CLUSTER_NORMAL) || ((cluster_type == QCOW2_CLUSTER_ZERO) && (data_offset != 0))) { VAR_3 = get_refcount(VAR_0, data_offset >> s->cluster_bits); if (VAR_3 < 0) { continue; } if ((VAR_3 == 1) != ((l2_entry & QCOW_OFLAG_COPIED) != 0)) { fprintf(stderr, "ERROR OFLAG_COPIED data cluster: " "l2_entry=%" PRIx64 " VAR_3=%d\n", l2_entry, VAR_3); VAR_1->corruptions++; } } } } VAR_2 = 0; fail: qemu_vfree(l2_table); return VAR_2; }
[ "static int FUNC_0(BlockDriverState *VAR_0, BdrvCheckResult *VAR_1)\n{", "BDRVQcowState *s = VAR_0->opaque;", "uint64_t *l2_table = qemu_blockalign(VAR_0, s->cluster_size);", "int VAR_2;", "int VAR_3;", "int VAR_4, VAR_5;", "for (VAR_4 = 0; VAR_4 < s->l1_size; VAR_4++) {", "uint64_t l1_entry = s->l1_table[VAR_4];", "uint64_t l2_offset = l1_entry & L1E_OFFSET_MASK;", "if (!l2_offset) {", "continue;", "}", "VAR_3 = get_refcount(VAR_0, l2_offset >> s->cluster_bits);", "if (VAR_3 < 0) {", "continue;", "}", "if ((VAR_3 == 1) != ((l1_entry & QCOW_OFLAG_COPIED) != 0)) {", "fprintf(stderr, \"ERROR OFLAG_COPIED L2 cluster: l1_index=%d \"\n\"l1_entry=%\" PRIx64 \" VAR_3=%d\\n\",\nVAR_4, l1_entry, VAR_3);", "VAR_1->corruptions++;", "}", "VAR_2 = bdrv_pread(VAR_0->file, l2_offset, l2_table,\ns->l2_size * sizeof(uint64_t));", "if (VAR_2 < 0) {", "fprintf(stderr, \"ERROR: Could not read L2 table: %s\\n\",\nstrerror(-VAR_2));", "VAR_1->check_errors++;", "goto fail;", "}", "for (VAR_5 = 0; VAR_5 < s->l2_size; VAR_5++) {", "uint64_t l2_entry = be64_to_cpu(l2_table[VAR_5]);", "uint64_t data_offset = l2_entry & L2E_OFFSET_MASK;", "int cluster_type = qcow2_get_cluster_type(l2_entry);", "if ((cluster_type == QCOW2_CLUSTER_NORMAL) ||\n((cluster_type == QCOW2_CLUSTER_ZERO) && (data_offset != 0))) {", "VAR_3 = get_refcount(VAR_0, data_offset >> s->cluster_bits);", "if (VAR_3 < 0) {", "continue;", "}", "if ((VAR_3 == 1) != ((l2_entry & QCOW_OFLAG_COPIED) != 0)) {", "fprintf(stderr, \"ERROR OFLAG_COPIED data cluster: \"\n\"l2_entry=%\" PRIx64 \" VAR_3=%d\\n\",\nl2_entry, VAR_3);", "VAR_1->corruptions++;", "}", "}", "}", "}", "VAR_2 = 0;", "fail:\nqemu_vfree(l2_table);", "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, 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 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 63, 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101, 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 119 ], [ 123, 125 ], [ 127 ], [ 129 ] ]
15,072
static int map_f(BlockBackend *blk, int argc, char **argv) { int64_t offset; int64_t nb_sectors, total_sectors; char s1[64]; int64_t num; int ret; const char *retstr; offset = 0; total_sectors = blk_nb_sectors(blk); if (total_sectors < 0) { error_report("Failed to query image length: %s", strerror(-total_sectors)); return 0; } nb_sectors = total_sectors; do { ret = map_is_allocated(blk_bs(blk), offset, nb_sectors, &num); if (ret < 0) { error_report("Failed to get allocation status: %s", strerror(-ret)); return 0; } else if (!num) { error_report("Unexpected end of image"); return 0; } retstr = ret ? " allocated" : "not allocated"; cvtstr(offset << 9ULL, s1, sizeof(s1)); printf("[% 24" PRId64 "] % 8" PRId64 "/% 8" PRId64 " sectors %s " "at offset %s (%d)\n", offset << 9ULL, num, nb_sectors, retstr, s1, ret); offset += num; nb_sectors -= num; } while (offset < total_sectors); return 0; }
false
qemu
6f3c90af3c50d4f839849c8ba9b6ba4e9a548c28
static int map_f(BlockBackend *blk, int argc, char **argv) { int64_t offset; int64_t nb_sectors, total_sectors; char s1[64]; int64_t num; int ret; const char *retstr; offset = 0; total_sectors = blk_nb_sectors(blk); if (total_sectors < 0) { error_report("Failed to query image length: %s", strerror(-total_sectors)); return 0; } nb_sectors = total_sectors; do { ret = map_is_allocated(blk_bs(blk), offset, nb_sectors, &num); if (ret < 0) { error_report("Failed to get allocation status: %s", strerror(-ret)); return 0; } else if (!num) { error_report("Unexpected end of image"); return 0; } retstr = ret ? " allocated" : "not allocated"; cvtstr(offset << 9ULL, s1, sizeof(s1)); printf("[% 24" PRId64 "] % 8" PRId64 "/% 8" PRId64 " sectors %s " "at offset %s (%d)\n", offset << 9ULL, num, nb_sectors, retstr, s1, ret); offset += num; nb_sectors -= num; } while (offset < total_sectors); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2) { int64_t offset; int64_t nb_sectors, total_sectors; char VAR_3[64]; int64_t num; int VAR_4; const char *VAR_5; offset = 0; total_sectors = blk_nb_sectors(VAR_0); if (total_sectors < 0) { error_report("Failed to query image length: %s", strerror(-total_sectors)); return 0; } nb_sectors = total_sectors; do { VAR_4 = map_is_allocated(blk_bs(VAR_0), offset, nb_sectors, &num); if (VAR_4 < 0) { error_report("Failed to get allocation status: %s", strerror(-VAR_4)); return 0; } else if (!num) { error_report("Unexpected end of image"); return 0; } VAR_5 = VAR_4 ? " allocated" : "not allocated"; cvtstr(offset << 9ULL, VAR_3, sizeof(VAR_3)); printf("[% 24" PRId64 "] % 8" PRId64 "/% 8" PRId64 " sectors %s " "at offset %s (%d)\n", offset << 9ULL, num, nb_sectors, VAR_5, VAR_3, VAR_4); offset += num; nb_sectors -= num; } while (offset < total_sectors); return 0; }
[ "static int FUNC_0(BlockBackend *VAR_0, int VAR_1, char **VAR_2)\n{", "int64_t offset;", "int64_t nb_sectors, total_sectors;", "char VAR_3[64];", "int64_t num;", "int VAR_4;", "const char *VAR_5;", "offset = 0;", "total_sectors = blk_nb_sectors(VAR_0);", "if (total_sectors < 0) {", "error_report(\"Failed to query image length: %s\",\nstrerror(-total_sectors));", "return 0;", "}", "nb_sectors = total_sectors;", "do {", "VAR_4 = map_is_allocated(blk_bs(VAR_0), offset, nb_sectors, &num);", "if (VAR_4 < 0) {", "error_report(\"Failed to get allocation status: %s\", strerror(-VAR_4));", "return 0;", "} else if (!num) {", "error_report(\"Unexpected end of image\");", "return 0;", "}", "VAR_5 = VAR_4 ? \" allocated\" : \"not allocated\";", "cvtstr(offset << 9ULL, VAR_3, sizeof(VAR_3));", "printf(\"[% 24\" PRId64 \"] % 8\" PRId64 \"/% 8\" PRId64 \" sectors %s \"\n\"at offset %s (%d)\\n\",\noffset << 9ULL, num, nb_sectors, VAR_5, VAR_3, VAR_4);", "offset += num;", "nb_sectors -= num;", "} while (offset < total_sectors);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63, 65, 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ] ]
15,073
fdctrl_t *fdctrl_init (qemu_irq irq, int dma_chann, int mem_mapped, target_phys_addr_t io_base, BlockDriverState **fds) { fdctrl_t *fdctrl; int io_mem; int i; FLOPPY_DPRINTF("init controller\n"); fdctrl = qemu_mallocz(sizeof(fdctrl_t)); if (!fdctrl) return NULL; fdctrl->fifo = qemu_memalign(512, FD_SECTOR_LEN); if (fdctrl->fifo == NULL) { qemu_free(fdctrl); return NULL; } fdctrl->result_timer = qemu_new_timer(vm_clock, fdctrl_result_timer, fdctrl); fdctrl->version = 0x90; /* Intel 82078 controller */ fdctrl->irq = irq; fdctrl->dma_chann = dma_chann; fdctrl->io_base = io_base; fdctrl->config = 0x60; /* Implicit seek, polling & FIFO enabled */ fdctrl->sun4m = 0; if (fdctrl->dma_chann != -1) { fdctrl->dma_en = 1; DMA_register_channel(dma_chann, &fdctrl_transfer_handler, fdctrl); } else { fdctrl->dma_en = 0; } for (i = 0; i < 2; i++) { fd_init(&fdctrl->drives[i], fds[i]); } fdctrl_reset(fdctrl, 0); fdctrl->state = FD_CTRL_ACTIVE; if (mem_mapped) { io_mem = cpu_register_io_memory(0, fdctrl_mem_read, fdctrl_mem_write, fdctrl); cpu_register_physical_memory(io_base, 0x08, io_mem); } else { register_ioport_read((uint32_t)io_base + 0x01, 5, 1, &fdctrl_read, fdctrl); register_ioport_read((uint32_t)io_base + 0x07, 1, 1, &fdctrl_read, fdctrl); register_ioport_write((uint32_t)io_base + 0x01, 5, 1, &fdctrl_write, fdctrl); register_ioport_write((uint32_t)io_base + 0x07, 1, 1, &fdctrl_write, fdctrl); } register_savevm("fdc", io_base, 1, fdc_save, fdc_load, fdctrl); qemu_register_reset(fdctrl_external_reset, fdctrl); for (i = 0; i < 2; i++) { fd_revalidate(&fdctrl->drives[i]); } return fdctrl; }
false
qemu
7c560456707bfe53eb1728fcde759be7d9418b62
fdctrl_t *fdctrl_init (qemu_irq irq, int dma_chann, int mem_mapped, target_phys_addr_t io_base, BlockDriverState **fds) { fdctrl_t *fdctrl; int io_mem; int i; FLOPPY_DPRINTF("init controller\n"); fdctrl = qemu_mallocz(sizeof(fdctrl_t)); if (!fdctrl) return NULL; fdctrl->fifo = qemu_memalign(512, FD_SECTOR_LEN); if (fdctrl->fifo == NULL) { qemu_free(fdctrl); return NULL; } fdctrl->result_timer = qemu_new_timer(vm_clock, fdctrl_result_timer, fdctrl); fdctrl->version = 0x90; fdctrl->irq = irq; fdctrl->dma_chann = dma_chann; fdctrl->io_base = io_base; fdctrl->config = 0x60; fdctrl->sun4m = 0; if (fdctrl->dma_chann != -1) { fdctrl->dma_en = 1; DMA_register_channel(dma_chann, &fdctrl_transfer_handler, fdctrl); } else { fdctrl->dma_en = 0; } for (i = 0; i < 2; i++) { fd_init(&fdctrl->drives[i], fds[i]); } fdctrl_reset(fdctrl, 0); fdctrl->state = FD_CTRL_ACTIVE; if (mem_mapped) { io_mem = cpu_register_io_memory(0, fdctrl_mem_read, fdctrl_mem_write, fdctrl); cpu_register_physical_memory(io_base, 0x08, io_mem); } else { register_ioport_read((uint32_t)io_base + 0x01, 5, 1, &fdctrl_read, fdctrl); register_ioport_read((uint32_t)io_base + 0x07, 1, 1, &fdctrl_read, fdctrl); register_ioport_write((uint32_t)io_base + 0x01, 5, 1, &fdctrl_write, fdctrl); register_ioport_write((uint32_t)io_base + 0x07, 1, 1, &fdctrl_write, fdctrl); } register_savevm("fdc", io_base, 1, fdc_save, fdc_load, fdctrl); qemu_register_reset(fdctrl_external_reset, fdctrl); for (i = 0; i < 2; i++) { fd_revalidate(&fdctrl->drives[i]); } return fdctrl; }
{ "code": [], "line_no": [] }
fdctrl_t *FUNC_0 (qemu_irq irq, int dma_chann, int mem_mapped, target_phys_addr_t io_base, BlockDriverState **fds) { fdctrl_t *fdctrl; int VAR_0; int VAR_1; FLOPPY_DPRINTF("init controller\n"); fdctrl = qemu_mallocz(sizeof(fdctrl_t)); if (!fdctrl) return NULL; fdctrl->fifo = qemu_memalign(512, FD_SECTOR_LEN); if (fdctrl->fifo == NULL) { qemu_free(fdctrl); return NULL; } fdctrl->result_timer = qemu_new_timer(vm_clock, fdctrl_result_timer, fdctrl); fdctrl->version = 0x90; fdctrl->irq = irq; fdctrl->dma_chann = dma_chann; fdctrl->io_base = io_base; fdctrl->config = 0x60; fdctrl->sun4m = 0; if (fdctrl->dma_chann != -1) { fdctrl->dma_en = 1; DMA_register_channel(dma_chann, &fdctrl_transfer_handler, fdctrl); } else { fdctrl->dma_en = 0; } for (VAR_1 = 0; VAR_1 < 2; VAR_1++) { fd_init(&fdctrl->drives[VAR_1], fds[VAR_1]); } fdctrl_reset(fdctrl, 0); fdctrl->state = FD_CTRL_ACTIVE; if (mem_mapped) { VAR_0 = cpu_register_io_memory(0, fdctrl_mem_read, fdctrl_mem_write, fdctrl); cpu_register_physical_memory(io_base, 0x08, VAR_0); } else { register_ioport_read((uint32_t)io_base + 0x01, 5, 1, &fdctrl_read, fdctrl); register_ioport_read((uint32_t)io_base + 0x07, 1, 1, &fdctrl_read, fdctrl); register_ioport_write((uint32_t)io_base + 0x01, 5, 1, &fdctrl_write, fdctrl); register_ioport_write((uint32_t)io_base + 0x07, 1, 1, &fdctrl_write, fdctrl); } register_savevm("fdc", io_base, 1, fdc_save, fdc_load, fdctrl); qemu_register_reset(fdctrl_external_reset, fdctrl); for (VAR_1 = 0; VAR_1 < 2; VAR_1++) { fd_revalidate(&fdctrl->drives[VAR_1]); } return fdctrl; }
[ "fdctrl_t *FUNC_0 (qemu_irq irq, int dma_chann, int mem_mapped,\ntarget_phys_addr_t io_base,\nBlockDriverState **fds)\n{", "fdctrl_t *fdctrl;", "int VAR_0;", "int VAR_1;", "FLOPPY_DPRINTF(\"init controller\\n\");", "fdctrl = qemu_mallocz(sizeof(fdctrl_t));", "if (!fdctrl)\nreturn NULL;", "fdctrl->fifo = qemu_memalign(512, FD_SECTOR_LEN);", "if (fdctrl->fifo == NULL) {", "qemu_free(fdctrl);", "return NULL;", "}", "fdctrl->result_timer = qemu_new_timer(vm_clock,\nfdctrl_result_timer, fdctrl);", "fdctrl->version = 0x90;", "fdctrl->irq = irq;", "fdctrl->dma_chann = dma_chann;", "fdctrl->io_base = io_base;", "fdctrl->config = 0x60;", "fdctrl->sun4m = 0;", "if (fdctrl->dma_chann != -1) {", "fdctrl->dma_en = 1;", "DMA_register_channel(dma_chann, &fdctrl_transfer_handler, fdctrl);", "} else {", "fdctrl->dma_en = 0;", "}", "for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {", "fd_init(&fdctrl->drives[VAR_1], fds[VAR_1]);", "}", "fdctrl_reset(fdctrl, 0);", "fdctrl->state = FD_CTRL_ACTIVE;", "if (mem_mapped) {", "VAR_0 = cpu_register_io_memory(0, fdctrl_mem_read, fdctrl_mem_write,\nfdctrl);", "cpu_register_physical_memory(io_base, 0x08, VAR_0);", "} else {", "register_ioport_read((uint32_t)io_base + 0x01, 5, 1, &fdctrl_read,\nfdctrl);", "register_ioport_read((uint32_t)io_base + 0x07, 1, 1, &fdctrl_read,\nfdctrl);", "register_ioport_write((uint32_t)io_base + 0x01, 5, 1, &fdctrl_write,\nfdctrl);", "register_ioport_write((uint32_t)io_base + 0x07, 1, 1, &fdctrl_write,\nfdctrl);", "}", "register_savevm(\"fdc\", io_base, 1, fdc_save, fdc_load, fdctrl);", "qemu_register_reset(fdctrl_external_reset, fdctrl);", "for (VAR_1 = 0; VAR_1 < 2; VAR_1++) {", "fd_revalidate(&fdctrl->drives[VAR_1]);", "}", "return fdctrl;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89, 91 ], [ 93, 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ] ]
15,074
static void end_frame(AVFilterLink *inlink) { TransContext *trans = inlink->dst->priv; AVFilterBufferRef *inpic = inlink->cur_buf; AVFilterBufferRef *outpic = inlink->dst->outputs[0]->out_buf; AVFilterLink *outlink = inlink->dst->outputs[0]; int plane; for (plane = 0; outpic->data[plane]; plane++) { int hsub = plane == 1 || plane == 2 ? trans->hsub : 0; int vsub = plane == 1 || plane == 2 ? trans->vsub : 0; int pixstep = trans->pixsteps[plane]; int inh = inpic->video->h>>vsub; int outw = outpic->video->w>>hsub; int outh = outpic->video->h>>vsub; uint8_t *out, *in; int outlinesize, inlinesize; int x, y; out = outpic->data[plane]; outlinesize = outpic->linesize[plane]; in = inpic ->data[plane]; inlinesize = inpic ->linesize[plane]; if (trans->dir&1) { in += inpic->linesize[plane] * (inh-1); inlinesize *= -1; } if (trans->dir&2) { out += outpic->linesize[plane] * (outh-1); outlinesize *= -1; } for (y = 0; y < outh; y++) { switch (pixstep) { case 1: for (x = 0; x < outw; x++) out[x] = in[x*inlinesize + y]; break; case 2: for (x = 0; x < outw; x++) *((uint16_t *)(out + 2*x)) = *((uint16_t *)(in + x*inlinesize + y*2)); break; case 3: for (x = 0; x < outw; x++) { int32_t v = AV_RB24(in + x*inlinesize + y*3); AV_WB24(out + 3*x, v); } break; case 4: for (x = 0; x < outw; x++) *((uint32_t *)(out + 4*x)) = *((uint32_t *)(in + x*inlinesize + y*4)); break; } out += outlinesize; } } avfilter_unref_buffer(inpic); ff_draw_slice(outlink, 0, outpic->video->h, 1); ff_end_frame(outlink); avfilter_unref_buffer(outpic); }
false
FFmpeg
07bad27810cdd7d3171cbd542119aa051646377c
static void end_frame(AVFilterLink *inlink) { TransContext *trans = inlink->dst->priv; AVFilterBufferRef *inpic = inlink->cur_buf; AVFilterBufferRef *outpic = inlink->dst->outputs[0]->out_buf; AVFilterLink *outlink = inlink->dst->outputs[0]; int plane; for (plane = 0; outpic->data[plane]; plane++) { int hsub = plane == 1 || plane == 2 ? trans->hsub : 0; int vsub = plane == 1 || plane == 2 ? trans->vsub : 0; int pixstep = trans->pixsteps[plane]; int inh = inpic->video->h>>vsub; int outw = outpic->video->w>>hsub; int outh = outpic->video->h>>vsub; uint8_t *out, *in; int outlinesize, inlinesize; int x, y; out = outpic->data[plane]; outlinesize = outpic->linesize[plane]; in = inpic ->data[plane]; inlinesize = inpic ->linesize[plane]; if (trans->dir&1) { in += inpic->linesize[plane] * (inh-1); inlinesize *= -1; } if (trans->dir&2) { out += outpic->linesize[plane] * (outh-1); outlinesize *= -1; } for (y = 0; y < outh; y++) { switch (pixstep) { case 1: for (x = 0; x < outw; x++) out[x] = in[x*inlinesize + y]; break; case 2: for (x = 0; x < outw; x++) *((uint16_t *)(out + 2*x)) = *((uint16_t *)(in + x*inlinesize + y*2)); break; case 3: for (x = 0; x < outw; x++) { int32_t v = AV_RB24(in + x*inlinesize + y*3); AV_WB24(out + 3*x, v); } break; case 4: for (x = 0; x < outw; x++) *((uint32_t *)(out + 4*x)) = *((uint32_t *)(in + x*inlinesize + y*4)); break; } out += outlinesize; } } avfilter_unref_buffer(inpic); ff_draw_slice(outlink, 0, outpic->video->h, 1); ff_end_frame(outlink); avfilter_unref_buffer(outpic); }
{ "code": [], "line_no": [] }
static void FUNC_0(AVFilterLink *VAR_0) { TransContext *trans = VAR_0->dst->priv; AVFilterBufferRef *inpic = VAR_0->cur_buf; AVFilterBufferRef *outpic = VAR_0->dst->outputs[0]->out_buf; AVFilterLink *outlink = VAR_0->dst->outputs[0]; int VAR_1; for (VAR_1 = 0; outpic->data[VAR_1]; VAR_1++) { int hsub = VAR_1 == 1 || VAR_1 == 2 ? trans->hsub : 0; int vsub = VAR_1 == 1 || VAR_1 == 2 ? trans->vsub : 0; int pixstep = trans->pixsteps[VAR_1]; int inh = inpic->video->h>>vsub; int outw = outpic->video->w>>hsub; int outh = outpic->video->h>>vsub; uint8_t *out, *in; int outlinesize, inlinesize; int x, y; out = outpic->data[VAR_1]; outlinesize = outpic->linesize[VAR_1]; in = inpic ->data[VAR_1]; inlinesize = inpic ->linesize[VAR_1]; if (trans->dir&1) { in += inpic->linesize[VAR_1] * (inh-1); inlinesize *= -1; } if (trans->dir&2) { out += outpic->linesize[VAR_1] * (outh-1); outlinesize *= -1; } for (y = 0; y < outh; y++) { switch (pixstep) { case 1: for (x = 0; x < outw; x++) out[x] = in[x*inlinesize + y]; break; case 2: for (x = 0; x < outw; x++) *((uint16_t *)(out + 2*x)) = *((uint16_t *)(in + x*inlinesize + y*2)); break; case 3: for (x = 0; x < outw; x++) { int32_t v = AV_RB24(in + x*inlinesize + y*3); AV_WB24(out + 3*x, v); } break; case 4: for (x = 0; x < outw; x++) *((uint32_t *)(out + 4*x)) = *((uint32_t *)(in + x*inlinesize + y*4)); break; } out += outlinesize; } } avfilter_unref_buffer(inpic); ff_draw_slice(outlink, 0, outpic->video->h, 1); ff_end_frame(outlink); avfilter_unref_buffer(outpic); }
[ "static void FUNC_0(AVFilterLink *VAR_0)\n{", "TransContext *trans = VAR_0->dst->priv;", "AVFilterBufferRef *inpic = VAR_0->cur_buf;", "AVFilterBufferRef *outpic = VAR_0->dst->outputs[0]->out_buf;", "AVFilterLink *outlink = VAR_0->dst->outputs[0];", "int VAR_1;", "for (VAR_1 = 0; outpic->data[VAR_1]; VAR_1++) {", "int hsub = VAR_1 == 1 || VAR_1 == 2 ? trans->hsub : 0;", "int vsub = VAR_1 == 1 || VAR_1 == 2 ? trans->vsub : 0;", "int pixstep = trans->pixsteps[VAR_1];", "int inh = inpic->video->h>>vsub;", "int outw = outpic->video->w>>hsub;", "int outh = outpic->video->h>>vsub;", "uint8_t *out, *in;", "int outlinesize, inlinesize;", "int x, y;", "out = outpic->data[VAR_1]; outlinesize = outpic->linesize[VAR_1];", "in = inpic ->data[VAR_1]; inlinesize = inpic ->linesize[VAR_1];", "if (trans->dir&1) {", "in += inpic->linesize[VAR_1] * (inh-1);", "inlinesize *= -1;", "}", "if (trans->dir&2) {", "out += outpic->linesize[VAR_1] * (outh-1);", "outlinesize *= -1;", "}", "for (y = 0; y < outh; y++) {", "switch (pixstep) {", "case 1:\nfor (x = 0; x < outw; x++)", "out[x] = in[x*inlinesize + y];", "break;", "case 2:\nfor (x = 0; x < outw; x++)", "*((uint16_t *)(out + 2*x)) = *((uint16_t *)(in + x*inlinesize + y*2));", "break;", "case 3:\nfor (x = 0; x < outw; x++) {", "int32_t v = AV_RB24(in + x*inlinesize + y*3);", "AV_WB24(out + 3*x, v);", "}", "break;", "case 4:\nfor (x = 0; x < outw; x++)", "*((uint32_t *)(out + 4*x)) = *((uint32_t *)(in + x*inlinesize + y*4));", "break;", "}", "out += outlinesize;", "}", "}", "avfilter_unref_buffer(inpic);", "ff_draw_slice(outlink, 0, outpic->video->h, 1);", "ff_end_frame(outlink);", "avfilter_unref_buffer(outpic);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77, 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ] ]
15,075
void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs, int64_t speed, BlockDriverCompletionFunc *cb, void *opaque, Error **errp) { BlockJob *job; if (bs->job || bdrv_in_use(bs)) { error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs)); return NULL; } bdrv_ref(bs); bdrv_set_in_use(bs, 1); job = g_malloc0(driver->instance_size); job->driver = driver; job->bs = bs; job->cb = cb; job->opaque = opaque; job->busy = true; bs->job = job; /* Only set speed when necessary to avoid NotSupported error */ if (speed != 0) { Error *local_err = NULL; block_job_set_speed(job, speed, &local_err); if (local_err) { bs->job = NULL; g_free(job); bdrv_set_in_use(bs, 0); error_propagate(errp, local_err); return NULL; } } return job; }
false
qemu
3718d8ab65f68de2acccbe6a315907805f54e3cc
void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs, int64_t speed, BlockDriverCompletionFunc *cb, void *opaque, Error **errp) { BlockJob *job; if (bs->job || bdrv_in_use(bs)) { error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(bs)); return NULL; } bdrv_ref(bs); bdrv_set_in_use(bs, 1); job = g_malloc0(driver->instance_size); job->driver = driver; job->bs = bs; job->cb = cb; job->opaque = opaque; job->busy = true; bs->job = job; if (speed != 0) { Error *local_err = NULL; block_job_set_speed(job, speed, &local_err); if (local_err) { bs->job = NULL; g_free(job); bdrv_set_in_use(bs, 0); error_propagate(errp, local_err); return NULL; } } return job; }
{ "code": [], "line_no": [] }
void *FUNC_0(const BlockJobDriver *VAR_0, BlockDriverState *VAR_1, int64_t VAR_2, BlockDriverCompletionFunc *VAR_3, void *VAR_4, Error **VAR_5) { BlockJob *job; if (VAR_1->job || bdrv_in_use(VAR_1)) { error_set(VAR_5, QERR_DEVICE_IN_USE, bdrv_get_device_name(VAR_1)); return NULL; } bdrv_ref(VAR_1); bdrv_set_in_use(VAR_1, 1); job = g_malloc0(VAR_0->instance_size); job->VAR_0 = VAR_0; job->VAR_1 = VAR_1; job->VAR_3 = VAR_3; job->VAR_4 = VAR_4; job->busy = true; VAR_1->job = job; if (VAR_2 != 0) { Error *local_err = NULL; block_job_set_speed(job, VAR_2, &local_err); if (local_err) { VAR_1->job = NULL; g_free(job); bdrv_set_in_use(VAR_1, 0); error_propagate(VAR_5, local_err); return NULL; } } return job; }
[ "void *FUNC_0(const BlockJobDriver *VAR_0, BlockDriverState *VAR_1,\nint64_t VAR_2, BlockDriverCompletionFunc *VAR_3,\nvoid *VAR_4, Error **VAR_5)\n{", "BlockJob *job;", "if (VAR_1->job || bdrv_in_use(VAR_1)) {", "error_set(VAR_5, QERR_DEVICE_IN_USE, bdrv_get_device_name(VAR_1));", "return NULL;", "}", "bdrv_ref(VAR_1);", "bdrv_set_in_use(VAR_1, 1);", "job = g_malloc0(VAR_0->instance_size);", "job->VAR_0 = VAR_0;", "job->VAR_1 = VAR_1;", "job->VAR_3 = VAR_3;", "job->VAR_4 = VAR_4;", "job->busy = true;", "VAR_1->job = job;", "if (VAR_2 != 0) {", "Error *local_err = NULL;", "block_job_set_speed(job, VAR_2, &local_err);", "if (local_err) {", "VAR_1->job = NULL;", "g_free(job);", "bdrv_set_in_use(VAR_1, 0);", "error_propagate(VAR_5, local_err);", "return NULL;", "}", "}", "return job;", "}" ]
[ 0, 0, 0, 0, 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
15,076
static int apb_pci_bridge_initfn(PCIDevice *dev) { int rc; rc = pci_bridge_initfn(dev); if (rc < 0) { return rc; } pci_config_set_vendor_id(dev->config, PCI_VENDOR_ID_SUN); pci_config_set_device_id(dev->config, PCI_DEVICE_ID_SUN_SIMBA); /* * command register: * According to PCI bridge spec, after reset * bus master bit is off * memory space enable bit is off * According to manual (805-1251.pdf). * the reset value should be zero unless the boot pin is tied high * (which is true) and thus it should be PCI_COMMAND_MEMORY. */ pci_set_word(dev->config + PCI_COMMAND, PCI_COMMAND_MEMORY); pci_set_word(dev->config + PCI_STATUS, PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ | PCI_STATUS_DEVSEL_MEDIUM); pci_set_byte(dev->config + PCI_REVISION_ID, 0x11); return 0; }
false
qemu
92f9a4f13ea29de4644bd0b077643e1dff96ab29
static int apb_pci_bridge_initfn(PCIDevice *dev) { int rc; rc = pci_bridge_initfn(dev); if (rc < 0) { return rc; } pci_config_set_vendor_id(dev->config, PCI_VENDOR_ID_SUN); pci_config_set_device_id(dev->config, PCI_DEVICE_ID_SUN_SIMBA); pci_set_word(dev->config + PCI_COMMAND, PCI_COMMAND_MEMORY); pci_set_word(dev->config + PCI_STATUS, PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ | PCI_STATUS_DEVSEL_MEDIUM); pci_set_byte(dev->config + PCI_REVISION_ID, 0x11); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(PCIDevice *VAR_0) { int VAR_1; VAR_1 = pci_bridge_initfn(VAR_0); if (VAR_1 < 0) { return VAR_1; } pci_config_set_vendor_id(VAR_0->config, PCI_VENDOR_ID_SUN); pci_config_set_device_id(VAR_0->config, PCI_DEVICE_ID_SUN_SIMBA); pci_set_word(VAR_0->config + PCI_COMMAND, PCI_COMMAND_MEMORY); pci_set_word(VAR_0->config + PCI_STATUS, PCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ | PCI_STATUS_DEVSEL_MEDIUM); pci_set_byte(VAR_0->config + PCI_REVISION_ID, 0x11); return 0; }
[ "static int FUNC_0(PCIDevice *VAR_0)\n{", "int VAR_1;", "VAR_1 = pci_bridge_initfn(VAR_0);", "if (VAR_1 < 0) {", "return VAR_1;", "}", "pci_config_set_vendor_id(VAR_0->config, PCI_VENDOR_ID_SUN);", "pci_config_set_device_id(VAR_0->config, PCI_DEVICE_ID_SUN_SIMBA);", "pci_set_word(VAR_0->config + PCI_COMMAND,\nPCI_COMMAND_MEMORY);", "pci_set_word(VAR_0->config + PCI_STATUS,\nPCI_STATUS_FAST_BACK | PCI_STATUS_66MHZ |\nPCI_STATUS_DEVSEL_MEDIUM);", "pci_set_byte(VAR_0->config + PCI_REVISION_ID, 0x11);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 43, 45 ], [ 47, 49, 51 ], [ 53 ], [ 55 ], [ 57 ] ]
15,078
static int proxy_rename(FsContext *ctx, const char *oldpath, const char *newpath) { int retval; V9fsString oldname, newname; v9fs_string_init(&oldname); v9fs_string_init(&newname); v9fs_string_sprintf(&oldname, "%s", oldpath); v9fs_string_sprintf(&newname, "%s", newpath); retval = v9fs_request(ctx->private, T_RENAME, NULL, "ss", &oldname, &newname); v9fs_string_free(&oldname); v9fs_string_free(&newname); if (retval < 0) { errno = -retval; } return retval; }
false
qemu
494a8ebe713055d3946183f4b395f85a18b43e9e
static int proxy_rename(FsContext *ctx, const char *oldpath, const char *newpath) { int retval; V9fsString oldname, newname; v9fs_string_init(&oldname); v9fs_string_init(&newname); v9fs_string_sprintf(&oldname, "%s", oldpath); v9fs_string_sprintf(&newname, "%s", newpath); retval = v9fs_request(ctx->private, T_RENAME, NULL, "ss", &oldname, &newname); v9fs_string_free(&oldname); v9fs_string_free(&newname); if (retval < 0) { errno = -retval; } return retval; }
{ "code": [], "line_no": [] }
static int FUNC_0(FsContext *VAR_0, const char *VAR_1, const char *VAR_2) { int VAR_3; V9fsString oldname, newname; v9fs_string_init(&oldname); v9fs_string_init(&newname); v9fs_string_sprintf(&oldname, "%s", VAR_1); v9fs_string_sprintf(&newname, "%s", VAR_2); VAR_3 = v9fs_request(VAR_0->private, T_RENAME, NULL, "ss", &oldname, &newname); v9fs_string_free(&oldname); v9fs_string_free(&newname); if (VAR_3 < 0) { errno = -VAR_3; } return VAR_3; }
[ "static int FUNC_0(FsContext *VAR_0, const char *VAR_1,\nconst char *VAR_2)\n{", "int VAR_3;", "V9fsString oldname, newname;", "v9fs_string_init(&oldname);", "v9fs_string_init(&newname);", "v9fs_string_sprintf(&oldname, \"%s\", VAR_1);", "v9fs_string_sprintf(&newname, \"%s\", VAR_2);", "VAR_3 = v9fs_request(VAR_0->private, T_RENAME, NULL, \"ss\",\n&oldname, &newname);", "v9fs_string_free(&oldname);", "v9fs_string_free(&newname);", "if (VAR_3 < 0) {", "errno = -VAR_3;", "}", "return VAR_3;", "}" ]
[ 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 ], [ 37 ], [ 39 ] ]
15,079
void helper_memalign(uint32_t addr, uint32_t dr, uint32_t wr, uint32_t mask) { if (addr & mask) { qemu_log("unaligned access addr=%x mask=%x, wr=%d\n", addr, mask, wr); if (!(env->sregs[SR_MSR] & MSR_EE)) { return; } env->sregs[SR_ESR] = ESR_EC_UNALIGNED_DATA | (wr << 10) \ | (dr & 31) << 5; if (mask == 3) { env->sregs[SR_ESR] |= 1 << 11; } helper_raise_exception(EXCP_HW_EXCP); } }
false
qemu
97f90cbfe810bb153fc44bde732d9639610783bb
void helper_memalign(uint32_t addr, uint32_t dr, uint32_t wr, uint32_t mask) { if (addr & mask) { qemu_log("unaligned access addr=%x mask=%x, wr=%d\n", addr, mask, wr); if (!(env->sregs[SR_MSR] & MSR_EE)) { return; } env->sregs[SR_ESR] = ESR_EC_UNALIGNED_DATA | (wr << 10) \ | (dr & 31) << 5; if (mask == 3) { env->sregs[SR_ESR] |= 1 << 11; } helper_raise_exception(EXCP_HW_EXCP); } }
{ "code": [], "line_no": [] }
void FUNC_0(uint32_t VAR_0, uint32_t VAR_1, uint32_t VAR_2, uint32_t VAR_3) { if (VAR_0 & VAR_3) { qemu_log("unaligned access VAR_0=%x VAR_3=%x, VAR_2=%d\n", VAR_0, VAR_3, VAR_2); if (!(env->sregs[SR_MSR] & MSR_EE)) { return; } env->sregs[SR_ESR] = ESR_EC_UNALIGNED_DATA | (VAR_2 << 10) \ | (VAR_1 & 31) << 5; if (VAR_3 == 3) { env->sregs[SR_ESR] |= 1 << 11; } helper_raise_exception(EXCP_HW_EXCP); } }
[ "void FUNC_0(uint32_t VAR_0, uint32_t VAR_1, uint32_t VAR_2, uint32_t VAR_3)\n{", "if (VAR_0 & VAR_3) {", "qemu_log(\"unaligned access VAR_0=%x VAR_3=%x, VAR_2=%d\\n\",\nVAR_0, VAR_3, VAR_2);", "if (!(env->sregs[SR_MSR] & MSR_EE)) {", "return;", "}", "env->sregs[SR_ESR] = ESR_EC_UNALIGNED_DATA | (VAR_2 << 10) \\\n| (VAR_1 & 31) << 5;", "if (VAR_3 == 3) {", "env->sregs[SR_ESR] |= 1 << 11;", "}", "helper_raise_exception(EXCP_HW_EXCP);", "}", "}" ]
[ 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 ] ]
15,080
static void gdb_breakpoint_remove_all(CPUState *env) { cpu_breakpoint_remove_all(env, BP_GDB); #ifndef CONFIG_USER_ONLY cpu_watchpoint_remove_all(env, BP_GDB); #endif }
false
qemu
880a7578381d1c7ed4d41c7599ae3cc06567a824
static void gdb_breakpoint_remove_all(CPUState *env) { cpu_breakpoint_remove_all(env, BP_GDB); #ifndef CONFIG_USER_ONLY cpu_watchpoint_remove_all(env, BP_GDB); #endif }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUState *VAR_0) { cpu_breakpoint_remove_all(VAR_0, BP_GDB); #ifndef CONFIG_USER_ONLY cpu_watchpoint_remove_all(VAR_0, BP_GDB); #endif }
[ "static void FUNC_0(CPUState *VAR_0)\n{", "cpu_breakpoint_remove_all(VAR_0, BP_GDB);", "#ifndef CONFIG_USER_ONLY\ncpu_watchpoint_remove_all(VAR_0, BP_GDB);", "#endif\n}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11, 13 ] ]
15,081
static void handle_pending_signal(CPUArchState *cpu_env, int sig) { CPUState *cpu = ENV_GET_CPU(cpu_env); abi_ulong handler; sigset_t set; target_sigset_t target_old_set; struct target_sigaction *sa; TaskState *ts = cpu->opaque; struct emulated_sigtable *k = &ts->sigtab[sig - 1]; trace_user_handle_signal(cpu_env, sig); /* dequeue signal */ k->pending = 0; sig = gdb_handlesig(cpu, sig); if (!sig) { sa = NULL; handler = TARGET_SIG_IGN; } else { sa = &sigact_table[sig - 1]; handler = sa->_sa_handler; } if (sig == TARGET_SIGSEGV && sigismember(&ts->signal_mask, SIGSEGV)) { /* Guest has blocked SIGSEGV but we got one anyway. Assume this * is a forced SIGSEGV (ie one the kernel handles via force_sig_info * because it got a real MMU fault), and treat as if default handler. */ handler = TARGET_SIG_DFL; } if (handler == TARGET_SIG_DFL) { /* default handler : ignore some signal. The other are job control or fatal */ if (sig == TARGET_SIGTSTP || sig == TARGET_SIGTTIN || sig == TARGET_SIGTTOU) { kill(getpid(),SIGSTOP); } else if (sig != TARGET_SIGCHLD && sig != TARGET_SIGURG && sig != TARGET_SIGWINCH && sig != TARGET_SIGCONT) { force_sig(sig); } } else if (handler == TARGET_SIG_IGN) { /* ignore sig */ } else if (handler == TARGET_SIG_ERR) { force_sig(sig); } else { /* compute the blocked signals during the handler execution */ sigset_t *blocked_set; target_to_host_sigset(&set, &sa->sa_mask); /* SA_NODEFER indicates that the current signal should not be blocked during the handler */ if (!(sa->sa_flags & TARGET_SA_NODEFER)) sigaddset(&set, target_to_host_signal(sig)); /* save the previous blocked signal state to restore it at the end of the signal execution (see do_sigreturn) */ host_to_target_sigset_internal(&target_old_set, &ts->signal_mask); /* block signals in the handler */ blocked_set = ts->in_sigsuspend ? &ts->sigsuspend_mask : &ts->signal_mask; sigorset(&ts->signal_mask, blocked_set, &set); ts->in_sigsuspend = 0; /* if the CPU is in VM86 mode, we restore the 32 bit values */ #if defined(TARGET_I386) && !defined(TARGET_X86_64) { CPUX86State *env = cpu_env; if (env->eflags & VM_MASK) save_v86_state(env); } #endif /* prepare the stack frame of the virtual CPU */ #if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64) \ || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) /* These targets do not have traditional signals. */ setup_rt_frame(sig, sa, &k->info, &target_old_set, cpu_env); #else if (sa->sa_flags & TARGET_SA_SIGINFO) setup_rt_frame(sig, sa, &k->info, &target_old_set, cpu_env); else setup_frame(sig, sa, &target_old_set, cpu_env); #endif if (sa->sa_flags & TARGET_SA_RESETHAND) { sa->_sa_handler = TARGET_SIG_DFL; } } }
false
qemu
655ed67c2a248cf0a887229d8492d6ddc0518545
static void handle_pending_signal(CPUArchState *cpu_env, int sig) { CPUState *cpu = ENV_GET_CPU(cpu_env); abi_ulong handler; sigset_t set; target_sigset_t target_old_set; struct target_sigaction *sa; TaskState *ts = cpu->opaque; struct emulated_sigtable *k = &ts->sigtab[sig - 1]; trace_user_handle_signal(cpu_env, sig); k->pending = 0; sig = gdb_handlesig(cpu, sig); if (!sig) { sa = NULL; handler = TARGET_SIG_IGN; } else { sa = &sigact_table[sig - 1]; handler = sa->_sa_handler; } if (sig == TARGET_SIGSEGV && sigismember(&ts->signal_mask, SIGSEGV)) { handler = TARGET_SIG_DFL; } if (handler == TARGET_SIG_DFL) { if (sig == TARGET_SIGTSTP || sig == TARGET_SIGTTIN || sig == TARGET_SIGTTOU) { kill(getpid(),SIGSTOP); } else if (sig != TARGET_SIGCHLD && sig != TARGET_SIGURG && sig != TARGET_SIGWINCH && sig != TARGET_SIGCONT) { force_sig(sig); } } else if (handler == TARGET_SIG_IGN) { } else if (handler == TARGET_SIG_ERR) { force_sig(sig); } else { sigset_t *blocked_set; target_to_host_sigset(&set, &sa->sa_mask); if (!(sa->sa_flags & TARGET_SA_NODEFER)) sigaddset(&set, target_to_host_signal(sig)); host_to_target_sigset_internal(&target_old_set, &ts->signal_mask); blocked_set = ts->in_sigsuspend ? &ts->sigsuspend_mask : &ts->signal_mask; sigorset(&ts->signal_mask, blocked_set, &set); ts->in_sigsuspend = 0; #if defined(TARGET_I386) && !defined(TARGET_X86_64) { CPUX86State *env = cpu_env; if (env->eflags & VM_MASK) save_v86_state(env); } #endif #if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64) \ || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) setup_rt_frame(sig, sa, &k->info, &target_old_set, cpu_env); #else if (sa->sa_flags & TARGET_SA_SIGINFO) setup_rt_frame(sig, sa, &k->info, &target_old_set, cpu_env); else setup_frame(sig, sa, &target_old_set, cpu_env); #endif if (sa->sa_flags & TARGET_SA_RESETHAND) { sa->_sa_handler = TARGET_SIG_DFL; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(CPUArchState *VAR_0, int VAR_1) { CPUState *cpu = ENV_GET_CPU(VAR_0); abi_ulong handler; sigset_t set; target_sigset_t target_old_set; struct target_sigaction *VAR_2; TaskState *ts = cpu->opaque; struct emulated_sigtable *VAR_3 = &ts->sigtab[VAR_1 - 1]; trace_user_handle_signal(VAR_0, VAR_1); VAR_3->pending = 0; VAR_1 = gdb_handlesig(cpu, VAR_1); if (!VAR_1) { VAR_2 = NULL; handler = TARGET_SIG_IGN; } else { VAR_2 = &sigact_table[VAR_1 - 1]; handler = VAR_2->_sa_handler; } if (VAR_1 == TARGET_SIGSEGV && sigismember(&ts->signal_mask, SIGSEGV)) { handler = TARGET_SIG_DFL; } if (handler == TARGET_SIG_DFL) { if (VAR_1 == TARGET_SIGTSTP || VAR_1 == TARGET_SIGTTIN || VAR_1 == TARGET_SIGTTOU) { kill(getpid(),SIGSTOP); } else if (VAR_1 != TARGET_SIGCHLD && VAR_1 != TARGET_SIGURG && VAR_1 != TARGET_SIGWINCH && VAR_1 != TARGET_SIGCONT) { force_sig(VAR_1); } } else if (handler == TARGET_SIG_IGN) { } else if (handler == TARGET_SIG_ERR) { force_sig(VAR_1); } else { sigset_t *blocked_set; target_to_host_sigset(&set, &VAR_2->sa_mask); if (!(VAR_2->sa_flags & TARGET_SA_NODEFER)) sigaddset(&set, target_to_host_signal(VAR_1)); host_to_target_sigset_internal(&target_old_set, &ts->signal_mask); blocked_set = ts->in_sigsuspend ? &ts->sigsuspend_mask : &ts->signal_mask; sigorset(&ts->signal_mask, blocked_set, &set); ts->in_sigsuspend = 0; #if defined(TARGET_I386) && !defined(TARGET_X86_64) { CPUX86State *env = VAR_0; if (env->eflags & VM_MASK) save_v86_state(env); } #endif #if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64) \ || defined(TARGET_OPENRISC) || defined(TARGET_TILEGX) setup_rt_frame(VAR_1, VAR_2, &VAR_3->info, &target_old_set, VAR_0); #else if (VAR_2->sa_flags & TARGET_SA_SIGINFO) setup_rt_frame(VAR_1, VAR_2, &VAR_3->info, &target_old_set, VAR_0); else setup_frame(VAR_1, VAR_2, &target_old_set, VAR_0); #endif if (VAR_2->sa_flags & TARGET_SA_RESETHAND) { VAR_2->_sa_handler = TARGET_SIG_DFL; } } }
[ "static void FUNC_0(CPUArchState *VAR_0, int VAR_1)\n{", "CPUState *cpu = ENV_GET_CPU(VAR_0);", "abi_ulong handler;", "sigset_t set;", "target_sigset_t target_old_set;", "struct target_sigaction *VAR_2;", "TaskState *ts = cpu->opaque;", "struct emulated_sigtable *VAR_3 = &ts->sigtab[VAR_1 - 1];", "trace_user_handle_signal(VAR_0, VAR_1);", "VAR_3->pending = 0;", "VAR_1 = gdb_handlesig(cpu, VAR_1);", "if (!VAR_1) {", "VAR_2 = NULL;", "handler = TARGET_SIG_IGN;", "} else {", "VAR_2 = &sigact_table[VAR_1 - 1];", "handler = VAR_2->_sa_handler;", "}", "if (VAR_1 == TARGET_SIGSEGV && sigismember(&ts->signal_mask, SIGSEGV)) {", "handler = TARGET_SIG_DFL;", "}", "if (handler == TARGET_SIG_DFL) {", "if (VAR_1 == TARGET_SIGTSTP || VAR_1 == TARGET_SIGTTIN || VAR_1 == TARGET_SIGTTOU) {", "kill(getpid(),SIGSTOP);", "} else if (VAR_1 != TARGET_SIGCHLD &&", "VAR_1 != TARGET_SIGURG &&\nVAR_1 != TARGET_SIGWINCH &&\nVAR_1 != TARGET_SIGCONT) {", "force_sig(VAR_1);", "}", "} else if (handler == TARGET_SIG_IGN) {", "} else if (handler == TARGET_SIG_ERR) {", "force_sig(VAR_1);", "} else {", "sigset_t *blocked_set;", "target_to_host_sigset(&set, &VAR_2->sa_mask);", "if (!(VAR_2->sa_flags & TARGET_SA_NODEFER))\nsigaddset(&set, target_to_host_signal(VAR_1));", "host_to_target_sigset_internal(&target_old_set, &ts->signal_mask);", "blocked_set = ts->in_sigsuspend ?\n&ts->sigsuspend_mask : &ts->signal_mask;", "sigorset(&ts->signal_mask, blocked_set, &set);", "ts->in_sigsuspend = 0;", "#if defined(TARGET_I386) && !defined(TARGET_X86_64)\n{", "CPUX86State *env = VAR_0;", "if (env->eflags & VM_MASK)\nsave_v86_state(env);", "}", "#endif\n#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64) \\\n|| defined(TARGET_OPENRISC) || defined(TARGET_TILEGX)\nsetup_rt_frame(VAR_1, VAR_2, &VAR_3->info, &target_old_set, VAR_0);", "#else\nif (VAR_2->sa_flags & TARGET_SA_SIGINFO)\nsetup_rt_frame(VAR_1, VAR_2, &VAR_3->info, &target_old_set, VAR_0);", "else\nsetup_frame(VAR_1, VAR_2, &target_old_set, VAR_0);", "#endif\nif (VAR_2->sa_flags & TARGET_SA_RESETHAND) {", "VAR_2->_sa_handler = TARGET_SIG_DFL;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 57 ], [ 59 ], [ 63 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75, 77 ], [ 79 ], [ 81 ], [ 83 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 99 ], [ 105, 107 ], [ 115 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 133, 135 ], [ 137 ], [ 139, 141 ], [ 143 ], [ 145, 149, 151, 155 ], [ 157, 159, 161 ], [ 163, 165 ], [ 167, 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ] ]
15,083
static void pxa2xx_gpio_handler_update(PXA2xxGPIOInfo *s) { uint32_t level, diff; int i, bit, line; for (i = 0; i < PXA2XX_GPIO_BANKS; i ++) { level = s->olevel[i] & s->dir[i]; for (diff = s->prev_level[i] ^ level; diff; diff ^= 1 << bit) { bit = ffs(diff) - 1; line = bit + 32 * i; qemu_set_irq(s->handler[line], (level >> bit) & 1); } s->prev_level[i] = level; } }
false
qemu
786a4ea82ec9c87e3a895cf41081029b285a5fe5
static void pxa2xx_gpio_handler_update(PXA2xxGPIOInfo *s) { uint32_t level, diff; int i, bit, line; for (i = 0; i < PXA2XX_GPIO_BANKS; i ++) { level = s->olevel[i] & s->dir[i]; for (diff = s->prev_level[i] ^ level; diff; diff ^= 1 << bit) { bit = ffs(diff) - 1; line = bit + 32 * i; qemu_set_irq(s->handler[line], (level >> bit) & 1); } s->prev_level[i] = level; } }
{ "code": [], "line_no": [] }
static void FUNC_0(PXA2xxGPIOInfo *VAR_0) { uint32_t level, diff; int VAR_1, VAR_2, VAR_3; for (VAR_1 = 0; VAR_1 < PXA2XX_GPIO_BANKS; VAR_1 ++) { level = VAR_0->olevel[VAR_1] & VAR_0->dir[VAR_1]; for (diff = VAR_0->prev_level[VAR_1] ^ level; diff; diff ^= 1 << VAR_2) { VAR_2 = ffs(diff) - 1; VAR_3 = VAR_2 + 32 * VAR_1; qemu_set_irq(VAR_0->handler[VAR_3], (level >> VAR_2) & 1); } VAR_0->prev_level[VAR_1] = level; } }
[ "static void FUNC_0(PXA2xxGPIOInfo *VAR_0) {", "uint32_t level, diff;", "int VAR_1, VAR_2, VAR_3;", "for (VAR_1 = 0; VAR_1 < PXA2XX_GPIO_BANKS; VAR_1 ++) {", "level = VAR_0->olevel[VAR_1] & VAR_0->dir[VAR_1];", "for (diff = VAR_0->prev_level[VAR_1] ^ level; diff; diff ^= 1 << VAR_2) {", "VAR_2 = ffs(diff) - 1;", "VAR_3 = VAR_2 + 32 * VAR_1;", "qemu_set_irq(VAR_0->handler[VAR_3], (level >> VAR_2) & 1);", "}", "VAR_0->prev_level[VAR_1] = level;", "}", "}" ]
[ 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 ] ]
15,084
int kvm_init(int smp_cpus) { static const char upgrade_note[] = "Please upgrade to at least kernel 2.6.29 or recent kvm-kmod\n" "(see http://sourceforge.net/projects/kvm).\n"; KVMState *s; int ret; int i; if (smp_cpus > 1) { fprintf(stderr, "No SMP KVM support, use '-smp 1'\n"); return -EINVAL; } s = qemu_mallocz(sizeof(KVMState)); #ifdef KVM_CAP_SET_GUEST_DEBUG TAILQ_INIT(&s->kvm_sw_breakpoints); #endif for (i = 0; i < ARRAY_SIZE(s->slots); i++) s->slots[i].slot = i; s->vmfd = -1; s->fd = open("/dev/kvm", O_RDWR); if (s->fd == -1) { fprintf(stderr, "Could not access KVM kernel module: %m\n"); ret = -errno; goto err; } ret = kvm_ioctl(s, KVM_GET_API_VERSION, 0); if (ret < KVM_API_VERSION) { if (ret > 0) ret = -EINVAL; fprintf(stderr, "kvm version too old\n"); goto err; } if (ret > KVM_API_VERSION) { ret = -EINVAL; fprintf(stderr, "kvm version not supported\n"); goto err; } s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0); if (s->vmfd < 0) goto err; /* initially, KVM allocated its own memory and we had to jump through * hooks to make phys_ram_base point to this. Modern versions of KVM * just use a user allocated buffer so we can use regular pages * unmodified. Make sure we have a sufficiently modern version of KVM. */ if (!kvm_check_extension(s, KVM_CAP_USER_MEMORY)) { ret = -EINVAL; fprintf(stderr, "kvm does not support KVM_CAP_USER_MEMORY\n%s", upgrade_note); goto err; } /* There was a nasty bug in < kvm-80 that prevents memory slots from being * destroyed properly. Since we rely on this capability, refuse to work * with any kernel without this capability. */ if (!kvm_check_extension(s, KVM_CAP_DESTROY_MEMORY_REGION_WORKS)) { ret = -EINVAL; fprintf(stderr, "KVM kernel module broken (DESTROY_MEMORY_REGION).\n%s", upgrade_note); goto err; } #ifdef KVM_CAP_COALESCED_MMIO s->coalesced_mmio = kvm_check_extension(s, KVM_CAP_COALESCED_MMIO); #else s->coalesced_mmio = 0; #endif s->broken_set_mem_region = 1; #ifdef KVM_CAP_JOIN_MEMORY_REGIONS_WORKS ret = kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_JOIN_MEMORY_REGIONS_WORKS); if (ret > 0) { s->broken_set_mem_region = 0; } #endif ret = kvm_arch_init(s, smp_cpus); if (ret < 0) goto err; kvm_state = s; return 0; err: if (s) { if (s->vmfd != -1) close(s->vmfd); if (s->fd != -1) close(s->fd); } qemu_free(s); return ret; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
int kvm_init(int smp_cpus) { static const char upgrade_note[] = "Please upgrade to at least kernel 2.6.29 or recent kvm-kmod\n" "(see http: KVMState *s; int ret; int i; if (smp_cpus > 1) { fprintf(stderr, "No SMP KVM support, use '-smp 1'\n"); return -EINVAL; } s = qemu_mallocz(sizeof(KVMState)); #ifdef KVM_CAP_SET_GUEST_DEBUG TAILQ_INIT(&s->kvm_sw_breakpoints); #endif for (i = 0; i < ARRAY_SIZE(s->slots); i++) s->slots[i].slot = i; s->vmfd = -1; s->fd = open("/dev/kvm", O_RDWR); if (s->fd == -1) { fprintf(stderr, "Could not access KVM kernel module: %m\n"); ret = -errno; goto err; } ret = kvm_ioctl(s, KVM_GET_API_VERSION, 0); if (ret < KVM_API_VERSION) { if (ret > 0) ret = -EINVAL; fprintf(stderr, "kvm version too old\n"); goto err; } if (ret > KVM_API_VERSION) { ret = -EINVAL; fprintf(stderr, "kvm version not supported\n"); goto err; } s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0); if (s->vmfd < 0) goto err; if (!kvm_check_extension(s, KVM_CAP_USER_MEMORY)) { ret = -EINVAL; fprintf(stderr, "kvm does not support KVM_CAP_USER_MEMORY\n%s", upgrade_note); goto err; } if (!kvm_check_extension(s, KVM_CAP_DESTROY_MEMORY_REGION_WORKS)) { ret = -EINVAL; fprintf(stderr, "KVM kernel module broken (DESTROY_MEMORY_REGION).\n%s", upgrade_note); goto err; } #ifdef KVM_CAP_COALESCED_MMIO s->coalesced_mmio = kvm_check_extension(s, KVM_CAP_COALESCED_MMIO); #else s->coalesced_mmio = 0; #endif s->broken_set_mem_region = 1; #ifdef KVM_CAP_JOIN_MEMORY_REGIONS_WORKS ret = kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_JOIN_MEMORY_REGIONS_WORKS); if (ret > 0) { s->broken_set_mem_region = 0; } #endif ret = kvm_arch_init(s, smp_cpus); if (ret < 0) goto err; kvm_state = s; return 0; err: if (s) { if (s->vmfd != -1) close(s->vmfd); if (s->fd != -1) close(s->fd); } qemu_free(s); return ret; }
{ "code": [], "line_no": [] }
int FUNC_0(int VAR_0) { static const char VAR_1[] = "Please upgrade to at least kernel 2.6.29 or recent kvm-kmod\n" "(see http: KVMState *s; int VAR_2; int VAR_3; if (VAR_0 > 1) { fprintf(stderr, "No SMP KVM support, use '-smp 1'\n"); return -EINVAL; } s = qemu_mallocz(sizeof(KVMState)); #ifdef KVM_CAP_SET_GUEST_DEBUG TAILQ_INIT(&s->kvm_sw_breakpoints); #endif for (VAR_3 = 0; VAR_3 < ARRAY_SIZE(s->slots); VAR_3++) s->slots[VAR_3].slot = VAR_3; s->vmfd = -1; s->fd = open("/dev/kvm", O_RDWR); if (s->fd == -1) { fprintf(stderr, "Could not access KVM kernel module: %m\n"); VAR_2 = -errno; goto err; } VAR_2 = kvm_ioctl(s, KVM_GET_API_VERSION, 0); if (VAR_2 < KVM_API_VERSION) { if (VAR_2 > 0) VAR_2 = -EINVAL; fprintf(stderr, "kvm version too old\n"); goto err; } if (VAR_2 > KVM_API_VERSION) { VAR_2 = -EINVAL; fprintf(stderr, "kvm version not supported\n"); goto err; } s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0); if (s->vmfd < 0) goto err; if (!kvm_check_extension(s, KVM_CAP_USER_MEMORY)) { VAR_2 = -EINVAL; fprintf(stderr, "kvm does not support KVM_CAP_USER_MEMORY\n%s", VAR_1); goto err; } if (!kvm_check_extension(s, KVM_CAP_DESTROY_MEMORY_REGION_WORKS)) { VAR_2 = -EINVAL; fprintf(stderr, "KVM kernel module broken (DESTROY_MEMORY_REGION).\n%s", VAR_1); goto err; } #ifdef KVM_CAP_COALESCED_MMIO s->coalesced_mmio = kvm_check_extension(s, KVM_CAP_COALESCED_MMIO); #else s->coalesced_mmio = 0; #endif s->broken_set_mem_region = 1; #ifdef KVM_CAP_JOIN_MEMORY_REGIONS_WORKS VAR_2 = kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_JOIN_MEMORY_REGIONS_WORKS); if (VAR_2 > 0) { s->broken_set_mem_region = 0; } #endif VAR_2 = kvm_arch_init(s, VAR_0); if (VAR_2 < 0) goto err; kvm_state = s; return 0; err: if (s) { if (s->vmfd != -1) close(s->vmfd); if (s->fd != -1) close(s->fd); } qemu_free(s); return VAR_2; }
[ "int FUNC_0(int VAR_0)\n{", "static const char VAR_1[] =\n\"Please upgrade to at least kernel 2.6.29 or recent kvm-kmod\\n\"\n\"(see http:\nKVMState *s;", "int VAR_2;", "int VAR_3;", "if (VAR_0 > 1) {", "fprintf(stderr, \"No SMP KVM support, use '-smp 1'\\n\");", "return -EINVAL;", "}", "s = qemu_mallocz(sizeof(KVMState));", "#ifdef KVM_CAP_SET_GUEST_DEBUG\nTAILQ_INIT(&s->kvm_sw_breakpoints);", "#endif\nfor (VAR_3 = 0; VAR_3 < ARRAY_SIZE(s->slots); VAR_3++)", "s->slots[VAR_3].slot = VAR_3;", "s->vmfd = -1;", "s->fd = open(\"/dev/kvm\", O_RDWR);", "if (s->fd == -1) {", "fprintf(stderr, \"Could not access KVM kernel module: %m\\n\");", "VAR_2 = -errno;", "goto err;", "}", "VAR_2 = kvm_ioctl(s, KVM_GET_API_VERSION, 0);", "if (VAR_2 < KVM_API_VERSION) {", "if (VAR_2 > 0)\nVAR_2 = -EINVAL;", "fprintf(stderr, \"kvm version too old\\n\");", "goto err;", "}", "if (VAR_2 > KVM_API_VERSION) {", "VAR_2 = -EINVAL;", "fprintf(stderr, \"kvm version not supported\\n\");", "goto err;", "}", "s->vmfd = kvm_ioctl(s, KVM_CREATE_VM, 0);", "if (s->vmfd < 0)\ngoto err;", "if (!kvm_check_extension(s, KVM_CAP_USER_MEMORY)) {", "VAR_2 = -EINVAL;", "fprintf(stderr, \"kvm does not support KVM_CAP_USER_MEMORY\\n%s\",\nVAR_1);", "goto err;", "}", "if (!kvm_check_extension(s, KVM_CAP_DESTROY_MEMORY_REGION_WORKS)) {", "VAR_2 = -EINVAL;", "fprintf(stderr,\n\"KVM kernel module broken (DESTROY_MEMORY_REGION).\\n%s\",\nVAR_1);", "goto err;", "}", "#ifdef KVM_CAP_COALESCED_MMIO\ns->coalesced_mmio = kvm_check_extension(s, KVM_CAP_COALESCED_MMIO);", "#else\ns->coalesced_mmio = 0;", "#endif\ns->broken_set_mem_region = 1;", "#ifdef KVM_CAP_JOIN_MEMORY_REGIONS_WORKS\nVAR_2 = kvm_ioctl(s, KVM_CHECK_EXTENSION, KVM_CAP_JOIN_MEMORY_REGIONS_WORKS);", "if (VAR_2 > 0) {", "s->broken_set_mem_region = 0;", "}", "#endif\nVAR_2 = kvm_arch_init(s, VAR_0);", "if (VAR_2 < 0)\ngoto err;", "kvm_state = s;", "return 0;", "err:\nif (s) {", "if (s->vmfd != -1)\nclose(s->vmfd);", "if (s->fd != -1)\nclose(s->fd);", "}", "qemu_free(s);", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91, 93 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117 ], [ 127 ], [ 129 ], [ 133, 135, 137 ], [ 139 ], [ 141 ], [ 145, 147 ], [ 149, 151 ], [ 153, 157 ], [ 159, 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 173 ], [ 175, 177 ], [ 181 ], [ 185 ], [ 189, 191 ], [ 193, 195 ], [ 197, 199 ], [ 201 ], [ 203 ], [ 207 ], [ 209 ] ]
15,085
static void unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits) { const int mask = (1 << num_bits) - 1; int i, idx, val, alpha_val; idx = 0; alpha_val = mask; do { do { if (get_bits1(gb)) val = get_bits(gb, num_bits); else { int sign; val = get_bits(gb, num_bits == 16 ? 7 : 4); sign = val & 1; val = (val + 2) >> 1; if (sign) val = -val; } alpha_val = (alpha_val + val) & mask; if (num_bits == 16) dst[idx++] = alpha_val >> 6; else dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); if (idx == num_coeffs - 1) break; } while (get_bits1(gb)); val = get_bits(gb, 4); if (!val) val = get_bits(gb, 11); if (idx + val > num_coeffs) val = num_coeffs - idx; if (num_bits == 16) for (i = 0; i < val; i++) dst[idx++] = alpha_val >> 6; else for (i = 0; i < val; i++) dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); } while (idx < num_coeffs); }
false
FFmpeg
30df9789a9745d8e4b1afc10d1a983bfc8816eb9
static void unpack_alpha(GetBitContext *gb, uint16_t *dst, int num_coeffs, const int num_bits) { const int mask = (1 << num_bits) - 1; int i, idx, val, alpha_val; idx = 0; alpha_val = mask; do { do { if (get_bits1(gb)) val = get_bits(gb, num_bits); else { int sign; val = get_bits(gb, num_bits == 16 ? 7 : 4); sign = val & 1; val = (val + 2) >> 1; if (sign) val = -val; } alpha_val = (alpha_val + val) & mask; if (num_bits == 16) dst[idx++] = alpha_val >> 6; else dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); if (idx == num_coeffs - 1) break; } while (get_bits1(gb)); val = get_bits(gb, 4); if (!val) val = get_bits(gb, 11); if (idx + val > num_coeffs) val = num_coeffs - idx; if (num_bits == 16) for (i = 0; i < val; i++) dst[idx++] = alpha_val >> 6; else for (i = 0; i < val; i++) dst[idx++] = (alpha_val << 2) | (alpha_val >> 6); } while (idx < num_coeffs); }
{ "code": [], "line_no": [] }
static void FUNC_0(GetBitContext *VAR_0, uint16_t *VAR_1, int VAR_2, const int VAR_3) { const int VAR_4 = (1 << VAR_3) - 1; int VAR_5, VAR_6, VAR_7, VAR_8; VAR_6 = 0; VAR_8 = VAR_4; do { do { if (get_bits1(VAR_0)) VAR_7 = get_bits(VAR_0, VAR_3); else { int VAR_9; VAR_7 = get_bits(VAR_0, VAR_3 == 16 ? 7 : 4); VAR_9 = VAR_7 & 1; VAR_7 = (VAR_7 + 2) >> 1; if (VAR_9) VAR_7 = -VAR_7; } VAR_8 = (VAR_8 + VAR_7) & VAR_4; if (VAR_3 == 16) VAR_1[VAR_6++] = VAR_8 >> 6; else VAR_1[VAR_6++] = (VAR_8 << 2) | (VAR_8 >> 6); if (VAR_6 == VAR_2 - 1) break; } while (get_bits1(VAR_0)); VAR_7 = get_bits(VAR_0, 4); if (!VAR_7) VAR_7 = get_bits(VAR_0, 11); if (VAR_6 + VAR_7 > VAR_2) VAR_7 = VAR_2 - VAR_6; if (VAR_3 == 16) for (VAR_5 = 0; VAR_5 < VAR_7; VAR_5++) VAR_1[VAR_6++] = VAR_8 >> 6; else for (VAR_5 = 0; VAR_5 < VAR_7; VAR_5++) VAR_1[VAR_6++] = (VAR_8 << 2) | (VAR_8 >> 6); } while (VAR_6 < VAR_2); }
[ "static void FUNC_0(GetBitContext *VAR_0, uint16_t *VAR_1, int VAR_2,\nconst int VAR_3)\n{", "const int VAR_4 = (1 << VAR_3) - 1;", "int VAR_5, VAR_6, VAR_7, VAR_8;", "VAR_6 = 0;", "VAR_8 = VAR_4;", "do {", "do {", "if (get_bits1(VAR_0))\nVAR_7 = get_bits(VAR_0, VAR_3);", "else {", "int VAR_9;", "VAR_7 = get_bits(VAR_0, VAR_3 == 16 ? 7 : 4);", "VAR_9 = VAR_7 & 1;", "VAR_7 = (VAR_7 + 2) >> 1;", "if (VAR_9)\nVAR_7 = -VAR_7;", "}", "VAR_8 = (VAR_8 + VAR_7) & VAR_4;", "if (VAR_3 == 16)\nVAR_1[VAR_6++] = VAR_8 >> 6;", "else\nVAR_1[VAR_6++] = (VAR_8 << 2) | (VAR_8 >> 6);", "if (VAR_6 == VAR_2 - 1)\nbreak;", "} while (get_bits1(VAR_0));", "VAR_7 = get_bits(VAR_0, 4);", "if (!VAR_7)\nVAR_7 = get_bits(VAR_0, 11);", "if (VAR_6 + VAR_7 > VAR_2)\nVAR_7 = VAR_2 - VAR_6;", "if (VAR_3 == 16)\nfor (VAR_5 = 0; VAR_5 < VAR_7; VAR_5++)", "VAR_1[VAR_6++] = VAR_8 >> 6;", "else\nfor (VAR_5 = 0; VAR_5 < VAR_7; VAR_5++)", "VAR_1[VAR_6++] = (VAR_8 << 2) | (VAR_8 >> 6);", "} while (VAR_6 < VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 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 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ] ]
15,087
static int virtconsole_initfn(VirtIOSerialPort *port) { VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port); VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev, vcon->port.dev.info); if (port->id == 0 && !info->is_console) { error_report("Port number 0 on virtio-serial devices reserved for virtconsole devices for backward compatibility."); return -1; } if (vcon->chr) { qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event, vcon); info->have_data = flush_buf; info->guest_open = guest_open; info->guest_close = guest_close; } return 0; }
false
qemu
05e7af694ce00dafdc464ca70306fa9dd6f78dcd
static int virtconsole_initfn(VirtIOSerialPort *port) { VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port); VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev, vcon->port.dev.info); if (port->id == 0 && !info->is_console) { error_report("Port number 0 on virtio-serial devices reserved for virtconsole devices for backward compatibility."); return -1; } if (vcon->chr) { qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event, vcon); info->have_data = flush_buf; info->guest_open = guest_open; info->guest_close = guest_close; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(VirtIOSerialPort *VAR_0) { VirtConsole *vcon = DO_UPCAST(VirtConsole, VAR_0, VAR_0); VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev, vcon->VAR_0.dev.info); if (VAR_0->id == 0 && !info->is_console) { error_report("Port number 0 on virtio-serial devices reserved for virtconsole devices for backward compatibility."); return -1; } if (vcon->chr) { qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event, vcon); info->have_data = flush_buf; info->guest_open = guest_open; info->guest_close = guest_close; } return 0; }
[ "static int FUNC_0(VirtIOSerialPort *VAR_0)\n{", "VirtConsole *vcon = DO_UPCAST(VirtConsole, VAR_0, VAR_0);", "VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev,\nvcon->VAR_0.dev.info);", "if (VAR_0->id == 0 && !info->is_console) {", "error_report(\"Port number 0 on virtio-serial devices reserved for virtconsole devices for backward compatibility.\");", "return -1;", "}", "if (vcon->chr) {", "qemu_chr_add_handlers(vcon->chr, chr_can_read, chr_read, chr_event,\nvcon);", "info->have_data = flush_buf;", "info->guest_open = guest_open;", "info->guest_close = guest_close;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ] ]
15,088
static int ppc_hash32_get_physical_address(CPUPPCState *env, struct mmu_ctx_hash32 *ctx, target_ulong eaddr, int rw, int access_type) { bool real_mode = (access_type == ACCESS_CODE && msr_ir == 0) || (access_type != ACCESS_CODE && msr_dr == 0); if (real_mode) { ctx->raddr = eaddr; ctx->prot = PAGE_READ | PAGE_EXEC | PAGE_WRITE; return 0; } else { int ret = -1; /* Try to find a BAT */ if (env->nb_BATs != 0) { ret = ppc_hash32_get_bat(env, ctx, eaddr, rw, access_type); } if (ret < 0) { /* We didn't match any BAT entry or don't have BATs */ ret = get_segment32(env, ctx, eaddr, rw, access_type); } return ret; } }
false
qemu
91cda45b69e45a089f9989979a65db3f710c9925
static int ppc_hash32_get_physical_address(CPUPPCState *env, struct mmu_ctx_hash32 *ctx, target_ulong eaddr, int rw, int access_type) { bool real_mode = (access_type == ACCESS_CODE && msr_ir == 0) || (access_type != ACCESS_CODE && msr_dr == 0); if (real_mode) { ctx->raddr = eaddr; ctx->prot = PAGE_READ | PAGE_EXEC | PAGE_WRITE; return 0; } else { int ret = -1; if (env->nb_BATs != 0) { ret = ppc_hash32_get_bat(env, ctx, eaddr, rw, access_type); } if (ret < 0) { ret = get_segment32(env, ctx, eaddr, rw, access_type); } return ret; } }
{ "code": [], "line_no": [] }
static int FUNC_0(CPUPPCState *VAR_0, struct mmu_ctx_hash32 *VAR_1, target_ulong VAR_2, int VAR_3, int VAR_4) { bool real_mode = (VAR_4 == ACCESS_CODE && msr_ir == 0) || (VAR_4 != ACCESS_CODE && msr_dr == 0); if (real_mode) { VAR_1->raddr = VAR_2; VAR_1->prot = PAGE_READ | PAGE_EXEC | PAGE_WRITE; return 0; } else { int VAR_5 = -1; if (VAR_0->nb_BATs != 0) { VAR_5 = ppc_hash32_get_bat(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } if (VAR_5 < 0) { VAR_5 = get_segment32(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } return VAR_5; } }
[ "static int FUNC_0(CPUPPCState *VAR_0, struct mmu_ctx_hash32 *VAR_1,\ntarget_ulong VAR_2, int VAR_3,\nint VAR_4)\n{", "bool real_mode = (VAR_4 == ACCESS_CODE && msr_ir == 0)\n|| (VAR_4 != ACCESS_CODE && msr_dr == 0);", "if (real_mode) {", "VAR_1->raddr = VAR_2;", "VAR_1->prot = PAGE_READ | PAGE_EXEC | PAGE_WRITE;", "return 0;", "} else {", "int VAR_5 = -1;", "if (VAR_0->nb_BATs != 0) {", "VAR_5 = ppc_hash32_get_bat(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "}", "if (VAR_5 < 0) {", "VAR_5 = get_segment32(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);", "}", "return VAR_5;", "}", "}" ]
[ 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 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ] ]
15,089
static int vmdk_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { BDRVVmdkState *s = bs->opaque; int ret; uint64_t n, index_in_cluster; VmdkExtent *extent = NULL; uint64_t cluster_offset; while (nb_sectors > 0) { extent = find_extent(s, sector_num, extent); if (!extent) { return -EIO; } ret = get_cluster_offset( bs, extent, NULL, sector_num << 9, 0, &cluster_offset); index_in_cluster = sector_num % extent->cluster_sectors; n = extent->cluster_sectors - index_in_cluster; if (n > nb_sectors) n = nb_sectors; if (ret) { /* if not allocated, try to read from parent image, if exist */ if (bs->backing_hd) { if (!vmdk_is_cid_valid(bs)) return -EINVAL; ret = bdrv_read(bs->backing_hd, sector_num, buf, n); if (ret < 0) return ret; } else { memset(buf, 0, 512 * n); } } else { ret = bdrv_pread(extent->file, cluster_offset + index_in_cluster * 512, buf, n * 512); if (ret < 0) { return ret; } } nb_sectors -= n; sector_num += n; buf += n * 512; } return 0; }
false
qemu
ae261c86aaed62e7acddafab8262a2bf286d40b7
static int vmdk_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { BDRVVmdkState *s = bs->opaque; int ret; uint64_t n, index_in_cluster; VmdkExtent *extent = NULL; uint64_t cluster_offset; while (nb_sectors > 0) { extent = find_extent(s, sector_num, extent); if (!extent) { return -EIO; } ret = get_cluster_offset( bs, extent, NULL, sector_num << 9, 0, &cluster_offset); index_in_cluster = sector_num % extent->cluster_sectors; n = extent->cluster_sectors - index_in_cluster; if (n > nb_sectors) n = nb_sectors; if (ret) { if (bs->backing_hd) { if (!vmdk_is_cid_valid(bs)) return -EINVAL; ret = bdrv_read(bs->backing_hd, sector_num, buf, n); if (ret < 0) return ret; } else { memset(buf, 0, 512 * n); } } else { ret = bdrv_pread(extent->file, cluster_offset + index_in_cluster * 512, buf, n * 512); if (ret < 0) { return ret; } } nb_sectors -= n; sector_num += n; buf += n * 512; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, uint8_t *VAR_2, int VAR_3) { BDRVVmdkState *s = VAR_0->opaque; int VAR_4; uint64_t n, index_in_cluster; VmdkExtent *extent = NULL; uint64_t cluster_offset; while (VAR_3 > 0) { extent = find_extent(s, VAR_1, extent); if (!extent) { return -EIO; } VAR_4 = get_cluster_offset( VAR_0, extent, NULL, VAR_1 << 9, 0, &cluster_offset); index_in_cluster = VAR_1 % extent->cluster_sectors; n = extent->cluster_sectors - index_in_cluster; if (n > VAR_3) n = VAR_3; if (VAR_4) { if (VAR_0->backing_hd) { if (!vmdk_is_cid_valid(VAR_0)) return -EINVAL; VAR_4 = bdrv_read(VAR_0->backing_hd, VAR_1, VAR_2, n); if (VAR_4 < 0) return VAR_4; } else { memset(VAR_2, 0, 512 * n); } } else { VAR_4 = bdrv_pread(extent->file, cluster_offset + index_in_cluster * 512, VAR_2, n * 512); if (VAR_4 < 0) { return VAR_4; } } VAR_3 -= n; VAR_1 += n; VAR_2 += n * 512; } return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nuint8_t *VAR_2, int VAR_3)\n{", "BDRVVmdkState *s = VAR_0->opaque;", "int VAR_4;", "uint64_t n, index_in_cluster;", "VmdkExtent *extent = NULL;", "uint64_t cluster_offset;", "while (VAR_3 > 0) {", "extent = find_extent(s, VAR_1, extent);", "if (!extent) {", "return -EIO;", "}", "VAR_4 = get_cluster_offset(\nVAR_0, extent, NULL,\nVAR_1 << 9, 0, &cluster_offset);", "index_in_cluster = VAR_1 % extent->cluster_sectors;", "n = extent->cluster_sectors - index_in_cluster;", "if (n > VAR_3)\nn = VAR_3;", "if (VAR_4) {", "if (VAR_0->backing_hd) {", "if (!vmdk_is_cid_valid(VAR_0))\nreturn -EINVAL;", "VAR_4 = bdrv_read(VAR_0->backing_hd, VAR_1, VAR_2, n);", "if (VAR_4 < 0)\nreturn VAR_4;", "} else {", "memset(VAR_2, 0, 512 * n);", "}", "} else {", "VAR_4 = bdrv_pread(extent->file,\ncluster_offset + index_in_cluster * 512,\nVAR_2, n * 512);", "if (VAR_4 < 0) {", "return VAR_4;", "}", "}", "VAR_3 -= n;", "VAR_1 += n;", "VAR_2 += n * 512;", "}", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ] ]
15,090
static bool migrate_params_check(MigrationParameters *params, Error **errp) { if (params->has_compress_level && (params->compress_level < 0 || params->compress_level > 9)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", "is invalid, it should be in the range of 0 to 9"); return false; } if (params->has_compress_threads && (params->compress_threads < 1 || params->compress_threads > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_threads", "is invalid, it should be in the range of 1 to 255"); return false; } if (params->has_decompress_threads && (params->decompress_threads < 1 || params->decompress_threads > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "decompress_threads", "is invalid, it should be in the range of 1 to 255"); return false; } if (params->has_cpu_throttle_initial && (params->cpu_throttle_initial < 1 || params->cpu_throttle_initial > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_initial", "an integer in the range of 1 to 99"); return false; } if (params->has_cpu_throttle_increment && (params->cpu_throttle_increment < 1 || params->cpu_throttle_increment > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_increment", "an integer in the range of 1 to 99"); return false; } if (params->has_max_bandwidth && (params->max_bandwidth < 0 || params->max_bandwidth > SIZE_MAX)) { error_setg(errp, "Parameter 'max_bandwidth' expects an integer in the" " range of 0 to %zu bytes/second", SIZE_MAX); return false; } if (params->has_downtime_limit && (params->downtime_limit < 0 || params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { error_setg(errp, "Parameter 'downtime_limit' expects an integer in " "the range of 0 to %d milliseconds", MAX_MIGRATE_DOWNTIME); return false; } if (params->has_x_checkpoint_delay && (params->x_checkpoint_delay < 0)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "x_checkpoint_delay", "is invalid, it should be positive"); return false; } if (params->has_x_multifd_channels && (params->x_multifd_channels < 1 || params->x_multifd_channels > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_channels", "is invalid, it should be in the range of 1 to 255"); return false; } if (params->has_x_multifd_page_count && (params->x_multifd_page_count < 1 || params->x_multifd_page_count > 10000)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_page_count", "is invalid, it should be in the range of 1 to 10000"); return false; } if (params->has_xbzrle_cache_size && (params->xbzrle_cache_size < qemu_target_page_size() || !is_power_of_2(params->xbzrle_cache_size))) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "xbzrle_cache_size", "is invalid, it should be bigger than target page size" " and a power of two"); return false; } return true; }
false
qemu
741d4086c856320807a2575389d7c0505578270b
static bool migrate_params_check(MigrationParameters *params, Error **errp) { if (params->has_compress_level && (params->compress_level < 0 || params->compress_level > 9)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", "is invalid, it should be in the range of 0 to 9"); return false; } if (params->has_compress_threads && (params->compress_threads < 1 || params->compress_threads > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_threads", "is invalid, it should be in the range of 1 to 255"); return false; } if (params->has_decompress_threads && (params->decompress_threads < 1 || params->decompress_threads > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "decompress_threads", "is invalid, it should be in the range of 1 to 255"); return false; } if (params->has_cpu_throttle_initial && (params->cpu_throttle_initial < 1 || params->cpu_throttle_initial > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_initial", "an integer in the range of 1 to 99"); return false; } if (params->has_cpu_throttle_increment && (params->cpu_throttle_increment < 1 || params->cpu_throttle_increment > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_increment", "an integer in the range of 1 to 99"); return false; } if (params->has_max_bandwidth && (params->max_bandwidth < 0 || params->max_bandwidth > SIZE_MAX)) { error_setg(errp, "Parameter 'max_bandwidth' expects an integer in the" " range of 0 to %zu bytes/second", SIZE_MAX); return false; } if (params->has_downtime_limit && (params->downtime_limit < 0 || params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { error_setg(errp, "Parameter 'downtime_limit' expects an integer in " "the range of 0 to %d milliseconds", MAX_MIGRATE_DOWNTIME); return false; } if (params->has_x_checkpoint_delay && (params->x_checkpoint_delay < 0)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "x_checkpoint_delay", "is invalid, it should be positive"); return false; } if (params->has_x_multifd_channels && (params->x_multifd_channels < 1 || params->x_multifd_channels > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_channels", "is invalid, it should be in the range of 1 to 255"); return false; } if (params->has_x_multifd_page_count && (params->x_multifd_page_count < 1 || params->x_multifd_page_count > 10000)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_page_count", "is invalid, it should be in the range of 1 to 10000"); return false; } if (params->has_xbzrle_cache_size && (params->xbzrle_cache_size < qemu_target_page_size() || !is_power_of_2(params->xbzrle_cache_size))) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "xbzrle_cache_size", "is invalid, it should be bigger than target page size" " and a power of two"); return false; } return true; }
{ "code": [], "line_no": [] }
static bool FUNC_0(MigrationParameters *params, Error **errp) { if (params->has_compress_level && (params->compress_level < 0 || params->compress_level > 9)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_level", "is invalid, it should be in the range of 0 to 9"); return false; } if (params->has_compress_threads && (params->compress_threads < 1 || params->compress_threads > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "compress_threads", "is invalid, it should be in the range of 1 to 255"); return false; } if (params->has_decompress_threads && (params->decompress_threads < 1 || params->decompress_threads > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "decompress_threads", "is invalid, it should be in the range of 1 to 255"); return false; } if (params->has_cpu_throttle_initial && (params->cpu_throttle_initial < 1 || params->cpu_throttle_initial > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_initial", "an integer in the range of 1 to 99"); return false; } if (params->has_cpu_throttle_increment && (params->cpu_throttle_increment < 1 || params->cpu_throttle_increment > 99)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu_throttle_increment", "an integer in the range of 1 to 99"); return false; } if (params->has_max_bandwidth && (params->max_bandwidth < 0 || params->max_bandwidth > SIZE_MAX)) { error_setg(errp, "Parameter 'max_bandwidth' expects an integer in the" " range of 0 to %zu bytes/second", SIZE_MAX); return false; } if (params->has_downtime_limit && (params->downtime_limit < 0 || params->downtime_limit > MAX_MIGRATE_DOWNTIME)) { error_setg(errp, "Parameter 'downtime_limit' expects an integer in " "the range of 0 to %d milliseconds", MAX_MIGRATE_DOWNTIME); return false; } if (params->has_x_checkpoint_delay && (params->x_checkpoint_delay < 0)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "x_checkpoint_delay", "is invalid, it should be positive"); return false; } if (params->has_x_multifd_channels && (params->x_multifd_channels < 1 || params->x_multifd_channels > 255)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_channels", "is invalid, it should be in the range of 1 to 255"); return false; } if (params->has_x_multifd_page_count && (params->x_multifd_page_count < 1 || params->x_multifd_page_count > 10000)) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "multifd_page_count", "is invalid, it should be in the range of 1 to 10000"); return false; } if (params->has_xbzrle_cache_size && (params->xbzrle_cache_size < qemu_target_page_size() || !is_power_of_2(params->xbzrle_cache_size))) { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "xbzrle_cache_size", "is invalid, it should be bigger than target page size" " and a power of two"); return false; } return true; }
[ "static bool FUNC_0(MigrationParameters *params, Error **errp)\n{", "if (params->has_compress_level &&\n(params->compress_level < 0 || params->compress_level > 9)) {", "error_setg(errp, QERR_INVALID_PARAMETER_VALUE, \"compress_level\",\n\"is invalid, it should be in the range of 0 to 9\");", "return false;", "}", "if (params->has_compress_threads &&\n(params->compress_threads < 1 || params->compress_threads > 255)) {", "error_setg(errp, QERR_INVALID_PARAMETER_VALUE,\n\"compress_threads\",\n\"is invalid, it should be in the range of 1 to 255\");", "return false;", "}", "if (params->has_decompress_threads &&\n(params->decompress_threads < 1 || params->decompress_threads > 255)) {", "error_setg(errp, QERR_INVALID_PARAMETER_VALUE,\n\"decompress_threads\",\n\"is invalid, it should be in the range of 1 to 255\");", "return false;", "}", "if (params->has_cpu_throttle_initial &&\n(params->cpu_throttle_initial < 1 ||\nparams->cpu_throttle_initial > 99)) {", "error_setg(errp, QERR_INVALID_PARAMETER_VALUE,\n\"cpu_throttle_initial\",\n\"an integer in the range of 1 to 99\");", "return false;", "}", "if (params->has_cpu_throttle_increment &&\n(params->cpu_throttle_increment < 1 ||\nparams->cpu_throttle_increment > 99)) {", "error_setg(errp, QERR_INVALID_PARAMETER_VALUE,\n\"cpu_throttle_increment\",\n\"an integer in the range of 1 to 99\");", "return false;", "}", "if (params->has_max_bandwidth &&\n(params->max_bandwidth < 0 || params->max_bandwidth > SIZE_MAX)) {", "error_setg(errp, \"Parameter 'max_bandwidth' expects an integer in the\"\n\" range of 0 to %zu bytes/second\", SIZE_MAX);", "return false;", "}", "if (params->has_downtime_limit &&\n(params->downtime_limit < 0 ||\nparams->downtime_limit > MAX_MIGRATE_DOWNTIME)) {", "error_setg(errp, \"Parameter 'downtime_limit' expects an integer in \"\n\"the range of 0 to %d milliseconds\",\nMAX_MIGRATE_DOWNTIME);", "return false;", "}", "if (params->has_x_checkpoint_delay && (params->x_checkpoint_delay < 0)) {", "error_setg(errp, QERR_INVALID_PARAMETER_VALUE,\n\"x_checkpoint_delay\",\n\"is invalid, it should be positive\");", "return false;", "}", "if (params->has_x_multifd_channels &&\n(params->x_multifd_channels < 1 || params->x_multifd_channels > 255)) {", "error_setg(errp, QERR_INVALID_PARAMETER_VALUE,\n\"multifd_channels\",\n\"is invalid, it should be in the range of 1 to 255\");", "return false;", "}", "if (params->has_x_multifd_page_count &&\n(params->x_multifd_page_count < 1 ||\nparams->x_multifd_page_count > 10000)) {", "error_setg(errp, QERR_INVALID_PARAMETER_VALUE,\n\"multifd_page_count\",\n\"is invalid, it should be in the range of 1 to 10000\");", "return false;", "}", "if (params->has_xbzrle_cache_size &&\n(params->xbzrle_cache_size < qemu_target_page_size() ||\n!is_power_of_2(params->xbzrle_cache_size))) {", "error_setg(errp, QERR_INVALID_PARAMETER_VALUE,\n\"xbzrle_cache_size\",\n\"is invalid, it should be bigger than target page size\"\n\" and a power of two\");", "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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 23, 25, 27 ], [ 29 ], [ 31 ], [ 35, 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 51, 53, 55 ], [ 57, 59, 61 ], [ 63 ], [ 65 ], [ 69, 71, 73 ], [ 75, 77, 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 101, 103, 105 ], [ 107, 109, 111 ], [ 113 ], [ 115 ], [ 119 ], [ 121, 123, 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135, 137, 139 ], [ 141 ], [ 143 ], [ 145, 147, 149 ], [ 151, 153, 155 ], [ 157 ], [ 159 ], [ 163, 165, 167 ], [ 169, 171, 173, 175 ], [ 177 ], [ 179 ], [ 183 ], [ 185 ] ]
15,091
int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, struct in_addr addr, int port) { struct ex_list *tmp_ptr; /* First, check if the port is "bound" */ for (tmp_ptr = *ex_ptr; tmp_ptr; tmp_ptr = tmp_ptr->ex_next) { if (port == tmp_ptr->ex_fport && addr.s_addr == tmp_ptr->ex_addr.s_addr) return -1; } tmp_ptr = *ex_ptr; *ex_ptr = (struct ex_list *)malloc(sizeof(struct ex_list)); (*ex_ptr)->ex_fport = port; (*ex_ptr)->ex_addr = addr; (*ex_ptr)->ex_pty = do_pty; (*ex_ptr)->ex_exec = (do_pty == 3) ? exec : strdup(exec); (*ex_ptr)->ex_next = tmp_ptr; return 0; }
true
qemu
2fd5d864099dd38b43b595e9e3375dad2f76049b
int add_exec(struct ex_list **ex_ptr, int do_pty, char *exec, struct in_addr addr, int port) { struct ex_list *tmp_ptr; for (tmp_ptr = *ex_ptr; tmp_ptr; tmp_ptr = tmp_ptr->ex_next) { if (port == tmp_ptr->ex_fport && addr.s_addr == tmp_ptr->ex_addr.s_addr) return -1; } tmp_ptr = *ex_ptr; *ex_ptr = (struct ex_list *)malloc(sizeof(struct ex_list)); (*ex_ptr)->ex_fport = port; (*ex_ptr)->ex_addr = addr; (*ex_ptr)->ex_pty = do_pty; (*ex_ptr)->ex_exec = (do_pty == 3) ? exec : strdup(exec); (*ex_ptr)->ex_next = tmp_ptr; return 0; }
{ "code": [ "\t*ex_ptr = (struct ex_list *)malloc(sizeof(struct ex_list));", "\t(*ex_ptr)->ex_exec = (do_pty == 3) ? exec : strdup(exec);" ], "line_no": [ 27, 35 ] }
int FUNC_0(struct ex_list **VAR_0, int VAR_1, char *VAR_2, struct in_addr VAR_3, int VAR_4) { struct ex_list *VAR_5; for (VAR_5 = *VAR_0; VAR_5; VAR_5 = VAR_5->ex_next) { if (VAR_4 == VAR_5->ex_fport && VAR_3.s_addr == VAR_5->ex_addr.s_addr) return -1; } VAR_5 = *VAR_0; *VAR_0 = (struct ex_list *)malloc(sizeof(struct ex_list)); (*VAR_0)->ex_fport = VAR_4; (*VAR_0)->ex_addr = VAR_3; (*VAR_0)->ex_pty = VAR_1; (*VAR_0)->ex_exec = (VAR_1 == 3) ? VAR_2 : strdup(VAR_2); (*VAR_0)->ex_next = VAR_5; return 0; }
[ "int FUNC_0(struct ex_list **VAR_0, int VAR_1, char *VAR_2,\nstruct in_addr VAR_3, int VAR_4)\n{", "struct ex_list *VAR_5;", "for (VAR_5 = *VAR_0; VAR_5; VAR_5 = VAR_5->ex_next) {", "if (VAR_4 == VAR_5->ex_fport &&\nVAR_3.s_addr == VAR_5->ex_addr.s_addr)\nreturn -1;", "}", "VAR_5 = *VAR_0;", "*VAR_0 = (struct ex_list *)malloc(sizeof(struct ex_list));", "(*VAR_0)->ex_fport = VAR_4;", "(*VAR_0)->ex_addr = VAR_3;", "(*VAR_0)->ex_pty = VAR_1;", "(*VAR_0)->ex_exec = (VAR_1 == 3) ? VAR_2 : strdup(VAR_2);", "(*VAR_0)->ex_next = VAR_5;", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 13 ], [ 15, 17, 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
15,092
static void dec_sextb(DisasContext *dc) { LOG_DIS("sextb r%d, r%d\n", dc->r2, dc->r0); if (!(dc->env->features & LM32_FEATURE_SIGN_EXTEND)) { cpu_abort(dc->env, "hardware sign extender is not available\n"); } tcg_gen_ext8s_tl(cpu_R[dc->r2], cpu_R[dc->r0]); }
true
qemu
3604a76fea6ff37738d4a8f596be38407be74a83
static void dec_sextb(DisasContext *dc) { LOG_DIS("sextb r%d, r%d\n", dc->r2, dc->r0); if (!(dc->env->features & LM32_FEATURE_SIGN_EXTEND)) { cpu_abort(dc->env, "hardware sign extender is not available\n"); } tcg_gen_ext8s_tl(cpu_R[dc->r2], cpu_R[dc->r0]); }
{ "code": [ " cpu_abort(dc->env, \"hardware sign extender is not available\\n\");", " cpu_abort(dc->env, \"hardware sign extender is not available\\n\");" ], "line_no": [ 11, 11 ] }
static void FUNC_0(DisasContext *VAR_0) { LOG_DIS("sextb r%d, r%d\n", VAR_0->r2, VAR_0->r0); if (!(VAR_0->env->features & LM32_FEATURE_SIGN_EXTEND)) { cpu_abort(VAR_0->env, "hardware sign extender is not available\n"); } tcg_gen_ext8s_tl(cpu_R[VAR_0->r2], cpu_R[VAR_0->r0]); }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "LOG_DIS(\"sextb r%d, r%d\\n\", VAR_0->r2, VAR_0->r0);", "if (!(VAR_0->env->features & LM32_FEATURE_SIGN_EXTEND)) {", "cpu_abort(VAR_0->env, \"hardware sign extender is not available\\n\");", "}", "tcg_gen_ext8s_tl(cpu_R[VAR_0->r2], cpu_R[VAR_0->r0]);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ] ]
15,093
static void mdct512(AC3MDCTContext *mdct, int32_t *out, int16_t *in) { int i, re, im, n, n2, n4; int16_t *rot = mdct->rot_tmp; IComplex *x = mdct->cplx_tmp; n = 1 << mdct->nbits; n2 = n >> 1; n4 = n >> 2; /* shift to simplify computations */ for (i = 0; i <n4; i++) rot[i] = -in[i + 3*n4]; memcpy(&rot[n4], &in[0], 3*n4*sizeof(*in)); /* pre rotation */ for (i = 0; i < n4; i++) { re = ((int)rot[ 2*i] - (int)rot[ n-1-2*i]) >> 1; im = -((int)rot[n2+2*i] - (int)rot[n2-1-2*i]) >> 1; CMUL(x[i].re, x[i].im, re, im, -mdct->xcos1[i], mdct->xsin1[i]); } fft(mdct, x, mdct->nbits - 2); /* post rotation */ for (i = 0; i < n4; i++) { re = x[i].re; im = x[i].im; CMUL(out[n2-1-2*i], out[2*i], re, im, mdct->xsin1[i], mdct->xcos1[i]); } }
true
FFmpeg
323e6fead07c75f418e4b60704a4f437bb3483b2
static void mdct512(AC3MDCTContext *mdct, int32_t *out, int16_t *in) { int i, re, im, n, n2, n4; int16_t *rot = mdct->rot_tmp; IComplex *x = mdct->cplx_tmp; n = 1 << mdct->nbits; n2 = n >> 1; n4 = n >> 2; for (i = 0; i <n4; i++) rot[i] = -in[i + 3*n4]; memcpy(&rot[n4], &in[0], 3*n4*sizeof(*in)); for (i = 0; i < n4; i++) { re = ((int)rot[ 2*i] - (int)rot[ n-1-2*i]) >> 1; im = -((int)rot[n2+2*i] - (int)rot[n2-1-2*i]) >> 1; CMUL(x[i].re, x[i].im, re, im, -mdct->xcos1[i], mdct->xsin1[i]); } fft(mdct, x, mdct->nbits - 2); for (i = 0; i < n4; i++) { re = x[i].re; im = x[i].im; CMUL(out[n2-1-2*i], out[2*i], re, im, mdct->xsin1[i], mdct->xcos1[i]); } }
{ "code": [ " CMUL(x[i].re, x[i].im, re, im, -mdct->xcos1[i], mdct->xsin1[i]);", " CMUL(out[n2-1-2*i], out[2*i], re, im, mdct->xsin1[i], mdct->xcos1[i]);" ], "line_no": [ 39, 57 ] }
static void FUNC_0(AC3MDCTContext *VAR_0, int32_t *VAR_1, int16_t *VAR_2) { int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; int16_t *rot = VAR_0->rot_tmp; IComplex *x = VAR_0->cplx_tmp; VAR_6 = 1 << VAR_0->nbits; VAR_7 = VAR_6 >> 1; VAR_8 = VAR_6 >> 2; for (VAR_3 = 0; VAR_3 <VAR_8; VAR_3++) rot[VAR_3] = -VAR_2[VAR_3 + 3*VAR_8]; memcpy(&rot[VAR_8], &VAR_2[0], 3*VAR_8*sizeof(*VAR_2)); for (VAR_3 = 0; VAR_3 < VAR_8; VAR_3++) { VAR_4 = ((int)rot[ 2*VAR_3] - (int)rot[ VAR_6-1-2*VAR_3]) >> 1; VAR_5 = -((int)rot[VAR_7+2*VAR_3] - (int)rot[VAR_7-1-2*VAR_3]) >> 1; CMUL(x[VAR_3].VAR_4, x[VAR_3].VAR_5, VAR_4, VAR_5, -VAR_0->xcos1[VAR_3], VAR_0->xsin1[VAR_3]); } fft(VAR_0, x, VAR_0->nbits - 2); for (VAR_3 = 0; VAR_3 < VAR_8; VAR_3++) { VAR_4 = x[VAR_3].VAR_4; VAR_5 = x[VAR_3].VAR_5; CMUL(VAR_1[VAR_7-1-2*VAR_3], VAR_1[2*VAR_3], VAR_4, VAR_5, VAR_0->xsin1[VAR_3], VAR_0->xcos1[VAR_3]); } }
[ "static void FUNC_0(AC3MDCTContext *VAR_0, int32_t *VAR_1, int16_t *VAR_2)\n{", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;", "int16_t *rot = VAR_0->rot_tmp;", "IComplex *x = VAR_0->cplx_tmp;", "VAR_6 = 1 << VAR_0->nbits;", "VAR_7 = VAR_6 >> 1;", "VAR_8 = VAR_6 >> 2;", "for (VAR_3 = 0; VAR_3 <VAR_8; VAR_3++)", "rot[VAR_3] = -VAR_2[VAR_3 + 3*VAR_8];", "memcpy(&rot[VAR_8], &VAR_2[0], 3*VAR_8*sizeof(*VAR_2));", "for (VAR_3 = 0; VAR_3 < VAR_8; VAR_3++) {", "VAR_4 = ((int)rot[ 2*VAR_3] - (int)rot[ VAR_6-1-2*VAR_3]) >> 1;", "VAR_5 = -((int)rot[VAR_7+2*VAR_3] - (int)rot[VAR_7-1-2*VAR_3]) >> 1;", "CMUL(x[VAR_3].VAR_4, x[VAR_3].VAR_5, VAR_4, VAR_5, -VAR_0->xcos1[VAR_3], VAR_0->xsin1[VAR_3]);", "}", "fft(VAR_0, x, VAR_0->nbits - 2);", "for (VAR_3 = 0; VAR_3 < VAR_8; VAR_3++) {", "VAR_4 = x[VAR_3].VAR_4;", "VAR_5 = x[VAR_3].VAR_5;", "CMUL(VAR_1[VAR_7-1-2*VAR_3], VAR_1[2*VAR_3], VAR_4, VAR_5, VAR_0->xsin1[VAR_3], VAR_0->xcos1[VAR_3]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ] ]
15,095
static uint32_t pm_ioport_readw(void *opaque, uint32_t addr) { VT686PMState *s = opaque; uint32_t val; addr &= 0x0f; switch (addr) { case 0x00: val = acpi_pm1_evt_get_sts(&s->ar, s->ar.tmr.overflow_time); break; case 0x02: val = s->ar.pm1.evt.en; break; case 0x04: val = s->ar.pm1.cnt.cnt; break; default: val = 0; break; } DPRINTF("PM readw port=0x%04x val=0x%02x\n", addr, val); return val; }
true
qemu
2886be1b01c274570fa139748a402207482405bd
static uint32_t pm_ioport_readw(void *opaque, uint32_t addr) { VT686PMState *s = opaque; uint32_t val; addr &= 0x0f; switch (addr) { case 0x00: val = acpi_pm1_evt_get_sts(&s->ar, s->ar.tmr.overflow_time); break; case 0x02: val = s->ar.pm1.evt.en; break; case 0x04: val = s->ar.pm1.cnt.cnt; break; default: val = 0; break; } DPRINTF("PM readw port=0x%04x val=0x%02x\n", addr, val); return val; }
{ "code": [ " val = acpi_pm1_evt_get_sts(&s->ar, s->ar.tmr.overflow_time);", " val = acpi_pm1_evt_get_sts(&s->ar, s->ar.tmr.overflow_time);" ], "line_no": [ 17, 17 ] }
static uint32_t FUNC_0(void *opaque, uint32_t addr) { VT686PMState *s = opaque; uint32_t val; addr &= 0x0f; switch (addr) { case 0x00: val = acpi_pm1_evt_get_sts(&s->ar, s->ar.tmr.overflow_time); break; case 0x02: val = s->ar.pm1.evt.en; break; case 0x04: val = s->ar.pm1.cnt.cnt; break; default: val = 0; break; } DPRINTF("PM readw port=0x%04x val=0x%02x\n", addr, val); return val; }
[ "static uint32_t FUNC_0(void *opaque, uint32_t addr)\n{", "VT686PMState *s = opaque;", "uint32_t val;", "addr &= 0x0f;", "switch (addr) {", "case 0x00:\nval = acpi_pm1_evt_get_sts(&s->ar, s->ar.tmr.overflow_time);", "break;", "case 0x02:\nval = s->ar.pm1.evt.en;", "break;", "case 0x04:\nval = s->ar.pm1.cnt.cnt;", "break;", "default:\nval = 0;", "break;", "}", "DPRINTF(\"PM readw port=0x%04x val=0x%02x\\n\", addr, val);", "return val;", "}" ]
[ 0, 0, 0, 0, 0, 1, 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 ] ]
15,096
static int get_cod(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c, uint8_t *properties) { Jpeg2000CodingStyle tmp; int compno, ret; if (bytestream2_get_bytes_left(&s->g) < 5) tmp.csty = bytestream2_get_byteu(&s->g); // get progression order tmp.prog_order = bytestream2_get_byteu(&s->g); tmp.nlayers = bytestream2_get_be16u(&s->g); tmp.mct = bytestream2_get_byteu(&s->g); // multiple component transformation if ((ret = get_cox(s, &tmp)) < 0) return ret; for (compno = 0; compno < s->ncomponents; compno++) if (!(properties[compno] & HAD_COC)) memcpy(c + compno, &tmp, sizeof(tmp)); return 0;
true
FFmpeg
cf04af2086be105ff86088357b83d672d38417d9
static int get_cod(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *c, uint8_t *properties) { Jpeg2000CodingStyle tmp; int compno, ret; if (bytestream2_get_bytes_left(&s->g) < 5) tmp.csty = bytestream2_get_byteu(&s->g); tmp.prog_order = bytestream2_get_byteu(&s->g); tmp.nlayers = bytestream2_get_be16u(&s->g); tmp.mct = bytestream2_get_byteu(&s->g); if ((ret = get_cox(s, &tmp)) < 0) return ret; for (compno = 0; compno < s->ncomponents; compno++) if (!(properties[compno] & HAD_COC)) memcpy(c + compno, &tmp, sizeof(tmp)); return 0;
{ "code": [], "line_no": [] }
static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000CodingStyle *VAR_1, uint8_t *VAR_2) { Jpeg2000CodingStyle tmp; int VAR_3, VAR_4; if (bytestream2_get_bytes_left(&VAR_0->g) < 5) tmp.csty = bytestream2_get_byteu(&VAR_0->g); tmp.prog_order = bytestream2_get_byteu(&VAR_0->g); tmp.nlayers = bytestream2_get_be16u(&VAR_0->g); tmp.mct = bytestream2_get_byteu(&VAR_0->g); if ((VAR_4 = get_cox(VAR_0, &tmp)) < 0) return VAR_4; for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++) if (!(VAR_2[VAR_3] & HAD_COC)) memcpy(VAR_1 + VAR_3, &tmp, sizeof(tmp)); return 0;
[ "static int FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000CodingStyle *VAR_1,\nuint8_t *VAR_2)\n{", "Jpeg2000CodingStyle tmp;", "int VAR_3, VAR_4;", "if (bytestream2_get_bytes_left(&VAR_0->g) < 5)\ntmp.csty = bytestream2_get_byteu(&VAR_0->g);", "tmp.prog_order = bytestream2_get_byteu(&VAR_0->g);", "tmp.nlayers = bytestream2_get_be16u(&VAR_0->g);", "tmp.mct = bytestream2_get_byteu(&VAR_0->g);", "if ((VAR_4 = get_cox(VAR_0, &tmp)) < 0)\nreturn VAR_4;", "for (VAR_3 = 0; VAR_3 < VAR_0->ncomponents; VAR_3++)", "if (!(VAR_2[VAR_3] & HAD_COC))\nmemcpy(VAR_1 + VAR_3, &tmp, sizeof(tmp));", "return 0;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3 ], [ 4 ], [ 5 ], [ 6, 7 ], [ 9 ], [ 10 ], [ 11 ], [ 12, 13 ], [ 14 ], [ 15, 16 ], [ 17 ] ]
15,097
static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype) { int block_size; const ModeTab *mtab = tctx->mtab; int size = tctx->avctx->channels*mtab->fmode[ftype].sub; int16_t *tmp_perm = (int16_t *) tctx->tmp_buf; if (ftype == FT_PPC) { size = tctx->avctx->channels; block_size = mtab->ppc_shape_len; } else block_size = mtab->size / mtab->fmode[ftype].sub; permutate_in_line(tmp_perm, tctx->n_div[ftype], size, block_size, tctx->length[ftype], tctx->length_change[ftype], ftype); transpose_perm(tctx->permut[ftype], tmp_perm, tctx->n_div[ftype], tctx->length[ftype], tctx->length_change[ftype]); linear_perm(tctx->permut[ftype], tctx->permut[ftype], size, size*block_size); }
true
FFmpeg
4bf2e7c5f1c0ad3997fd7c9859c16db8e4e16df6
static av_cold void construct_perm_table(TwinContext *tctx,enum FrameType ftype) { int block_size; const ModeTab *mtab = tctx->mtab; int size = tctx->avctx->channels*mtab->fmode[ftype].sub; int16_t *tmp_perm = (int16_t *) tctx->tmp_buf; if (ftype == FT_PPC) { size = tctx->avctx->channels; block_size = mtab->ppc_shape_len; } else block_size = mtab->size / mtab->fmode[ftype].sub; permutate_in_line(tmp_perm, tctx->n_div[ftype], size, block_size, tctx->length[ftype], tctx->length_change[ftype], ftype); transpose_perm(tctx->permut[ftype], tmp_perm, tctx->n_div[ftype], tctx->length[ftype], tctx->length_change[ftype]); linear_perm(tctx->permut[ftype], tctx->permut[ftype], size, size*block_size); }
{ "code": [ " int size = tctx->avctx->channels*mtab->fmode[ftype].sub;", " } else" ], "line_no": [ 9, 21 ] }
static av_cold void FUNC_0(TwinContext *tctx,enum FrameType ftype) { int VAR_0; const ModeTab *VAR_1 = tctx->VAR_1; int VAR_2 = tctx->avctx->channels*VAR_1->fmode[ftype].sub; int16_t *tmp_perm = (int16_t *) tctx->tmp_buf; if (ftype == FT_PPC) { VAR_2 = tctx->avctx->channels; VAR_0 = VAR_1->ppc_shape_len; } else VAR_0 = VAR_1->VAR_2 / VAR_1->fmode[ftype].sub; permutate_in_line(tmp_perm, tctx->n_div[ftype], VAR_2, VAR_0, tctx->length[ftype], tctx->length_change[ftype], ftype); transpose_perm(tctx->permut[ftype], tmp_perm, tctx->n_div[ftype], tctx->length[ftype], tctx->length_change[ftype]); linear_perm(tctx->permut[ftype], tctx->permut[ftype], VAR_2, VAR_2*VAR_0); }
[ "static av_cold void FUNC_0(TwinContext *tctx,enum FrameType ftype)\n{", "int VAR_0;", "const ModeTab *VAR_1 = tctx->VAR_1;", "int VAR_2 = tctx->avctx->channels*VAR_1->fmode[ftype].sub;", "int16_t *tmp_perm = (int16_t *) tctx->tmp_buf;", "if (ftype == FT_PPC) {", "VAR_2 = tctx->avctx->channels;", "VAR_0 = VAR_1->ppc_shape_len;", "} else", "VAR_0 = VAR_1->VAR_2 / VAR_1->fmode[ftype].sub;", "permutate_in_line(tmp_perm, tctx->n_div[ftype], VAR_2,\nVAR_0, tctx->length[ftype],\ntctx->length_change[ftype], ftype);", "transpose_perm(tctx->permut[ftype], tmp_perm, tctx->n_div[ftype],\ntctx->length[ftype], tctx->length_change[ftype]);", "linear_perm(tctx->permut[ftype], tctx->permut[ftype], VAR_2,\nVAR_2*VAR_0);", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27, 29, 31 ], [ 35, 37 ], [ 41, 43 ], [ 45 ] ]
15,098
yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum PixelFormat target, int hasAlpha) { const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; int i; if (uvalpha < 2048) { for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2 ] + 64) >> 7; int Y2 = (buf0[i * 2 + 1] + 64) >> 7; int U = (ubuf0[i] + 64) >> 7; int V = (vbuf0[i] + 64) >> 7; int A1, A2; const void *r = c->table_rV[V + YUVRGB_TABLE_HEADROOM], *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]), *b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; if (hasAlpha) { A1 = (abuf0[i * 2 ] + 64) >> 7; A2 = (abuf0[i * 2 + 1] + 64) >> 7; } yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, r, g, b, y, target, hasAlpha); } } else { const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2 ] + 64) >> 7; int Y2 = (buf0[i * 2 + 1] + 64) >> 7; int U = (ubuf0[i] + ubuf1[i] + 128) >> 8; int V = (vbuf0[i] + vbuf1[i] + 128) >> 8; int A1, A2; const void *r = c->table_rV[V + YUVRGB_TABLE_HEADROOM], *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]), *b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; if (hasAlpha) { A1 = (abuf0[i * 2 ] + 64) >> 7; A2 = (abuf0[i * 2 + 1] + 64) >> 7; } yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, r, g, b, y, target, hasAlpha); } } }
true
FFmpeg
4a9f466b997e0c44d1e304a7a9c5d5de0b0868c7
yuv2rgb_1_c_template(SwsContext *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum PixelFormat target, int hasAlpha) { const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; int i; if (uvalpha < 2048) { for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2 ] + 64) >> 7; int Y2 = (buf0[i * 2 + 1] + 64) >> 7; int U = (ubuf0[i] + 64) >> 7; int V = (vbuf0[i] + 64) >> 7; int A1, A2; const void *r = c->table_rV[V + YUVRGB_TABLE_HEADROOM], *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]), *b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; if (hasAlpha) { A1 = (abuf0[i * 2 ] + 64) >> 7; A2 = (abuf0[i * 2 + 1] + 64) >> 7; } yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, r, g, b, y, target, hasAlpha); } } else { const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; for (i = 0; i < (dstW >> 1); i++) { int Y1 = (buf0[i * 2 ] + 64) >> 7; int Y2 = (buf0[i * 2 + 1] + 64) >> 7; int U = (ubuf0[i] + ubuf1[i] + 128) >> 8; int V = (vbuf0[i] + vbuf1[i] + 128) >> 8; int A1, A2; const void *r = c->table_rV[V + YUVRGB_TABLE_HEADROOM], *g = (c->table_gU[U + YUVRGB_TABLE_HEADROOM] + c->table_gV[V + YUVRGB_TABLE_HEADROOM]), *b = c->table_bU[U + YUVRGB_TABLE_HEADROOM]; if (hasAlpha) { A1 = (abuf0[i * 2 ] + 64) >> 7; A2 = (abuf0[i * 2 + 1] + 64) >> 7; } yuv2rgb_write(dest, i, Y1, Y2, hasAlpha ? A1 : 0, hasAlpha ? A2 : 0, r, g, b, y, target, hasAlpha); } } }
{ "code": [ " A1 = (abuf0[i * 2 ] + 64) >> 7;", " A2 = (abuf0[i * 2 + 1] + 64) >> 7;" ], "line_no": [ 43, 45 ] }
FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1, const int16_t *VAR_2[2], const int16_t *VAR_3[2], const int16_t *VAR_4, uint8_t *VAR_5, int VAR_6, int VAR_7, int VAR_8, enum PixelFormat VAR_9, int VAR_10) { const int16_t *VAR_11 = VAR_2[0], *vbuf0 = VAR_3[0]; int VAR_12; if (VAR_7 < 2048) { for (VAR_12 = 0; VAR_12 < (VAR_6 >> 1); VAR_12++) { int VAR_23 = (VAR_1[VAR_12 * 2 ] + 64) >> 7; int VAR_23 = (VAR_1[VAR_12 * 2 + 1] + 64) >> 7; int VAR_23 = (VAR_11[VAR_12] + 64) >> 7; int VAR_23 = (vbuf0[VAR_12] + 64) >> 7; int VAR_23, VAR_23; const void *VAR_23 = VAR_0->table_rV[VAR_23 + YUVRGB_TABLE_HEADROOM], *VAR_23 = (VAR_0->table_gU[VAR_23 + YUVRGB_TABLE_HEADROOM] + VAR_0->table_gV[VAR_23 + YUVRGB_TABLE_HEADROOM]), *VAR_23 = VAR_0->table_bU[VAR_23 + YUVRGB_TABLE_HEADROOM]; if (VAR_10) { VAR_23 = (VAR_4[VAR_12 * 2 ] + 64) >> 7; VAR_23 = (VAR_4[VAR_12 * 2 + 1] + 64) >> 7; } yuv2rgb_write(VAR_5, VAR_12, VAR_23, VAR_23, VAR_10 ? VAR_23 : 0, VAR_10 ? VAR_23 : 0, VAR_23, VAR_23, VAR_23, VAR_8, VAR_9, VAR_10); } } else { const int16_t *VAR_22 = VAR_2[1], *vbuf1 = VAR_3[1]; for (VAR_12 = 0; VAR_12 < (VAR_6 >> 1); VAR_12++) { int VAR_23 = (VAR_1[VAR_12 * 2 ] + 64) >> 7; int VAR_23 = (VAR_1[VAR_12 * 2 + 1] + 64) >> 7; int VAR_23 = (VAR_11[VAR_12] + VAR_22[VAR_12] + 128) >> 8; int VAR_23 = (vbuf0[VAR_12] + vbuf1[VAR_12] + 128) >> 8; int VAR_23, VAR_23; const void *VAR_23 = VAR_0->table_rV[VAR_23 + YUVRGB_TABLE_HEADROOM], *VAR_23 = (VAR_0->table_gU[VAR_23 + YUVRGB_TABLE_HEADROOM] + VAR_0->table_gV[VAR_23 + YUVRGB_TABLE_HEADROOM]), *VAR_23 = VAR_0->table_bU[VAR_23 + YUVRGB_TABLE_HEADROOM]; if (VAR_10) { VAR_23 = (VAR_4[VAR_12 * 2 ] + 64) >> 7; VAR_23 = (VAR_4[VAR_12 * 2 + 1] + 64) >> 7; } yuv2rgb_write(VAR_5, VAR_12, VAR_23, VAR_23, VAR_10 ? VAR_23 : 0, VAR_10 ? VAR_23 : 0, VAR_23, VAR_23, VAR_23, VAR_8, VAR_9, VAR_10); } } }
[ "FUNC_0(SwsContext *VAR_0, const int16_t *VAR_1,\nconst int16_t *VAR_2[2], const int16_t *VAR_3[2],\nconst int16_t *VAR_4, uint8_t *VAR_5, int VAR_6,\nint VAR_7, int VAR_8, enum PixelFormat VAR_9,\nint VAR_10)\n{", "const int16_t *VAR_11 = VAR_2[0], *vbuf0 = VAR_3[0];", "int VAR_12;", "if (VAR_7 < 2048) {", "for (VAR_12 = 0; VAR_12 < (VAR_6 >> 1); VAR_12++) {", "int VAR_23 = (VAR_1[VAR_12 * 2 ] + 64) >> 7;", "int VAR_23 = (VAR_1[VAR_12 * 2 + 1] + 64) >> 7;", "int VAR_23 = (VAR_11[VAR_12] + 64) >> 7;", "int VAR_23 = (vbuf0[VAR_12] + 64) >> 7;", "int VAR_23, VAR_23;", "const void *VAR_23 = VAR_0->table_rV[VAR_23 + YUVRGB_TABLE_HEADROOM],\n*VAR_23 = (VAR_0->table_gU[VAR_23 + YUVRGB_TABLE_HEADROOM] + VAR_0->table_gV[VAR_23 + YUVRGB_TABLE_HEADROOM]),\n*VAR_23 = VAR_0->table_bU[VAR_23 + YUVRGB_TABLE_HEADROOM];", "if (VAR_10) {", "VAR_23 = (VAR_4[VAR_12 * 2 ] + 64) >> 7;", "VAR_23 = (VAR_4[VAR_12 * 2 + 1] + 64) >> 7;", "}", "yuv2rgb_write(VAR_5, VAR_12, VAR_23, VAR_23, VAR_10 ? VAR_23 : 0, VAR_10 ? VAR_23 : 0,\nVAR_23, VAR_23, VAR_23, VAR_8, VAR_9, VAR_10);", "}", "} else {", "const int16_t *VAR_22 = VAR_2[1], *vbuf1 = VAR_3[1];", "for (VAR_12 = 0; VAR_12 < (VAR_6 >> 1); VAR_12++) {", "int VAR_23 = (VAR_1[VAR_12 * 2 ] + 64) >> 7;", "int VAR_23 = (VAR_1[VAR_12 * 2 + 1] + 64) >> 7;", "int VAR_23 = (VAR_11[VAR_12] + VAR_22[VAR_12] + 128) >> 8;", "int VAR_23 = (vbuf0[VAR_12] + vbuf1[VAR_12] + 128) >> 8;", "int VAR_23, VAR_23;", "const void *VAR_23 = VAR_0->table_rV[VAR_23 + YUVRGB_TABLE_HEADROOM],\n*VAR_23 = (VAR_0->table_gU[VAR_23 + YUVRGB_TABLE_HEADROOM] + VAR_0->table_gV[VAR_23 + YUVRGB_TABLE_HEADROOM]),\n*VAR_23 = VAR_0->table_bU[VAR_23 + YUVRGB_TABLE_HEADROOM];", "if (VAR_10) {", "VAR_23 = (VAR_4[VAR_12 * 2 ] + 64) >> 7;", "VAR_23 = (VAR_4[VAR_12 * 2 + 1] + 64) >> 7;", "}", "yuv2rgb_write(VAR_5, VAR_12, VAR_23, VAR_23, VAR_10 ? VAR_23 : 0, VAR_10 ? VAR_23 : 0,\nVAR_23, VAR_23, VAR_23, VAR_8, VAR_9, VAR_10);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9, 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35, 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75, 77 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91, 93 ], [ 95 ], [ 97 ], [ 99 ] ]
15,099
void *qemu_vmalloc(size_t size) { /* FIXME: this is not exactly optimal solution since VirtualAlloc has 64Kb granularity, but at least it guarantees us that the memory is page aligned. */ if (!size) { abort(); } return oom_check(VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE)); }
true
qemu
cd245a19329edfcd968b00d05ad92de7a0e2daa1
void *qemu_vmalloc(size_t size) { if (!size) { abort(); } return oom_check(VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE)); }
{ "code": [ " return oom_check(VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE));", " return oom_check(VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE));" ], "line_no": [ 17, 17 ] }
void *FUNC_0(size_t VAR_0) { if (!VAR_0) { abort(); } return oom_check(VirtualAlloc(NULL, VAR_0, MEM_COMMIT, PAGE_READWRITE)); }
[ "void *FUNC_0(size_t VAR_0)\n{", "if (!VAR_0) {", "abort();", "}", "return oom_check(VirtualAlloc(NULL, VAR_0, MEM_COMMIT, PAGE_READWRITE));", "}" ]
[ 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
15,100
static int real_seek(AVFormatContext *avf, int stream, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) { ConcatContext *cat = avf->priv_data; int ret, left, right; if (stream >= 0) { if (stream >= avf->nb_streams) return AVERROR(EINVAL); rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q, &min_ts, &ts, &max_ts); } left = 0; right = cat->nb_files; while (right - left > 1) { int mid = (left + right) / 2; if (ts < cat->files[mid].start_time) right = mid; else left = mid; } if ((ret = open_file(avf, left)) < 0) return ret; ret = try_seek(avf, stream, min_ts, ts, max_ts, flags); if (ret < 0 && !(flags & AVSEEK_FLAG_BACKWARD) && left < cat->nb_files - 1 && cat->files[left + 1].start_time < max_ts) { if ((ret = open_file(avf, left + 1)) < 0) return ret; ret = try_seek(avf, stream, min_ts, ts, max_ts, flags); } return ret; }
false
FFmpeg
d608a27d9e28d24ab56acc4ea6bfb13b2802035c
static int real_seek(AVFormatContext *avf, int stream, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) { ConcatContext *cat = avf->priv_data; int ret, left, right; if (stream >= 0) { if (stream >= avf->nb_streams) return AVERROR(EINVAL); rescale_interval(avf->streams[stream]->time_base, AV_TIME_BASE_Q, &min_ts, &ts, &max_ts); } left = 0; right = cat->nb_files; while (right - left > 1) { int mid = (left + right) / 2; if (ts < cat->files[mid].start_time) right = mid; else left = mid; } if ((ret = open_file(avf, left)) < 0) return ret; ret = try_seek(avf, stream, min_ts, ts, max_ts, flags); if (ret < 0 && !(flags & AVSEEK_FLAG_BACKWARD) && left < cat->nb_files - 1 && cat->files[left + 1].start_time < max_ts) { if ((ret = open_file(avf, left + 1)) < 0) return ret; ret = try_seek(avf, stream, min_ts, ts, max_ts, flags); } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1, int64_t VAR_2, int64_t VAR_3, int64_t VAR_4, int VAR_5) { ConcatContext *cat = VAR_0->priv_data; int VAR_6, VAR_7, VAR_8; if (VAR_1 >= 0) { if (VAR_1 >= VAR_0->nb_streams) return AVERROR(EINVAL); rescale_interval(VAR_0->streams[VAR_1]->time_base, AV_TIME_BASE_Q, &VAR_2, &VAR_3, &VAR_4); } VAR_7 = 0; VAR_8 = cat->nb_files; while (VAR_8 - VAR_7 > 1) { int VAR_9 = (VAR_7 + VAR_8) / 2; if (VAR_3 < cat->files[VAR_9].start_time) VAR_8 = VAR_9; else VAR_7 = VAR_9; } if ((VAR_6 = open_file(VAR_0, VAR_7)) < 0) return VAR_6; VAR_6 = try_seek(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); if (VAR_6 < 0 && !(VAR_5 & AVSEEK_FLAG_BACKWARD) && VAR_7 < cat->nb_files - 1 && cat->files[VAR_7 + 1].start_time < VAR_4) { if ((VAR_6 = open_file(VAR_0, VAR_7 + 1)) < 0) return VAR_6; VAR_6 = try_seek(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5); } return VAR_6; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1,\nint64_t VAR_2, int64_t VAR_3, int64_t VAR_4, int VAR_5)\n{", "ConcatContext *cat = VAR_0->priv_data;", "int VAR_6, VAR_7, VAR_8;", "if (VAR_1 >= 0) {", "if (VAR_1 >= VAR_0->nb_streams)\nreturn AVERROR(EINVAL);", "rescale_interval(VAR_0->streams[VAR_1]->time_base, AV_TIME_BASE_Q,\n&VAR_2, &VAR_3, &VAR_4);", "}", "VAR_7 = 0;", "VAR_8 = cat->nb_files;", "while (VAR_8 - VAR_7 > 1) {", "int VAR_9 = (VAR_7 + VAR_8) / 2;", "if (VAR_3 < cat->files[VAR_9].start_time)\nVAR_8 = VAR_9;", "else\nVAR_7 = VAR_9;", "}", "if ((VAR_6 = open_file(VAR_0, VAR_7)) < 0)\nreturn VAR_6;", "VAR_6 = try_seek(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);", "if (VAR_6 < 0 && !(VAR_5 & AVSEEK_FLAG_BACKWARD) &&\nVAR_7 < cat->nb_files - 1 &&\ncat->files[VAR_7 + 1].start_time < VAR_4) {", "if ((VAR_6 = open_file(VAR_0, VAR_7 + 1)) < 0)\nreturn VAR_6;", "VAR_6 = try_seek(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4, VAR_5);", "}", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15, 17 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 47, 49 ], [ 53 ], [ 55, 57, 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
15,101
static void FUNC(dequant)(int16_t *coeffs, int16_t log2_size) { int shift = 15 - BIT_DEPTH - log2_size; int x, y; int size = 1 << log2_size; if (shift > 0) { int offset = 1 << (shift - 1); for (y = 0; y < size; y++) { for (x = 0; x < size; x++) { *coeffs = (*coeffs + offset) >> shift; coeffs++; } } } else { for (y = 0; y < size; y++) { for (x = 0; x < size; x++) { *coeffs = *coeffs << -shift; coeffs++; } } } }
true
FFmpeg
0c9ab5ef9c1ee852c80c859c9e07efe8730b57ed
static void FUNC(dequant)(int16_t *coeffs, int16_t log2_size) { int shift = 15 - BIT_DEPTH - log2_size; int x, y; int size = 1 << log2_size; if (shift > 0) { int offset = 1 << (shift - 1); for (y = 0; y < size; y++) { for (x = 0; x < size; x++) { *coeffs = (*coeffs + offset) >> shift; coeffs++; } } } else { for (y = 0; y < size; y++) { for (x = 0; x < size; x++) { *coeffs = *coeffs << -shift; coeffs++; } } } }
{ "code": [ " *coeffs = *coeffs << -shift;" ], "line_no": [ 35 ] }
static void FUNC_0(dequant)(int16_t *coeffs, int16_t log2_size) { int VAR_0 = 15 - BIT_DEPTH - log2_size; int VAR_1, VAR_2; int VAR_3 = 1 << log2_size; if (VAR_0 > 0) { int VAR_4 = 1 << (VAR_0 - 1); for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) { for (VAR_1 = 0; VAR_1 < VAR_3; VAR_1++) { *coeffs = (*coeffs + VAR_4) >> VAR_0; coeffs++; } } } else { for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) { for (VAR_1 = 0; VAR_1 < VAR_3; VAR_1++) { *coeffs = *coeffs << -VAR_0; coeffs++; } } } }
[ "static void FUNC_0(dequant)(int16_t *coeffs, int16_t log2_size)\n{", "int VAR_0 = 15 - BIT_DEPTH - log2_size;", "int VAR_1, VAR_2;", "int VAR_3 = 1 << log2_size;", "if (VAR_0 > 0) {", "int VAR_4 = 1 << (VAR_0 - 1);", "for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) {", "for (VAR_1 = 0; VAR_1 < VAR_3; VAR_1++) {", "*coeffs = (*coeffs + VAR_4) >> VAR_0;", "coeffs++;", "}", "}", "} else {", "for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) {", "for (VAR_1 = 0; VAR_1 < VAR_3; VAR_1++) {", "*coeffs = *coeffs << -VAR_0;", "coeffs++;", "}", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ] ]
15,102
vpc_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BDRVVPCState *s = bs->opaque; int ret; int64_t image_offset; int64_t n_bytes; int64_t bytes_done = 0; VHDFooter *footer = (VHDFooter *) s->footer_buf; QEMUIOVector local_qiov; if (be32_to_cpu(footer->type) == VHD_FIXED) { return bdrv_co_preadv(bs->file, offset, bytes, qiov, 0); } qemu_co_mutex_lock(&s->lock); qemu_iovec_init(&local_qiov, qiov->niov); while (bytes > 0) { image_offset = get_image_offset(bs, offset, false); n_bytes = MIN(bytes, s->block_size - (offset % s->block_size)); if (image_offset == -1) { qemu_iovec_memset(qiov, bytes_done, 0, n_bytes); } else { qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); ret = bdrv_co_preadv(bs->file, image_offset, n_bytes, &local_qiov, 0); if (ret < 0) { goto fail; } } bytes -= n_bytes; offset += n_bytes; bytes_done += n_bytes; } ret = 0; fail: qemu_iovec_destroy(&local_qiov); qemu_co_mutex_unlock(&s->lock); return ret; }
true
qemu
cfc87e00c22ab4ea0262c9771c803ed03d754001
vpc_co_preadv(BlockDriverState *bs, uint64_t offset, uint64_t bytes, QEMUIOVector *qiov, int flags) { BDRVVPCState *s = bs->opaque; int ret; int64_t image_offset; int64_t n_bytes; int64_t bytes_done = 0; VHDFooter *footer = (VHDFooter *) s->footer_buf; QEMUIOVector local_qiov; if (be32_to_cpu(footer->type) == VHD_FIXED) { return bdrv_co_preadv(bs->file, offset, bytes, qiov, 0); } qemu_co_mutex_lock(&s->lock); qemu_iovec_init(&local_qiov, qiov->niov); while (bytes > 0) { image_offset = get_image_offset(bs, offset, false); n_bytes = MIN(bytes, s->block_size - (offset % s->block_size)); if (image_offset == -1) { qemu_iovec_memset(qiov, bytes_done, 0, n_bytes); } else { qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, qiov, bytes_done, n_bytes); ret = bdrv_co_preadv(bs->file, image_offset, n_bytes, &local_qiov, 0); if (ret < 0) { goto fail; } } bytes -= n_bytes; offset += n_bytes; bytes_done += n_bytes; } ret = 0; fail: qemu_iovec_destroy(&local_qiov); qemu_co_mutex_unlock(&s->lock); return ret; }
{ "code": [ " image_offset = get_image_offset(bs, offset, false);" ], "line_no": [ 39 ] }
FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2, QEMUIOVector *VAR_3, int VAR_4) { BDRVVPCState *s = VAR_0->opaque; int VAR_5; int64_t image_offset; int64_t n_bytes; int64_t bytes_done = 0; VHDFooter *footer = (VHDFooter *) s->footer_buf; QEMUIOVector local_qiov; if (be32_to_cpu(footer->type) == VHD_FIXED) { return bdrv_co_preadv(VAR_0->file, VAR_1, VAR_2, VAR_3, 0); } qemu_co_mutex_lock(&s->lock); qemu_iovec_init(&local_qiov, VAR_3->niov); while (VAR_2 > 0) { image_offset = get_image_offset(VAR_0, VAR_1, false); n_bytes = MIN(VAR_2, s->block_size - (VAR_1 % s->block_size)); if (image_offset == -1) { qemu_iovec_memset(VAR_3, bytes_done, 0, n_bytes); } else { qemu_iovec_reset(&local_qiov); qemu_iovec_concat(&local_qiov, VAR_3, bytes_done, n_bytes); VAR_5 = bdrv_co_preadv(VAR_0->file, image_offset, n_bytes, &local_qiov, 0); if (VAR_5 < 0) { goto fail; } } VAR_2 -= n_bytes; VAR_1 += n_bytes; bytes_done += n_bytes; } VAR_5 = 0; fail: qemu_iovec_destroy(&local_qiov); qemu_co_mutex_unlock(&s->lock); return VAR_5; }
[ "FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1, uint64_t VAR_2,\nQEMUIOVector *VAR_3, int VAR_4)\n{", "BDRVVPCState *s = VAR_0->opaque;", "int VAR_5;", "int64_t image_offset;", "int64_t n_bytes;", "int64_t bytes_done = 0;", "VHDFooter *footer = (VHDFooter *) s->footer_buf;", "QEMUIOVector local_qiov;", "if (be32_to_cpu(footer->type) == VHD_FIXED) {", "return bdrv_co_preadv(VAR_0->file, VAR_1, VAR_2, VAR_3, 0);", "}", "qemu_co_mutex_lock(&s->lock);", "qemu_iovec_init(&local_qiov, VAR_3->niov);", "while (VAR_2 > 0) {", "image_offset = get_image_offset(VAR_0, VAR_1, false);", "n_bytes = MIN(VAR_2, s->block_size - (VAR_1 % s->block_size));", "if (image_offset == -1) {", "qemu_iovec_memset(VAR_3, bytes_done, 0, n_bytes);", "} else {", "qemu_iovec_reset(&local_qiov);", "qemu_iovec_concat(&local_qiov, VAR_3, bytes_done, n_bytes);", "VAR_5 = bdrv_co_preadv(VAR_0->file, image_offset, n_bytes,\n&local_qiov, 0);", "if (VAR_5 < 0) {", "goto fail;", "}", "}", "VAR_2 -= n_bytes;", "VAR_1 += n_bytes;", "bytes_done += n_bytes;", "}", "VAR_5 = 0;", "fail:\nqemu_iovec_destroy(&local_qiov);", "qemu_co_mutex_unlock(&s->lock);", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 83, 85 ], [ 87 ], [ 91 ], [ 93 ] ]
15,103
long do_rt_sigreturn(CPUMIPSState *env) { struct target_rt_sigframe *frame; abi_ulong frame_addr; sigset_t blocked; frame_addr = env->active_tc.gpr[29]; trace_user_do_rt_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { goto badframe; } target_to_host_sigset(&blocked, &frame->rs_uc.tuc_sigmask); set_sigmask(&blocked); restore_sigcontext(env, &frame->rs_uc.tuc_mcontext); if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, rs_uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) goto badframe; env->active_tc.PC = env->CP0_EPC; mips_set_hflags_isa_mode_from_pc(env); /* I am not sure this is right, but it seems to work * maybe a problem with nested signals ? */ env->CP0_EPC = 0; return -TARGET_QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV/*, current*/); return 0; }
true
qemu
c599d4d6d6e9bfdb64e54c33a22cb26e3496b96d
long do_rt_sigreturn(CPUMIPSState *env) { struct target_rt_sigframe *frame; abi_ulong frame_addr; sigset_t blocked; frame_addr = env->active_tc.gpr[29]; trace_user_do_rt_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { goto badframe; } target_to_host_sigset(&blocked, &frame->rs_uc.tuc_sigmask); set_sigmask(&blocked); restore_sigcontext(env, &frame->rs_uc.tuc_mcontext); if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, rs_uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) goto badframe; env->active_tc.PC = env->CP0_EPC; mips_set_hflags_isa_mode_from_pc(env); env->CP0_EPC = 0; return -TARGET_QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); return 0; }
{ "code": [ " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;", " return 0;" ], "line_no": [ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63 ] }
long FUNC_0(CPUMIPSState *VAR_0) { struct target_rt_sigframe *VAR_1; abi_ulong frame_addr; sigset_t blocked; frame_addr = VAR_0->active_tc.gpr[29]; trace_user_do_rt_sigreturn(VAR_0, frame_addr); if (!lock_user_struct(VERIFY_READ, VAR_1, frame_addr, 1)) { goto badframe; } target_to_host_sigset(&blocked, &VAR_1->rs_uc.tuc_sigmask); set_sigmask(&blocked); restore_sigcontext(VAR_0, &VAR_1->rs_uc.tuc_mcontext); if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, rs_uc.tuc_stack), 0, get_sp_from_cpustate(VAR_0)) == -EFAULT) goto badframe; VAR_0->active_tc.PC = VAR_0->CP0_EPC; mips_set_hflags_isa_mode_from_pc(VAR_0); VAR_0->CP0_EPC = 0; return -TARGET_QEMU_ESIGRETURN; badframe: force_sig(TARGET_SIGSEGV); return 0; }
[ "long FUNC_0(CPUMIPSState *VAR_0)\n{", "struct target_rt_sigframe *VAR_1;", "abi_ulong frame_addr;", "sigset_t blocked;", "frame_addr = VAR_0->active_tc.gpr[29];", "trace_user_do_rt_sigreturn(VAR_0, frame_addr);", "if (!lock_user_struct(VERIFY_READ, VAR_1, frame_addr, 1)) {", "goto badframe;", "}", "target_to_host_sigset(&blocked, &VAR_1->rs_uc.tuc_sigmask);", "set_sigmask(&blocked);", "restore_sigcontext(VAR_0, &VAR_1->rs_uc.tuc_mcontext);", "if (do_sigaltstack(frame_addr +\noffsetof(struct target_rt_sigframe, rs_uc.tuc_stack),\n0, get_sp_from_cpustate(VAR_0)) == -EFAULT)\ngoto badframe;", "VAR_0->active_tc.PC = VAR_0->CP0_EPC;", "mips_set_hflags_isa_mode_from_pc(VAR_0);", "VAR_0->CP0_EPC = 0;", "return -TARGET_QEMU_ESIGRETURN;", "badframe:\nforce_sig(TARGET_SIGSEGV);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 35, 37, 39, 41 ], [ 45 ], [ 47 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65 ] ]
15,104
static CharDriverState *qemu_chr_open_socket(QemuOpts *opts) { CharDriverState *chr = NULL; TCPCharDriver *s = NULL; int fd = -1; int is_listen; int is_waitconnect; int do_nodelay; int is_unix; int is_telnet; is_listen = qemu_opt_get_bool(opts, "server", 0); is_waitconnect = qemu_opt_get_bool(opts, "wait", 1); is_telnet = qemu_opt_get_bool(opts, "telnet", 0); do_nodelay = !qemu_opt_get_bool(opts, "delay", 1); is_unix = qemu_opt_get(opts, "path") != NULL; if (!is_listen) is_waitconnect = 0; chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(TCPCharDriver)); if (is_unix) { if (is_listen) { fd = unix_listen_opts(opts); } else { fd = unix_connect_opts(opts); } } else { if (is_listen) { fd = inet_listen_opts(opts, 0, NULL); } else { fd = inet_connect_opts(opts, true, NULL, NULL); } } if (fd < 0) { goto fail; } if (!is_waitconnect) socket_set_nonblock(fd); s->connected = 0; s->fd = -1; s->listen_fd = -1; s->msgfd = -1; s->is_unix = is_unix; s->do_nodelay = do_nodelay && !is_unix; chr->opaque = s; chr->chr_write = tcp_chr_write; chr->chr_close = tcp_chr_close; chr->get_msgfd = tcp_get_msgfd; chr->chr_add_client = tcp_chr_add_client; if (is_listen) { s->listen_fd = fd; qemu_set_fd_handler2(s->listen_fd, NULL, tcp_chr_accept, NULL, chr); if (is_telnet) s->do_telnetopt = 1; } else { s->connected = 1; s->fd = fd; socket_set_nodelay(fd); tcp_chr_connect(chr); } /* for "info chardev" monitor command */ chr->filename = g_malloc(256); if (is_unix) { snprintf(chr->filename, 256, "unix:%s%s", qemu_opt_get(opts, "path"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } else if (is_telnet) { snprintf(chr->filename, 256, "telnet:%s:%s%s", qemu_opt_get(opts, "host"), qemu_opt_get(opts, "port"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } else { snprintf(chr->filename, 256, "tcp:%s:%s%s", qemu_opt_get(opts, "host"), qemu_opt_get(opts, "port"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } if (is_listen && is_waitconnect) { printf("QEMU waiting for connection on: %s\n", chr->filename); tcp_chr_accept(chr); socket_set_nonblock(s->listen_fd); } return chr; fail: if (fd >= 0) closesocket(fd); g_free(s); g_free(chr); return NULL; }
true
qemu
233aa5c2d1cf4655ffe335025a68cf5454f87dad
static CharDriverState *qemu_chr_open_socket(QemuOpts *opts) { CharDriverState *chr = NULL; TCPCharDriver *s = NULL; int fd = -1; int is_listen; int is_waitconnect; int do_nodelay; int is_unix; int is_telnet; is_listen = qemu_opt_get_bool(opts, "server", 0); is_waitconnect = qemu_opt_get_bool(opts, "wait", 1); is_telnet = qemu_opt_get_bool(opts, "telnet", 0); do_nodelay = !qemu_opt_get_bool(opts, "delay", 1); is_unix = qemu_opt_get(opts, "path") != NULL; if (!is_listen) is_waitconnect = 0; chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(TCPCharDriver)); if (is_unix) { if (is_listen) { fd = unix_listen_opts(opts); } else { fd = unix_connect_opts(opts); } } else { if (is_listen) { fd = inet_listen_opts(opts, 0, NULL); } else { fd = inet_connect_opts(opts, true, NULL, NULL); } } if (fd < 0) { goto fail; } if (!is_waitconnect) socket_set_nonblock(fd); s->connected = 0; s->fd = -1; s->listen_fd = -1; s->msgfd = -1; s->is_unix = is_unix; s->do_nodelay = do_nodelay && !is_unix; chr->opaque = s; chr->chr_write = tcp_chr_write; chr->chr_close = tcp_chr_close; chr->get_msgfd = tcp_get_msgfd; chr->chr_add_client = tcp_chr_add_client; if (is_listen) { s->listen_fd = fd; qemu_set_fd_handler2(s->listen_fd, NULL, tcp_chr_accept, NULL, chr); if (is_telnet) s->do_telnetopt = 1; } else { s->connected = 1; s->fd = fd; socket_set_nodelay(fd); tcp_chr_connect(chr); } chr->filename = g_malloc(256); if (is_unix) { snprintf(chr->filename, 256, "unix:%s%s", qemu_opt_get(opts, "path"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } else if (is_telnet) { snprintf(chr->filename, 256, "telnet:%s:%s%s", qemu_opt_get(opts, "host"), qemu_opt_get(opts, "port"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } else { snprintf(chr->filename, 256, "tcp:%s:%s%s", qemu_opt_get(opts, "host"), qemu_opt_get(opts, "port"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } if (is_listen && is_waitconnect) { printf("QEMU waiting for connection on: %s\n", chr->filename); tcp_chr_accept(chr); socket_set_nonblock(s->listen_fd); } return chr; fail: if (fd >= 0) closesocket(fd); g_free(s); g_free(chr); return NULL; }
{ "code": [ " } else {", " fd = inet_connect_opts(opts, true, NULL, NULL);" ], "line_no": [ 57, 65 ] }
static CharDriverState *FUNC_0(QemuOpts *opts) { CharDriverState *chr = NULL; TCPCharDriver *s = NULL; int VAR_0 = -1; int VAR_1; int VAR_2; int VAR_3; int VAR_4; int VAR_5; VAR_1 = qemu_opt_get_bool(opts, "server", 0); VAR_2 = qemu_opt_get_bool(opts, "wait", 1); VAR_5 = qemu_opt_get_bool(opts, "telnet", 0); VAR_3 = !qemu_opt_get_bool(opts, "delay", 1); VAR_4 = qemu_opt_get(opts, "path") != NULL; if (!VAR_1) VAR_2 = 0; chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(TCPCharDriver)); if (VAR_4) { if (VAR_1) { VAR_0 = unix_listen_opts(opts); } else { VAR_0 = unix_connect_opts(opts); } } else { if (VAR_1) { VAR_0 = inet_listen_opts(opts, 0, NULL); } else { VAR_0 = inet_connect_opts(opts, true, NULL, NULL); } } if (VAR_0 < 0) { goto fail; } if (!VAR_2) socket_set_nonblock(VAR_0); s->connected = 0; s->VAR_0 = -1; s->listen_fd = -1; s->msgfd = -1; s->VAR_4 = VAR_4; s->VAR_3 = VAR_3 && !VAR_4; chr->opaque = s; chr->chr_write = tcp_chr_write; chr->chr_close = tcp_chr_close; chr->get_msgfd = tcp_get_msgfd; chr->chr_add_client = tcp_chr_add_client; if (VAR_1) { s->listen_fd = VAR_0; qemu_set_fd_handler2(s->listen_fd, NULL, tcp_chr_accept, NULL, chr); if (VAR_5) s->do_telnetopt = 1; } else { s->connected = 1; s->VAR_0 = VAR_0; socket_set_nodelay(VAR_0); tcp_chr_connect(chr); } chr->filename = g_malloc(256); if (VAR_4) { snprintf(chr->filename, 256, "unix:%s%s", qemu_opt_get(opts, "path"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } else if (VAR_5) { snprintf(chr->filename, 256, "telnet:%s:%s%s", qemu_opt_get(opts, "host"), qemu_opt_get(opts, "port"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } else { snprintf(chr->filename, 256, "tcp:%s:%s%s", qemu_opt_get(opts, "host"), qemu_opt_get(opts, "port"), qemu_opt_get_bool(opts, "server", 0) ? ",server" : ""); } if (VAR_1 && VAR_2) { printf("QEMU waiting for connection on: %s\n", chr->filename); tcp_chr_accept(chr); socket_set_nonblock(s->listen_fd); } return chr; fail: if (VAR_0 >= 0) closesocket(VAR_0); g_free(s); g_free(chr); return NULL; }
[ "static CharDriverState *FUNC_0(QemuOpts *opts)\n{", "CharDriverState *chr = NULL;", "TCPCharDriver *s = NULL;", "int VAR_0 = -1;", "int VAR_1;", "int VAR_2;", "int VAR_3;", "int VAR_4;", "int VAR_5;", "VAR_1 = qemu_opt_get_bool(opts, \"server\", 0);", "VAR_2 = qemu_opt_get_bool(opts, \"wait\", 1);", "VAR_5 = qemu_opt_get_bool(opts, \"telnet\", 0);", "VAR_3 = !qemu_opt_get_bool(opts, \"delay\", 1);", "VAR_4 = qemu_opt_get(opts, \"path\") != NULL;", "if (!VAR_1)\nVAR_2 = 0;", "chr = g_malloc0(sizeof(CharDriverState));", "s = g_malloc0(sizeof(TCPCharDriver));", "if (VAR_4) {", "if (VAR_1) {", "VAR_0 = unix_listen_opts(opts);", "} else {", "VAR_0 = unix_connect_opts(opts);", "}", "} else {", "if (VAR_1) {", "VAR_0 = inet_listen_opts(opts, 0, NULL);", "} else {", "VAR_0 = inet_connect_opts(opts, true, NULL, NULL);", "}", "}", "if (VAR_0 < 0) {", "goto fail;", "}", "if (!VAR_2)\nsocket_set_nonblock(VAR_0);", "s->connected = 0;", "s->VAR_0 = -1;", "s->listen_fd = -1;", "s->msgfd = -1;", "s->VAR_4 = VAR_4;", "s->VAR_3 = VAR_3 && !VAR_4;", "chr->opaque = s;", "chr->chr_write = tcp_chr_write;", "chr->chr_close = tcp_chr_close;", "chr->get_msgfd = tcp_get_msgfd;", "chr->chr_add_client = tcp_chr_add_client;", "if (VAR_1) {", "s->listen_fd = VAR_0;", "qemu_set_fd_handler2(s->listen_fd, NULL, tcp_chr_accept, NULL, chr);", "if (VAR_5)\ns->do_telnetopt = 1;", "} else {", "s->connected = 1;", "s->VAR_0 = VAR_0;", "socket_set_nodelay(VAR_0);", "tcp_chr_connect(chr);", "}", "chr->filename = g_malloc(256);", "if (VAR_4) {", "snprintf(chr->filename, 256, \"unix:%s%s\",\nqemu_opt_get(opts, \"path\"),\nqemu_opt_get_bool(opts, \"server\", 0) ? \",server\" : \"\");", "} else if (VAR_5) {", "snprintf(chr->filename, 256, \"telnet:%s:%s%s\",\nqemu_opt_get(opts, \"host\"), qemu_opt_get(opts, \"port\"),\nqemu_opt_get_bool(opts, \"server\", 0) ? \",server\" : \"\");", "} else {", "snprintf(chr->filename, 256, \"tcp:%s:%s%s\",\nqemu_opt_get(opts, \"host\"), qemu_opt_get(opts, \"port\"),\nqemu_opt_get_bool(opts, \"server\", 0) ? \",server\" : \"\");", "}", "if (VAR_1 && VAR_2) {", "printf(\"QEMU waiting for connection on: %s\\n\",\nchr->filename);", "tcp_chr_accept(chr);", "socket_set_nonblock(s->listen_fd);", "}", "return chr;", "fail:\nif (VAR_0 >= 0)\nclosesocket(VAR_0);", "g_free(s);", "g_free(chr);", "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, 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 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 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 ], [ 79, 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 139 ], [ 141 ], [ 143, 145, 147 ], [ 149 ], [ 151, 153, 155 ], [ 157 ], [ 159, 161, 163 ], [ 165 ], [ 169 ], [ 171, 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 185, 187, 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ] ]
15,105
void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap) { bool has_reply = false; int nesting = 0; /* Send QMP request */ socket_sendf(s->qmp_fd, fmt, ap); /* Receive reply */ while (!has_reply || nesting > 0) { ssize_t len; char c; len = read(s->qmp_fd, &c, 1); if (len == -1 && errno == EINTR) { continue; } if (len == -1 || len == 0) { fprintf(stderr, "Broken pipe\n"); exit(1); } switch (c) { case '{': nesting++; has_reply = true; break; case '}': nesting--; break; } } }
true
qemu
0c460dac03e7919079525d8e24ef2c4c607c219d
void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap) { bool has_reply = false; int nesting = 0; socket_sendf(s->qmp_fd, fmt, ap); while (!has_reply || nesting > 0) { ssize_t len; char c; len = read(s->qmp_fd, &c, 1); if (len == -1 && errno == EINTR) { continue; } if (len == -1 || len == 0) { fprintf(stderr, "Broken pipe\n"); exit(1); } switch (c) { case '{': nesting++; has_reply = true; break; case '}': nesting--; break; } } }
{ "code": [ "void qtest_qmpv_discard_response(QTestState *s, const char *fmt, va_list ap)", " bool has_reply = false;", " int nesting = 0;", " while (!has_reply || nesting > 0) {", " switch (c) {", " case '{':", " nesting++;", " has_reply = true;", " break;", " case '}':", " nesting--;", " break;" ], "line_no": [ 1, 5, 7, 19, 47, 49, 51, 53, 55, 57, 59, 55 ] }
void FUNC_0(QTestState *VAR_0, const char *VAR_1, va_list VAR_2) { bool has_reply = false; int VAR_3 = 0; socket_sendf(VAR_0->qmp_fd, VAR_1, VAR_2); while (!has_reply || VAR_3 > 0) { ssize_t len; char VAR_4; len = read(VAR_0->qmp_fd, &VAR_4, 1); if (len == -1 && errno == EINTR) { continue; } if (len == -1 || len == 0) { fprintf(stderr, "Broken pipe\n"); exit(1); } switch (VAR_4) { case '{': VAR_3++; has_reply = true; break; case '}': VAR_3--; break; } } }
[ "void FUNC_0(QTestState *VAR_0, const char *VAR_1, va_list VAR_2)\n{", "bool has_reply = false;", "int VAR_3 = 0;", "socket_sendf(VAR_0->qmp_fd, VAR_1, VAR_2);", "while (!has_reply || VAR_3 > 0) {", "ssize_t len;", "char VAR_4;", "len = read(VAR_0->qmp_fd, &VAR_4, 1);", "if (len == -1 && errno == EINTR) {", "continue;", "}", "if (len == -1 || len == 0) {", "fprintf(stderr, \"Broken pipe\\n\");", "exit(1);", "}", "switch (VAR_4) {", "case '{':", "VAR_3++;", "has_reply = true;", "break;", "case '}':", "VAR_3--;", "break;", "}", "}", "}" ]
[ 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ] ]
15,107
static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h) { const int mb_x = h->mb_x; const int mb_y = h->mb_y; const int mb_xy = h->mb_xy; const int mb_type = h->cur_pic.f.mb_type[mb_xy]; uint8_t *dest[3]; int linesize; int i, j, p; int *block_offset = &h->block_offset[0]; const int transform_bypass = !SIMPLE && (h->qscale == 0 && h->sps.transform_bypass); const int plane_count = (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) ? 3 : 1; for (p = 0; p < plane_count; p++) { dest[p] = h->cur_pic.f.data[p] + ((mb_x << PIXEL_SHIFT) + mb_y * h->linesize) * 16; h->vdsp.prefetch(dest[p] + (h->mb_x & 3) * 4 * h->linesize + (64 << PIXEL_SHIFT), h->linesize, 4); } h->list_counts[mb_xy] = h->list_count; if (!SIMPLE && MB_FIELD) { linesize = h->mb_linesize = h->mb_uvlinesize = h->linesize * 2; block_offset = &h->block_offset[48]; if (mb_y & 1) // FIXME move out of this function? for (p = 0; p < 3; p++) dest[p] -= h->linesize * 15; if (FRAME_MBAFF) { int list; for (list = 0; list < h->list_count; list++) { if (!USES_LIST(mb_type, list)) continue; if (IS_16X16(mb_type)) { int8_t *ref = &h->ref_cache[list][scan8[0]]; fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (h->mb_y & 1), 1); } else { for (i = 0; i < 16; i += 4) { int ref = h->ref_cache[list][scan8[i]]; if (ref >= 0) fill_rectangle(&h->ref_cache[list][scan8[i]], 2, 2, 8, (16 + ref) ^ (h->mb_y & 1), 1); } } } } } else { linesize = h->mb_linesize = h->mb_uvlinesize = h->linesize; } if (!SIMPLE && IS_INTRA_PCM(mb_type)) { if (PIXEL_SHIFT) { const int bit_depth = h->sps.bit_depth_luma; GetBitContext gb; init_get_bits(&gb, (uint8_t *)h->intra_pcm_ptr, 768 * bit_depth); for (p = 0; p < plane_count; p++) for (i = 0; i < 16; i++) { uint16_t *tmp = (uint16_t *)(dest[p] + i * linesize); for (j = 0; j < 16; j++) tmp[j] = get_bits(&gb, bit_depth); } } else { for (p = 0; p < plane_count; p++) for (i = 0; i < 16; i++) memcpy(dest[p] + i * linesize, (uint8_t *)h->intra_pcm_ptr + p * 256 + i * 16, 16); } } else { if (IS_INTRA(mb_type)) { if (h->deblocking_filter) xchg_mb_border(h, dest[0], dest[1], dest[2], linesize, linesize, 1, 1, SIMPLE, PIXEL_SHIFT); for (p = 0; p < plane_count; p++) hl_decode_mb_predict_luma(h, mb_type, 1, SIMPLE, transform_bypass, PIXEL_SHIFT, block_offset, linesize, dest[p], p); if (h->deblocking_filter) xchg_mb_border(h, dest[0], dest[1], dest[2], linesize, linesize, 0, 1, SIMPLE, PIXEL_SHIFT); } else { FUNC(hl_motion_444)(h, dest[0], dest[1], dest[2], h->me.qpel_put, h->h264chroma.put_h264_chroma_pixels_tab, h->me.qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab, h->h264dsp.weight_h264_pixels_tab, h->h264dsp.biweight_h264_pixels_tab); } for (p = 0; p < plane_count; p++) hl_decode_mb_idct_luma(h, mb_type, 1, SIMPLE, transform_bypass, PIXEL_SHIFT, block_offset, linesize, dest[p], p); if (h->cbp || IS_INTRA(mb_type)) { h->dsp.clear_blocks(h->mb); h->dsp.clear_blocks(h->mb + (24 * 16 << PIXEL_SHIFT)); } } }
false
FFmpeg
1acd7d594c15aa491729c837ad3519d3469e620a
static av_noinline void FUNC(hl_decode_mb_444)(H264Context *h) { const int mb_x = h->mb_x; const int mb_y = h->mb_y; const int mb_xy = h->mb_xy; const int mb_type = h->cur_pic.f.mb_type[mb_xy]; uint8_t *dest[3]; int linesize; int i, j, p; int *block_offset = &h->block_offset[0]; const int transform_bypass = !SIMPLE && (h->qscale == 0 && h->sps.transform_bypass); const int plane_count = (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) ? 3 : 1; for (p = 0; p < plane_count; p++) { dest[p] = h->cur_pic.f.data[p] + ((mb_x << PIXEL_SHIFT) + mb_y * h->linesize) * 16; h->vdsp.prefetch(dest[p] + (h->mb_x & 3) * 4 * h->linesize + (64 << PIXEL_SHIFT), h->linesize, 4); } h->list_counts[mb_xy] = h->list_count; if (!SIMPLE && MB_FIELD) { linesize = h->mb_linesize = h->mb_uvlinesize = h->linesize * 2; block_offset = &h->block_offset[48]; if (mb_y & 1) for (p = 0; p < 3; p++) dest[p] -= h->linesize * 15; if (FRAME_MBAFF) { int list; for (list = 0; list < h->list_count; list++) { if (!USES_LIST(mb_type, list)) continue; if (IS_16X16(mb_type)) { int8_t *ref = &h->ref_cache[list][scan8[0]]; fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (h->mb_y & 1), 1); } else { for (i = 0; i < 16; i += 4) { int ref = h->ref_cache[list][scan8[i]]; if (ref >= 0) fill_rectangle(&h->ref_cache[list][scan8[i]], 2, 2, 8, (16 + ref) ^ (h->mb_y & 1), 1); } } } } } else { linesize = h->mb_linesize = h->mb_uvlinesize = h->linesize; } if (!SIMPLE && IS_INTRA_PCM(mb_type)) { if (PIXEL_SHIFT) { const int bit_depth = h->sps.bit_depth_luma; GetBitContext gb; init_get_bits(&gb, (uint8_t *)h->intra_pcm_ptr, 768 * bit_depth); for (p = 0; p < plane_count; p++) for (i = 0; i < 16; i++) { uint16_t *tmp = (uint16_t *)(dest[p] + i * linesize); for (j = 0; j < 16; j++) tmp[j] = get_bits(&gb, bit_depth); } } else { for (p = 0; p < plane_count; p++) for (i = 0; i < 16; i++) memcpy(dest[p] + i * linesize, (uint8_t *)h->intra_pcm_ptr + p * 256 + i * 16, 16); } } else { if (IS_INTRA(mb_type)) { if (h->deblocking_filter) xchg_mb_border(h, dest[0], dest[1], dest[2], linesize, linesize, 1, 1, SIMPLE, PIXEL_SHIFT); for (p = 0; p < plane_count; p++) hl_decode_mb_predict_luma(h, mb_type, 1, SIMPLE, transform_bypass, PIXEL_SHIFT, block_offset, linesize, dest[p], p); if (h->deblocking_filter) xchg_mb_border(h, dest[0], dest[1], dest[2], linesize, linesize, 0, 1, SIMPLE, PIXEL_SHIFT); } else { FUNC(hl_motion_444)(h, dest[0], dest[1], dest[2], h->me.qpel_put, h->h264chroma.put_h264_chroma_pixels_tab, h->me.qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab, h->h264dsp.weight_h264_pixels_tab, h->h264dsp.biweight_h264_pixels_tab); } for (p = 0; p < plane_count; p++) hl_decode_mb_idct_luma(h, mb_type, 1, SIMPLE, transform_bypass, PIXEL_SHIFT, block_offset, linesize, dest[p], p); if (h->cbp || IS_INTRA(mb_type)) { h->dsp.clear_blocks(h->mb); h->dsp.clear_blocks(h->mb + (24 * 16 << PIXEL_SHIFT)); } } }
{ "code": [], "line_no": [] }
static av_noinline void FUNC_0(hl_decode_mb_444)(H264Context *h) { const int VAR_0 = h->VAR_0; const int VAR_1 = h->VAR_1; const int VAR_2 = h->VAR_2; const int VAR_3 = h->cur_pic.f.VAR_3[VAR_2]; uint8_t *dest[3]; int VAR_4; int VAR_5, VAR_6, VAR_7; int *VAR_8 = &h->VAR_8[0]; const int VAR_9 = !SIMPLE && (h->qscale == 0 && h->sps.VAR_9); const int VAR_10 = (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) ? 3 : 1; for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) { dest[VAR_7] = h->cur_pic.f.data[VAR_7] + ((VAR_0 << PIXEL_SHIFT) + VAR_1 * h->VAR_4) * 16; h->vdsp.prefetch(dest[VAR_7] + (h->VAR_0 & 3) * 4 * h->VAR_4 + (64 << PIXEL_SHIFT), h->VAR_4, 4); } h->list_counts[VAR_2] = h->list_count; if (!SIMPLE && MB_FIELD) { VAR_4 = h->mb_linesize = h->mb_uvlinesize = h->VAR_4 * 2; VAR_8 = &h->VAR_8[48]; if (VAR_1 & 1) for (VAR_7 = 0; VAR_7 < 3; VAR_7++) dest[VAR_7] -= h->VAR_4 * 15; if (FRAME_MBAFF) { int VAR_11; for (VAR_11 = 0; VAR_11 < h->list_count; VAR_11++) { if (!USES_LIST(VAR_3, VAR_11)) continue; if (IS_16X16(VAR_3)) { int8_t *ref = &h->ref_cache[VAR_11][scan8[0]]; fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (h->VAR_1 & 1), 1); } else { for (VAR_5 = 0; VAR_5 < 16; VAR_5 += 4) { int ref = h->ref_cache[VAR_11][scan8[VAR_5]]; if (ref >= 0) fill_rectangle(&h->ref_cache[VAR_11][scan8[VAR_5]], 2, 2, 8, (16 + ref) ^ (h->VAR_1 & 1), 1); } } } } } else { VAR_4 = h->mb_linesize = h->mb_uvlinesize = h->VAR_4; } if (!SIMPLE && IS_INTRA_PCM(VAR_3)) { if (PIXEL_SHIFT) { const int VAR_12 = h->sps.bit_depth_luma; GetBitContext gb; init_get_bits(&gb, (uint8_t *)h->intra_pcm_ptr, 768 * VAR_12); for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) for (VAR_5 = 0; VAR_5 < 16; VAR_5++) { uint16_t *tmp = (uint16_t *)(dest[VAR_7] + VAR_5 * VAR_4); for (VAR_6 = 0; VAR_6 < 16; VAR_6++) tmp[VAR_6] = get_bits(&gb, VAR_12); } } else { for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) for (VAR_5 = 0; VAR_5 < 16; VAR_5++) memcpy(dest[VAR_7] + VAR_5 * VAR_4, (uint8_t *)h->intra_pcm_ptr + VAR_7 * 256 + VAR_5 * 16, 16); } } else { if (IS_INTRA(VAR_3)) { if (h->deblocking_filter) xchg_mb_border(h, dest[0], dest[1], dest[2], VAR_4, VAR_4, 1, 1, SIMPLE, PIXEL_SHIFT); for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) hl_decode_mb_predict_luma(h, VAR_3, 1, SIMPLE, VAR_9, PIXEL_SHIFT, VAR_8, VAR_4, dest[VAR_7], VAR_7); if (h->deblocking_filter) xchg_mb_border(h, dest[0], dest[1], dest[2], VAR_4, VAR_4, 0, 1, SIMPLE, PIXEL_SHIFT); } else { FUNC_0(hl_motion_444)(h, dest[0], dest[1], dest[2], h->me.qpel_put, h->h264chroma.put_h264_chroma_pixels_tab, h->me.qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab, h->h264dsp.weight_h264_pixels_tab, h->h264dsp.biweight_h264_pixels_tab); } for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) hl_decode_mb_idct_luma(h, VAR_3, 1, SIMPLE, VAR_9, PIXEL_SHIFT, VAR_8, VAR_4, dest[VAR_7], VAR_7); if (h->cbp || IS_INTRA(VAR_3)) { h->dsp.clear_blocks(h->mb); h->dsp.clear_blocks(h->mb + (24 * 16 << PIXEL_SHIFT)); } } }
[ "static av_noinline void FUNC_0(hl_decode_mb_444)(H264Context *h)\n{", "const int VAR_0 = h->VAR_0;", "const int VAR_1 = h->VAR_1;", "const int VAR_2 = h->VAR_2;", "const int VAR_3 = h->cur_pic.f.VAR_3[VAR_2];", "uint8_t *dest[3];", "int VAR_4;", "int VAR_5, VAR_6, VAR_7;", "int *VAR_8 = &h->VAR_8[0];", "const int VAR_9 = !SIMPLE && (h->qscale == 0 && h->sps.VAR_9);", "const int VAR_10 = (SIMPLE || !CONFIG_GRAY || !(h->flags & CODEC_FLAG_GRAY)) ? 3 : 1;", "for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++) {", "dest[VAR_7] = h->cur_pic.f.data[VAR_7] +\n((VAR_0 << PIXEL_SHIFT) + VAR_1 * h->VAR_4) * 16;", "h->vdsp.prefetch(dest[VAR_7] + (h->VAR_0 & 3) * 4 * h->VAR_4 + (64 << PIXEL_SHIFT),\nh->VAR_4, 4);", "}", "h->list_counts[VAR_2] = h->list_count;", "if (!SIMPLE && MB_FIELD) {", "VAR_4 = h->mb_linesize = h->mb_uvlinesize = h->VAR_4 * 2;", "VAR_8 = &h->VAR_8[48];", "if (VAR_1 & 1)\nfor (VAR_7 = 0; VAR_7 < 3; VAR_7++)", "dest[VAR_7] -= h->VAR_4 * 15;", "if (FRAME_MBAFF) {", "int VAR_11;", "for (VAR_11 = 0; VAR_11 < h->list_count; VAR_11++) {", "if (!USES_LIST(VAR_3, VAR_11))\ncontinue;", "if (IS_16X16(VAR_3)) {", "int8_t *ref = &h->ref_cache[VAR_11][scan8[0]];", "fill_rectangle(ref, 4, 4, 8, (16 + *ref) ^ (h->VAR_1 & 1), 1);", "} else {", "for (VAR_5 = 0; VAR_5 < 16; VAR_5 += 4) {", "int ref = h->ref_cache[VAR_11][scan8[VAR_5]];", "if (ref >= 0)\nfill_rectangle(&h->ref_cache[VAR_11][scan8[VAR_5]], 2, 2,\n8, (16 + ref) ^ (h->VAR_1 & 1), 1);", "}", "}", "}", "}", "} else {", "VAR_4 = h->mb_linesize = h->mb_uvlinesize = h->VAR_4;", "}", "if (!SIMPLE && IS_INTRA_PCM(VAR_3)) {", "if (PIXEL_SHIFT) {", "const int VAR_12 = h->sps.bit_depth_luma;", "GetBitContext gb;", "init_get_bits(&gb, (uint8_t *)h->intra_pcm_ptr, 768 * VAR_12);", "for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++)", "for (VAR_5 = 0; VAR_5 < 16; VAR_5++) {", "uint16_t *tmp = (uint16_t *)(dest[VAR_7] + VAR_5 * VAR_4);", "for (VAR_6 = 0; VAR_6 < 16; VAR_6++)", "tmp[VAR_6] = get_bits(&gb, VAR_12);", "}", "} else {", "for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++)", "for (VAR_5 = 0; VAR_5 < 16; VAR_5++)", "memcpy(dest[VAR_7] + VAR_5 * VAR_4,\n(uint8_t *)h->intra_pcm_ptr + VAR_7 * 256 + VAR_5 * 16, 16);", "}", "} else {", "if (IS_INTRA(VAR_3)) {", "if (h->deblocking_filter)\nxchg_mb_border(h, dest[0], dest[1], dest[2], VAR_4,\nVAR_4, 1, 1, SIMPLE, PIXEL_SHIFT);", "for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++)", "hl_decode_mb_predict_luma(h, VAR_3, 1, SIMPLE,\nVAR_9, PIXEL_SHIFT,\nVAR_8, VAR_4, dest[VAR_7], VAR_7);", "if (h->deblocking_filter)\nxchg_mb_border(h, dest[0], dest[1], dest[2], VAR_4,\nVAR_4, 0, 1, SIMPLE, PIXEL_SHIFT);", "} else {", "FUNC_0(hl_motion_444)(h, dest[0], dest[1], dest[2],\nh->me.qpel_put, h->h264chroma.put_h264_chroma_pixels_tab,\nh->me.qpel_avg, h->h264chroma.avg_h264_chroma_pixels_tab,\nh->h264dsp.weight_h264_pixels_tab,\nh->h264dsp.biweight_h264_pixels_tab);", "}", "for (VAR_7 = 0; VAR_7 < VAR_10; VAR_7++)", "hl_decode_mb_idct_luma(h, VAR_3, 1, SIMPLE, VAR_9,\nPIXEL_SHIFT, VAR_8, VAR_4,\ndest[VAR_7], VAR_7);", "if (h->cbp || IS_INTRA(VAR_3)) {", "h->dsp.clear_blocks(h->mb);", "h->dsp.clear_blocks(h->mb + (24 * 16 << PIXEL_SHIFT));", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 33, 35 ], [ 37 ], [ 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 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131, 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143, 145 ], [ 149 ], [ 151, 153, 155 ], [ 159, 161, 163 ], [ 165 ], [ 167, 169, 171, 173, 175 ], [ 177 ], [ 181 ], [ 183, 185, 187 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ] ]
15,109
static void msvideo1_decode_8bit(Msvideo1Context *s) { int block_ptr, pixel_ptr; int total_blocks; int pixel_x, pixel_y; /* pixel width and height iterators */ int block_x, block_y; /* block width and height iterators */ int blocks_wide, blocks_high; /* width and height in 4x4 blocks */ int block_inc; int row_dec; /* decoding parameters */ int stream_ptr; unsigned char byte_a, byte_b; unsigned short flags; int skip_blocks; unsigned char colors[8]; unsigned char *pixels = s->frame.data[0]; unsigned char *prev_pixels = s->prev_frame.data[0]; int stride = s->frame.linesize[0]; stream_ptr = 0; skip_blocks = 0; blocks_wide = s->avctx->width / 4; blocks_high = s->avctx->height / 4; total_blocks = blocks_wide * blocks_high; block_inc = 4; row_dec = stride + 4; for (block_y = blocks_high; block_y > 0; block_y--) { block_ptr = ((block_y * 4) - 1) * stride; for (block_x = blocks_wide; block_x > 0; block_x--) { /* check if this block should be skipped */ if (skip_blocks) { COPY_PREV_BLOCK(); block_ptr += block_inc; skip_blocks--; total_blocks--; continue; } pixel_ptr = block_ptr; /* get the next two bytes in the encoded data stream */ CHECK_STREAM_PTR(2); byte_a = s->buf[stream_ptr++]; byte_b = s->buf[stream_ptr++]; /* check if the decode is finished */ if ((byte_a == 0) && (byte_b == 0) && (total_blocks == 0)) return; else if ((byte_b & 0xFC) == 0x84) { /* skip code, but don't count the current block */ skip_blocks = ((byte_b - 0x84) << 8) + byte_a - 1; COPY_PREV_BLOCK(); } else if (byte_b < 0x80) { /* 2-color encoding */ flags = (byte_b << 8) | byte_a; CHECK_STREAM_PTR(2); colors[0] = s->buf[stream_ptr++]; colors[1] = s->buf[stream_ptr++]; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1) pixels[pixel_ptr++] = colors[(flags & 0x1) ^ 1]; pixel_ptr -= row_dec; } } else if (byte_b >= 0x90) { /* 8-color encoding */ flags = (byte_b << 8) | byte_a; CHECK_STREAM_PTR(8); memcpy(colors, &s->buf[stream_ptr], 8); stream_ptr += 8; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1) pixels[pixel_ptr++] = colors[((pixel_y & 0x2) << 1) + (pixel_x & 0x2) + ((flags & 0x1) ^ 1)]; pixel_ptr -= row_dec; } } else { /* 1-color encoding */ colors[0] = byte_a; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++) pixels[pixel_ptr++] = colors[0]; pixel_ptr -= row_dec; } } block_ptr += block_inc; total_blocks--; } } /* make the palette available on the way out */ if (s->avctx->pix_fmt == PIX_FMT_PAL8) memcpy(s->frame.data[1], s->palette, PALETTE_COUNT * 4); }
false
FFmpeg
875efafac8afe22971c87fc7dfee83d27364ab50
static void msvideo1_decode_8bit(Msvideo1Context *s) { int block_ptr, pixel_ptr; int total_blocks; int pixel_x, pixel_y; int block_x, block_y; int blocks_wide, blocks_high; int block_inc; int row_dec; int stream_ptr; unsigned char byte_a, byte_b; unsigned short flags; int skip_blocks; unsigned char colors[8]; unsigned char *pixels = s->frame.data[0]; unsigned char *prev_pixels = s->prev_frame.data[0]; int stride = s->frame.linesize[0]; stream_ptr = 0; skip_blocks = 0; blocks_wide = s->avctx->width / 4; blocks_high = s->avctx->height / 4; total_blocks = blocks_wide * blocks_high; block_inc = 4; row_dec = stride + 4; for (block_y = blocks_high; block_y > 0; block_y--) { block_ptr = ((block_y * 4) - 1) * stride; for (block_x = blocks_wide; block_x > 0; block_x--) { if (skip_blocks) { COPY_PREV_BLOCK(); block_ptr += block_inc; skip_blocks--; total_blocks--; continue; } pixel_ptr = block_ptr; CHECK_STREAM_PTR(2); byte_a = s->buf[stream_ptr++]; byte_b = s->buf[stream_ptr++]; if ((byte_a == 0) && (byte_b == 0) && (total_blocks == 0)) return; else if ((byte_b & 0xFC) == 0x84) { skip_blocks = ((byte_b - 0x84) << 8) + byte_a - 1; COPY_PREV_BLOCK(); } else if (byte_b < 0x80) { flags = (byte_b << 8) | byte_a; CHECK_STREAM_PTR(2); colors[0] = s->buf[stream_ptr++]; colors[1] = s->buf[stream_ptr++]; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1) pixels[pixel_ptr++] = colors[(flags & 0x1) ^ 1]; pixel_ptr -= row_dec; } } else if (byte_b >= 0x90) { flags = (byte_b << 8) | byte_a; CHECK_STREAM_PTR(8); memcpy(colors, &s->buf[stream_ptr], 8); stream_ptr += 8; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++, flags >>= 1) pixels[pixel_ptr++] = colors[((pixel_y & 0x2) << 1) + (pixel_x & 0x2) + ((flags & 0x1) ^ 1)]; pixel_ptr -= row_dec; } } else { colors[0] = byte_a; for (pixel_y = 0; pixel_y < 4; pixel_y++) { for (pixel_x = 0; pixel_x < 4; pixel_x++) pixels[pixel_ptr++] = colors[0]; pixel_ptr -= row_dec; } } block_ptr += block_inc; total_blocks--; } } if (s->avctx->pix_fmt == PIX_FMT_PAL8) memcpy(s->frame.data[1], s->palette, PALETTE_COUNT * 4); }
{ "code": [], "line_no": [] }
static void FUNC_0(Msvideo1Context *VAR_0) { int VAR_1, VAR_2; int VAR_3; int VAR_4, VAR_5; int VAR_6, VAR_7; int VAR_8, VAR_9; int VAR_10; int VAR_11; int VAR_12; unsigned char VAR_13, VAR_14; unsigned short VAR_15; int VAR_16; unsigned char VAR_17[8]; unsigned char *VAR_18 = VAR_0->frame.data[0]; unsigned char *VAR_19 = VAR_0->prev_frame.data[0]; int VAR_20 = VAR_0->frame.linesize[0]; VAR_12 = 0; VAR_16 = 0; VAR_8 = VAR_0->avctx->width / 4; VAR_9 = VAR_0->avctx->height / 4; VAR_3 = VAR_8 * VAR_9; VAR_10 = 4; VAR_11 = VAR_20 + 4; for (VAR_7 = VAR_9; VAR_7 > 0; VAR_7--) { VAR_1 = ((VAR_7 * 4) - 1) * VAR_20; for (VAR_6 = VAR_8; VAR_6 > 0; VAR_6--) { if (VAR_16) { COPY_PREV_BLOCK(); VAR_1 += VAR_10; VAR_16--; VAR_3--; continue; } VAR_2 = VAR_1; CHECK_STREAM_PTR(2); VAR_13 = VAR_0->buf[VAR_12++]; VAR_14 = VAR_0->buf[VAR_12++]; if ((VAR_13 == 0) && (VAR_14 == 0) && (VAR_3 == 0)) return; else if ((VAR_14 & 0xFC) == 0x84) { VAR_16 = ((VAR_14 - 0x84) << 8) + VAR_13 - 1; COPY_PREV_BLOCK(); } else if (VAR_14 < 0x80) { VAR_15 = (VAR_14 << 8) | VAR_13; CHECK_STREAM_PTR(2); VAR_17[0] = VAR_0->buf[VAR_12++]; VAR_17[1] = VAR_0->buf[VAR_12++]; for (VAR_5 = 0; VAR_5 < 4; VAR_5++) { for (VAR_4 = 0; VAR_4 < 4; VAR_4++, VAR_15 >>= 1) VAR_18[VAR_2++] = VAR_17[(VAR_15 & 0x1) ^ 1]; VAR_2 -= VAR_11; } } else if (VAR_14 >= 0x90) { VAR_15 = (VAR_14 << 8) | VAR_13; CHECK_STREAM_PTR(8); memcpy(VAR_17, &VAR_0->buf[VAR_12], 8); VAR_12 += 8; for (VAR_5 = 0; VAR_5 < 4; VAR_5++) { for (VAR_4 = 0; VAR_4 < 4; VAR_4++, VAR_15 >>= 1) VAR_18[VAR_2++] = VAR_17[((VAR_5 & 0x2) << 1) + (VAR_4 & 0x2) + ((VAR_15 & 0x1) ^ 1)]; VAR_2 -= VAR_11; } } else { VAR_17[0] = VAR_13; for (VAR_5 = 0; VAR_5 < 4; VAR_5++) { for (VAR_4 = 0; VAR_4 < 4; VAR_4++) VAR_18[VAR_2++] = VAR_17[0]; VAR_2 -= VAR_11; } } VAR_1 += VAR_10; VAR_3--; } } if (VAR_0->avctx->pix_fmt == PIX_FMT_PAL8) memcpy(VAR_0->frame.data[1], VAR_0->palette, PALETTE_COUNT * 4); }
[ "static void FUNC_0(Msvideo1Context *VAR_0)\n{", "int VAR_1, VAR_2;", "int VAR_3;", "int VAR_4, VAR_5;", "int VAR_6, VAR_7;", "int VAR_8, VAR_9;", "int VAR_10;", "int VAR_11;", "int VAR_12;", "unsigned char VAR_13, VAR_14;", "unsigned short VAR_15;", "int VAR_16;", "unsigned char VAR_17[8];", "unsigned char *VAR_18 = VAR_0->frame.data[0];", "unsigned char *VAR_19 = VAR_0->prev_frame.data[0];", "int VAR_20 = VAR_0->frame.linesize[0];", "VAR_12 = 0;", "VAR_16 = 0;", "VAR_8 = VAR_0->avctx->width / 4;", "VAR_9 = VAR_0->avctx->height / 4;", "VAR_3 = VAR_8 * VAR_9;", "VAR_10 = 4;", "VAR_11 = VAR_20 + 4;", "for (VAR_7 = VAR_9; VAR_7 > 0; VAR_7--) {", "VAR_1 = ((VAR_7 * 4) - 1) * VAR_20;", "for (VAR_6 = VAR_8; VAR_6 > 0; VAR_6--) {", "if (VAR_16) {", "COPY_PREV_BLOCK();", "VAR_1 += VAR_10;", "VAR_16--;", "VAR_3--;", "continue;", "}", "VAR_2 = VAR_1;", "CHECK_STREAM_PTR(2);", "VAR_13 = VAR_0->buf[VAR_12++];", "VAR_14 = VAR_0->buf[VAR_12++];", "if ((VAR_13 == 0) && (VAR_14 == 0) && (VAR_3 == 0))\nreturn;", "else if ((VAR_14 & 0xFC) == 0x84) {", "VAR_16 = ((VAR_14 - 0x84) << 8) + VAR_13 - 1;", "COPY_PREV_BLOCK();", "} else if (VAR_14 < 0x80) {", "VAR_15 = (VAR_14 << 8) | VAR_13;", "CHECK_STREAM_PTR(2);", "VAR_17[0] = VAR_0->buf[VAR_12++];", "VAR_17[1] = VAR_0->buf[VAR_12++];", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++) {", "for (VAR_4 = 0; VAR_4 < 4; VAR_4++, VAR_15 >>= 1)", "VAR_18[VAR_2++] = VAR_17[(VAR_15 & 0x1) ^ 1];", "VAR_2 -= VAR_11;", "}", "} else if (VAR_14 >= 0x90) {", "VAR_15 = (VAR_14 << 8) | VAR_13;", "CHECK_STREAM_PTR(8);", "memcpy(VAR_17, &VAR_0->buf[VAR_12], 8);", "VAR_12 += 8;", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++) {", "for (VAR_4 = 0; VAR_4 < 4; VAR_4++, VAR_15 >>= 1)", "VAR_18[VAR_2++] =\nVAR_17[((VAR_5 & 0x2) << 1) +\n(VAR_4 & 0x2) + ((VAR_15 & 0x1) ^ 1)];", "VAR_2 -= VAR_11;", "}", "} else {", "VAR_17[0] = VAR_13;", "for (VAR_5 = 0; VAR_5 < 4; VAR_5++) {", "for (VAR_4 = 0; VAR_4 < 4; VAR_4++)", "VAR_18[VAR_2++] = VAR_17[0];", "VAR_2 -= VAR_11;", "}", "}", "VAR_1 += VAR_10;", "VAR_3--;", "}", "}", "if (VAR_0->avctx->pix_fmt == PIX_FMT_PAL8)\nmemcpy(VAR_0->frame.data[1], VAR_0->palette, PALETTE_COUNT * 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, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 97, 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 151 ], [ 153 ], [ 155, 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 199, 201 ], [ 203 ] ]
15,110
static int lrc_read_header(AVFormatContext *s) { LRCContext *lrc = s->priv_data; AVBPrint line; AVStream *st; st = avformat_new_stream(s, NULL); if(!st) { return AVERROR(ENOMEM); } avpriv_set_pts_info(st, 64, 1, 1000); lrc->ts_offset = 0; st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codecpar->codec_id = AV_CODEC_ID_TEXT; av_bprint_init(&line, 0, AV_BPRINT_SIZE_UNLIMITED); while(!avio_feof(s->pb)) { int64_t pos = read_line(&line, s->pb); int64_t header_offset = find_header(line.str); if(header_offset >= 0) { char *comma_offset = strchr(line.str, ':'); if(comma_offset) { char *right_bracket_offset = strchr(line.str, ']'); if(!right_bracket_offset) { continue; } *right_bracket_offset = *comma_offset = '\0'; if(strcmp(line.str + 1, "offset") || sscanf(comma_offset + 1, "%"SCNd64, &lrc->ts_offset) != 1) { av_dict_set(&s->metadata, line.str + 1, comma_offset + 1, 0); } *comma_offset = ':'; *right_bracket_offset = ']'; } } else { AVPacket *sub; int64_t ts_start = AV_NOPTS_VALUE; int64_t ts_stroffset = 0; int64_t ts_stroffset_incr = 0; int64_t ts_strlength = count_ts(line.str); while((ts_stroffset_incr = read_ts(line.str + ts_stroffset, &ts_start)) != 0) { ts_stroffset += ts_stroffset_incr; sub = ff_subtitles_queue_insert(&lrc->q, line.str + ts_strlength, line.len - ts_strlength, 0); if(!sub) { return AVERROR(ENOMEM); } sub->pos = pos; sub->pts = ts_start - lrc->ts_offset; sub->duration = -1; } } } ff_subtitles_queue_finalize(s, &lrc->q); ff_metadata_conv_ctx(s, NULL, ff_lrc_metadata_conv); return 0; }
true
FFmpeg
ef5994e09d07ace62a672fcdc84761231288edad
static int lrc_read_header(AVFormatContext *s) { LRCContext *lrc = s->priv_data; AVBPrint line; AVStream *st; st = avformat_new_stream(s, NULL); if(!st) { return AVERROR(ENOMEM); } avpriv_set_pts_info(st, 64, 1, 1000); lrc->ts_offset = 0; st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codecpar->codec_id = AV_CODEC_ID_TEXT; av_bprint_init(&line, 0, AV_BPRINT_SIZE_UNLIMITED); while(!avio_feof(s->pb)) { int64_t pos = read_line(&line, s->pb); int64_t header_offset = find_header(line.str); if(header_offset >= 0) { char *comma_offset = strchr(line.str, ':'); if(comma_offset) { char *right_bracket_offset = strchr(line.str, ']'); if(!right_bracket_offset) { continue; } *right_bracket_offset = *comma_offset = '\0'; if(strcmp(line.str + 1, "offset") || sscanf(comma_offset + 1, "%"SCNd64, &lrc->ts_offset) != 1) { av_dict_set(&s->metadata, line.str + 1, comma_offset + 1, 0); } *comma_offset = ':'; *right_bracket_offset = ']'; } } else { AVPacket *sub; int64_t ts_start = AV_NOPTS_VALUE; int64_t ts_stroffset = 0; int64_t ts_stroffset_incr = 0; int64_t ts_strlength = count_ts(line.str); while((ts_stroffset_incr = read_ts(line.str + ts_stroffset, &ts_start)) != 0) { ts_stroffset += ts_stroffset_incr; sub = ff_subtitles_queue_insert(&lrc->q, line.str + ts_strlength, line.len - ts_strlength, 0); if(!sub) { return AVERROR(ENOMEM); } sub->pos = pos; sub->pts = ts_start - lrc->ts_offset; sub->duration = -1; } } } ff_subtitles_queue_finalize(s, &lrc->q); ff_metadata_conv_ctx(s, NULL, ff_lrc_metadata_conv); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0) { LRCContext *lrc = VAR_0->priv_data; AVBPrint line; AVStream *st; st = avformat_new_stream(VAR_0, NULL); if(!st) { return AVERROR(ENOMEM); } avpriv_set_pts_info(st, 64, 1, 1000); lrc->ts_offset = 0; st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codecpar->codec_id = AV_CODEC_ID_TEXT; av_bprint_init(&line, 0, AV_BPRINT_SIZE_UNLIMITED); while(!avio_feof(VAR_0->pb)) { int64_t pos = read_line(&line, VAR_0->pb); int64_t header_offset = find_header(line.str); if(header_offset >= 0) { char *VAR_1 = strchr(line.str, ':'); if(VAR_1) { char *VAR_2 = strchr(line.str, ']'); if(!VAR_2) { continue; } *VAR_2 = *VAR_1 = '\0'; if(strcmp(line.str + 1, "offset") || sscanf(VAR_1 + 1, "%"SCNd64, &lrc->ts_offset) != 1) { av_dict_set(&VAR_0->metadata, line.str + 1, VAR_1 + 1, 0); } *VAR_1 = ':'; *VAR_2 = ']'; } } else { AVPacket *sub; int64_t ts_start = AV_NOPTS_VALUE; int64_t ts_stroffset = 0; int64_t ts_stroffset_incr = 0; int64_t ts_strlength = count_ts(line.str); while((ts_stroffset_incr = read_ts(line.str + ts_stroffset, &ts_start)) != 0) { ts_stroffset += ts_stroffset_incr; sub = ff_subtitles_queue_insert(&lrc->q, line.str + ts_strlength, line.len - ts_strlength, 0); if(!sub) { return AVERROR(ENOMEM); } sub->pos = pos; sub->pts = ts_start - lrc->ts_offset; sub->duration = -1; } } } ff_subtitles_queue_finalize(VAR_0, &lrc->q); ff_metadata_conv_ctx(VAR_0, NULL, ff_lrc_metadata_conv); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0)\n{", "LRCContext *lrc = VAR_0->priv_data;", "AVBPrint line;", "AVStream *st;", "st = avformat_new_stream(VAR_0, NULL);", "if(!st) {", "return AVERROR(ENOMEM);", "}", "avpriv_set_pts_info(st, 64, 1, 1000);", "lrc->ts_offset = 0;", "st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;", "st->codecpar->codec_id = AV_CODEC_ID_TEXT;", "av_bprint_init(&line, 0, AV_BPRINT_SIZE_UNLIMITED);", "while(!avio_feof(VAR_0->pb)) {", "int64_t pos = read_line(&line, VAR_0->pb);", "int64_t header_offset = find_header(line.str);", "if(header_offset >= 0) {", "char *VAR_1 = strchr(line.str, ':');", "if(VAR_1) {", "char *VAR_2 = strchr(line.str, ']');", "if(!VAR_2) {", "continue;", "}", "*VAR_2 = *VAR_1 = '\\0';", "if(strcmp(line.str + 1, \"offset\") ||\nsscanf(VAR_1 + 1, \"%\"SCNd64, &lrc->ts_offset) != 1) {", "av_dict_set(&VAR_0->metadata, line.str + 1, VAR_1 + 1, 0);", "}", "*VAR_1 = ':';", "*VAR_2 = ']';", "}", "} else {", "AVPacket *sub;", "int64_t ts_start = AV_NOPTS_VALUE;", "int64_t ts_stroffset = 0;", "int64_t ts_stroffset_incr = 0;", "int64_t ts_strlength = count_ts(line.str);", "while((ts_stroffset_incr = read_ts(line.str + ts_stroffset,\n&ts_start)) != 0) {", "ts_stroffset += ts_stroffset_incr;", "sub = ff_subtitles_queue_insert(&lrc->q, line.str + ts_strlength,\nline.len - ts_strlength, 0);", "if(!sub) {", "return AVERROR(ENOMEM);", "}", "sub->pos = pos;", "sub->pts = ts_start - lrc->ts_offset;", "sub->duration = -1;", "}", "}", "}", "ff_subtitles_queue_finalize(VAR_0, &lrc->q);", "ff_metadata_conv_ctx(VAR_0, NULL, ff_lrc_metadata_conv);", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 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 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89 ], [ 91 ], [ 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 120 ], [ 122 ] ]
15,111
static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size) { ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; AVDictionaryEntry *tags[5]; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; int has_title; int metadata_count; AVCodecParameters *par; int64_t header_offset, cur_pos, hpos; int bit_rate; int64_t duration; ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL); tags[0] = av_dict_get(s->metadata, "title", NULL, 0); tags[1] = av_dict_get(s->metadata, "author", NULL, 0); tags[2] = av_dict_get(s->metadata, "copyright", NULL, 0); tags[3] = av_dict_get(s->metadata, "comment", NULL, 0); tags[4] = av_dict_get(s->metadata, "rating", NULL, 0); duration = asf->duration + PREROLL_TIME * 10000; has_title = tags[0] || tags[1] || tags[2] || tags[3] || tags[4]; metadata_count = av_dict_count(s->metadata); bit_rate = 0; for (n = 0; n < s->nb_streams; n++) { par = s->streams[n]->codecpar; avpriv_set_pts_info(s->streams[n], 32, 1, 1000); /* 32 bit pts in ms */ bit_rate += par->bit_rate; } if (asf->is_streamed) { put_chunk(s, 0x4824, 0, 0xc00); /* start of stream (length will be patched later) */ } put_guid(pb, &ff_asf_header); avio_wl64(pb, -1); /* header length, will be patched after */ avio_wl32(pb, 3 + has_title + !!metadata_count + s->nb_streams); /* number of chunks in header */ avio_w8(pb, 1); /* ??? */ avio_w8(pb, 2); /* ??? */ /* file header */ header_offset = avio_tell(pb); hpos = put_header(pb, &ff_asf_file_header); put_guid(pb, &ff_asf_my_guid); avio_wl64(pb, file_size); file_time = 0; avio_wl64(pb, unix_to_file_time(file_time)); avio_wl64(pb, asf->nb_packets); /* number of packets */ avio_wl64(pb, duration); /* end time stamp (in 100ns units) */ avio_wl64(pb, asf->duration); /* duration (in 100ns units) */ avio_wl64(pb, PREROLL_TIME); /* start time stamp */ avio_wl32(pb, (asf->is_streamed || !pb->seekable) ? 3 : 2); /* ??? */ avio_wl32(pb, s->packet_size); /* packet size */ avio_wl32(pb, s->packet_size); /* packet size */ avio_wl32(pb, bit_rate); /* Nominal data rate in bps */ end_header(pb, hpos); /* unknown headers */ hpos = put_header(pb, &ff_asf_head1_guid); put_guid(pb, &ff_asf_head2_guid); avio_wl32(pb, 6); avio_wl16(pb, 0); end_header(pb, hpos); /* title and other infos */ if (has_title) { int len; uint8_t *buf; AVIOContext *dyn_buf; if (avio_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); hpos = put_header(pb, &ff_asf_comment_header); for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) { len = tags[n] ? avio_put_str16le(dyn_buf, tags[n]->value) : 0; avio_wl16(pb, len); } len = avio_close_dyn_buf(dyn_buf, &buf); avio_write(pb, buf, len); av_freep(&buf); end_header(pb, hpos); } if (metadata_count) { AVDictionaryEntry *tag = NULL; hpos = put_header(pb, &ff_asf_extended_content_header); avio_wl16(pb, metadata_count); while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { put_str16(pb, tag->key); avio_wl16(pb, 0); put_str16(pb, tag->value); } end_header(pb, hpos); } /* chapters using ASF markers */ if (!asf->is_streamed && s->nb_chapters) { int ret; if (ret = asf_write_markers(s)) return ret; } /* stream headers */ for (n = 0; n < s->nb_streams; n++) { int64_t es_pos; // ASFStream *stream = &asf->streams[n]; par = s->streams[n]->codecpar; asf->streams[n].num = n + 1; asf->streams[n].seq = 0; switch (par->codec_type) { case AVMEDIA_TYPE_AUDIO: wav_extra_size = 0; extra_size = 18 + wav_extra_size; extra_size2 = 8; break; default: case AVMEDIA_TYPE_VIDEO: wav_extra_size = par->extradata_size; extra_size = 0x33 + wav_extra_size; extra_size2 = 0; break; } hpos = put_header(pb, &ff_asf_stream_header); if (par->codec_type == AVMEDIA_TYPE_AUDIO) { put_guid(pb, &ff_asf_audio_stream); put_guid(pb, &ff_asf_audio_conceal_spread); } else { put_guid(pb, &ff_asf_video_stream); put_guid(pb, &ff_asf_video_conceal_none); } avio_wl64(pb, 0); /* ??? */ es_pos = avio_tell(pb); avio_wl32(pb, extra_size); /* wav header len */ avio_wl32(pb, extra_size2); /* additional data len */ avio_wl16(pb, n + 1); /* stream number */ avio_wl32(pb, 0); /* ??? */ if (par->codec_type == AVMEDIA_TYPE_AUDIO) { /* WAVEFORMATEX header */ int wavsize = ff_put_wav_header(s, pb, par); if (wavsize < 0) return -1; if (wavsize != extra_size) { cur_pos = avio_tell(pb); avio_seek(pb, es_pos, SEEK_SET); avio_wl32(pb, wavsize); /* wav header len */ avio_seek(pb, cur_pos, SEEK_SET); } /* ERROR Correction */ avio_w8(pb, 0x01); if (par->codec_id == AV_CODEC_ID_ADPCM_G726 || !par->block_align) { avio_wl16(pb, 0x0190); avio_wl16(pb, 0x0190); } else { avio_wl16(pb, par->block_align); avio_wl16(pb, par->block_align); } avio_wl16(pb, 0x01); avio_w8(pb, 0x00); } else { avio_wl32(pb, par->width); avio_wl32(pb, par->height); avio_w8(pb, 2); /* ??? */ avio_wl16(pb, 40 + par->extradata_size); /* size */ /* BITMAPINFOHEADER header */ ff_put_bmp_header(pb, par, ff_codec_bmp_tags, 1); } end_header(pb, hpos); } /* media comments */ hpos = put_header(pb, &ff_asf_codec_comment_header); put_guid(pb, &ff_asf_codec_comment1_header); avio_wl32(pb, s->nb_streams); for (n = 0; n < s->nb_streams; n++) { const AVCodecDescriptor *codec_desc; const char *desc; par = s->streams[n]->codecpar; codec_desc = avcodec_descriptor_get(par->codec_id); if (par->codec_type == AVMEDIA_TYPE_AUDIO) avio_wl16(pb, 2); else if (par->codec_type == AVMEDIA_TYPE_VIDEO) avio_wl16(pb, 1); else avio_wl16(pb, -1); if (par->codec_id == AV_CODEC_ID_WMAV2) desc = "Windows Media Audio V8"; else desc = codec_desc ? codec_desc->name : NULL; if (desc) { AVIOContext *dyn_buf; uint8_t *buf; int len; if (avio_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); avio_put_str16le(dyn_buf, desc); len = avio_close_dyn_buf(dyn_buf, &buf); avio_wl16(pb, len / 2); // "number of characters" = length in bytes / 2 avio_write(pb, buf, len); av_freep(&buf); } else avio_wl16(pb, 0); avio_wl16(pb, 0); /* no parameters */ /* id */ if (par->codec_type == AVMEDIA_TYPE_AUDIO) { avio_wl16(pb, 2); avio_wl16(pb, par->codec_tag); } else { avio_wl16(pb, 4); avio_wl32(pb, par->codec_tag); } if (!par->codec_tag) return -1; } end_header(pb, hpos); /* patch the header size fields */ cur_pos = avio_tell(pb); header_size = cur_pos - header_offset; if (asf->is_streamed) { header_size += 8 + 30 + DATA_HEADER_SIZE; avio_seek(pb, header_offset - 10 - 30, SEEK_SET); avio_wl16(pb, header_size); avio_seek(pb, header_offset - 2 - 30, SEEK_SET); avio_wl16(pb, header_size); header_size -= 8 + 30 + DATA_HEADER_SIZE; } header_size += 24 + 6; avio_seek(pb, header_offset - 14, SEEK_SET); avio_wl64(pb, header_size); avio_seek(pb, cur_pos, SEEK_SET); /* movie chunk, followed by packets of packet_size */ asf->data_offset = cur_pos; put_guid(pb, &ff_asf_data_header); avio_wl64(pb, data_chunk_size); put_guid(pb, &ff_asf_my_guid); avio_wl64(pb, asf->nb_packets); /* nb packets */ avio_w8(pb, 1); /* ??? */ avio_w8(pb, 1); /* ??? */ return 0; }
true
FFmpeg
ff3db937ef3aa30046a3936146f86ad48ee2ff90
static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data_chunk_size) { ASFContext *asf = s->priv_data; AVIOContext *pb = s->pb; AVDictionaryEntry *tags[5]; int header_size, n, extra_size, extra_size2, wav_extra_size, file_time; int has_title; int metadata_count; AVCodecParameters *par; int64_t header_offset, cur_pos, hpos; int bit_rate; int64_t duration; ff_metadata_conv(&s->metadata, ff_asf_metadata_conv, NULL); tags[0] = av_dict_get(s->metadata, "title", NULL, 0); tags[1] = av_dict_get(s->metadata, "author", NULL, 0); tags[2] = av_dict_get(s->metadata, "copyright", NULL, 0); tags[3] = av_dict_get(s->metadata, "comment", NULL, 0); tags[4] = av_dict_get(s->metadata, "rating", NULL, 0); duration = asf->duration + PREROLL_TIME * 10000; has_title = tags[0] || tags[1] || tags[2] || tags[3] || tags[4]; metadata_count = av_dict_count(s->metadata); bit_rate = 0; for (n = 0; n < s->nb_streams; n++) { par = s->streams[n]->codecpar; avpriv_set_pts_info(s->streams[n], 32, 1, 1000); bit_rate += par->bit_rate; } if (asf->is_streamed) { put_chunk(s, 0x4824, 0, 0xc00); } put_guid(pb, &ff_asf_header); avio_wl64(pb, -1); avio_wl32(pb, 3 + has_title + !!metadata_count + s->nb_streams); avio_w8(pb, 1); avio_w8(pb, 2); header_offset = avio_tell(pb); hpos = put_header(pb, &ff_asf_file_header); put_guid(pb, &ff_asf_my_guid); avio_wl64(pb, file_size); file_time = 0; avio_wl64(pb, unix_to_file_time(file_time)); avio_wl64(pb, asf->nb_packets); avio_wl64(pb, duration); avio_wl64(pb, asf->duration); avio_wl64(pb, PREROLL_TIME); avio_wl32(pb, (asf->is_streamed || !pb->seekable) ? 3 : 2); avio_wl32(pb, s->packet_size); avio_wl32(pb, s->packet_size); avio_wl32(pb, bit_rate); end_header(pb, hpos); hpos = put_header(pb, &ff_asf_head1_guid); put_guid(pb, &ff_asf_head2_guid); avio_wl32(pb, 6); avio_wl16(pb, 0); end_header(pb, hpos); if (has_title) { int len; uint8_t *buf; AVIOContext *dyn_buf; if (avio_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); hpos = put_header(pb, &ff_asf_comment_header); for (n = 0; n < FF_ARRAY_ELEMS(tags); n++) { len = tags[n] ? avio_put_str16le(dyn_buf, tags[n]->value) : 0; avio_wl16(pb, len); } len = avio_close_dyn_buf(dyn_buf, &buf); avio_write(pb, buf, len); av_freep(&buf); end_header(pb, hpos); } if (metadata_count) { AVDictionaryEntry *tag = NULL; hpos = put_header(pb, &ff_asf_extended_content_header); avio_wl16(pb, metadata_count); while ((tag = av_dict_get(s->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { put_str16(pb, tag->key); avio_wl16(pb, 0); put_str16(pb, tag->value); } end_header(pb, hpos); } if (!asf->is_streamed && s->nb_chapters) { int ret; if (ret = asf_write_markers(s)) return ret; } for (n = 0; n < s->nb_streams; n++) { int64_t es_pos; par = s->streams[n]->codecpar; asf->streams[n].num = n + 1; asf->streams[n].seq = 0; switch (par->codec_type) { case AVMEDIA_TYPE_AUDIO: wav_extra_size = 0; extra_size = 18 + wav_extra_size; extra_size2 = 8; break; default: case AVMEDIA_TYPE_VIDEO: wav_extra_size = par->extradata_size; extra_size = 0x33 + wav_extra_size; extra_size2 = 0; break; } hpos = put_header(pb, &ff_asf_stream_header); if (par->codec_type == AVMEDIA_TYPE_AUDIO) { put_guid(pb, &ff_asf_audio_stream); put_guid(pb, &ff_asf_audio_conceal_spread); } else { put_guid(pb, &ff_asf_video_stream); put_guid(pb, &ff_asf_video_conceal_none); } avio_wl64(pb, 0); es_pos = avio_tell(pb); avio_wl32(pb, extra_size); avio_wl32(pb, extra_size2); avio_wl16(pb, n + 1); avio_wl32(pb, 0); if (par->codec_type == AVMEDIA_TYPE_AUDIO) { int wavsize = ff_put_wav_header(s, pb, par); if (wavsize < 0) return -1; if (wavsize != extra_size) { cur_pos = avio_tell(pb); avio_seek(pb, es_pos, SEEK_SET); avio_wl32(pb, wavsize); avio_seek(pb, cur_pos, SEEK_SET); } avio_w8(pb, 0x01); if (par->codec_id == AV_CODEC_ID_ADPCM_G726 || !par->block_align) { avio_wl16(pb, 0x0190); avio_wl16(pb, 0x0190); } else { avio_wl16(pb, par->block_align); avio_wl16(pb, par->block_align); } avio_wl16(pb, 0x01); avio_w8(pb, 0x00); } else { avio_wl32(pb, par->width); avio_wl32(pb, par->height); avio_w8(pb, 2); avio_wl16(pb, 40 + par->extradata_size); ff_put_bmp_header(pb, par, ff_codec_bmp_tags, 1); } end_header(pb, hpos); } hpos = put_header(pb, &ff_asf_codec_comment_header); put_guid(pb, &ff_asf_codec_comment1_header); avio_wl32(pb, s->nb_streams); for (n = 0; n < s->nb_streams; n++) { const AVCodecDescriptor *codec_desc; const char *desc; par = s->streams[n]->codecpar; codec_desc = avcodec_descriptor_get(par->codec_id); if (par->codec_type == AVMEDIA_TYPE_AUDIO) avio_wl16(pb, 2); else if (par->codec_type == AVMEDIA_TYPE_VIDEO) avio_wl16(pb, 1); else avio_wl16(pb, -1); if (par->codec_id == AV_CODEC_ID_WMAV2) desc = "Windows Media Audio V8"; else desc = codec_desc ? codec_desc->name : NULL; if (desc) { AVIOContext *dyn_buf; uint8_t *buf; int len; if (avio_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); avio_put_str16le(dyn_buf, desc); len = avio_close_dyn_buf(dyn_buf, &buf); avio_wl16(pb, len / 2); avio_write(pb, buf, len); av_freep(&buf); } else avio_wl16(pb, 0); avio_wl16(pb, 0); if (par->codec_type == AVMEDIA_TYPE_AUDIO) { avio_wl16(pb, 2); avio_wl16(pb, par->codec_tag); } else { avio_wl16(pb, 4); avio_wl32(pb, par->codec_tag); } if (!par->codec_tag) return -1; } end_header(pb, hpos); cur_pos = avio_tell(pb); header_size = cur_pos - header_offset; if (asf->is_streamed) { header_size += 8 + 30 + DATA_HEADER_SIZE; avio_seek(pb, header_offset - 10 - 30, SEEK_SET); avio_wl16(pb, header_size); avio_seek(pb, header_offset - 2 - 30, SEEK_SET); avio_wl16(pb, header_size); header_size -= 8 + 30 + DATA_HEADER_SIZE; } header_size += 24 + 6; avio_seek(pb, header_offset - 14, SEEK_SET); avio_wl64(pb, header_size); avio_seek(pb, cur_pos, SEEK_SET); asf->data_offset = cur_pos; put_guid(pb, &ff_asf_data_header); avio_wl64(pb, data_chunk_size); put_guid(pb, &ff_asf_my_guid); avio_wl64(pb, asf->nb_packets); avio_w8(pb, 1); avio_w8(pb, 1); return 0; }
{ "code": [ " int64_t duration;", " duration = asf->duration + PREROLL_TIME * 10000;", " int64_t duration;" ], "line_no": [ 25, 45, 25 ] }
static int FUNC_0(AVFormatContext *VAR_0, int64_t VAR_1, int64_t VAR_2) { ASFContext *asf = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; AVDictionaryEntry *tags[5]; int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8; int VAR_9; int VAR_10; AVCodecParameters *par; int64_t header_offset, cur_pos, hpos; int VAR_11; int64_t duration; ff_metadata_conv(&VAR_0->metadata, ff_asf_metadata_conv, NULL); tags[0] = av_dict_get(VAR_0->metadata, "title", NULL, 0); tags[1] = av_dict_get(VAR_0->metadata, "author", NULL, 0); tags[2] = av_dict_get(VAR_0->metadata, "copyright", NULL, 0); tags[3] = av_dict_get(VAR_0->metadata, "comment", NULL, 0); tags[4] = av_dict_get(VAR_0->metadata, "rating", NULL, 0); duration = asf->duration + PREROLL_TIME * 10000; VAR_9 = tags[0] || tags[1] || tags[2] || tags[3] || tags[4]; VAR_10 = av_dict_count(VAR_0->metadata); VAR_11 = 0; for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) { par = VAR_0->streams[VAR_4]->codecpar; avpriv_set_pts_info(VAR_0->streams[VAR_4], 32, 1, 1000); VAR_11 += par->VAR_11; } if (asf->is_streamed) { put_chunk(VAR_0, 0x4824, 0, 0xc00); } put_guid(pb, &ff_asf_header); avio_wl64(pb, -1); avio_wl32(pb, 3 + VAR_9 + !!VAR_10 + VAR_0->nb_streams); avio_w8(pb, 1); avio_w8(pb, 2); header_offset = avio_tell(pb); hpos = put_header(pb, &ff_asf_file_header); put_guid(pb, &ff_asf_my_guid); avio_wl64(pb, VAR_1); VAR_8 = 0; avio_wl64(pb, unix_to_file_time(VAR_8)); avio_wl64(pb, asf->nb_packets); avio_wl64(pb, duration); avio_wl64(pb, asf->duration); avio_wl64(pb, PREROLL_TIME); avio_wl32(pb, (asf->is_streamed || !pb->seekable) ? 3 : 2); avio_wl32(pb, VAR_0->packet_size); avio_wl32(pb, VAR_0->packet_size); avio_wl32(pb, VAR_11); end_header(pb, hpos); hpos = put_header(pb, &ff_asf_head1_guid); put_guid(pb, &ff_asf_head2_guid); avio_wl32(pb, 6); avio_wl16(pb, 0); end_header(pb, hpos); if (VAR_9) { int VAR_12; uint8_t *buf; AVIOContext *dyn_buf; if (avio_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); hpos = put_header(pb, &ff_asf_comment_header); for (VAR_4 = 0; VAR_4 < FF_ARRAY_ELEMS(tags); VAR_4++) { VAR_12 = tags[VAR_4] ? avio_put_str16le(dyn_buf, tags[VAR_4]->value) : 0; avio_wl16(pb, VAR_12); } VAR_12 = avio_close_dyn_buf(dyn_buf, &buf); avio_write(pb, buf, VAR_12); av_freep(&buf); end_header(pb, hpos); } if (VAR_10) { AVDictionaryEntry *tag = NULL; hpos = put_header(pb, &ff_asf_extended_content_header); avio_wl16(pb, VAR_10); while ((tag = av_dict_get(VAR_0->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { put_str16(pb, tag->key); avio_wl16(pb, 0); put_str16(pb, tag->value); } end_header(pb, hpos); } if (!asf->is_streamed && VAR_0->nb_chapters) { int VAR_13; if (VAR_13 = asf_write_markers(VAR_0)) return VAR_13; } for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) { int64_t es_pos; par = VAR_0->streams[VAR_4]->codecpar; asf->streams[VAR_4].num = VAR_4 + 1; asf->streams[VAR_4].seq = 0; switch (par->codec_type) { case AVMEDIA_TYPE_AUDIO: VAR_7 = 0; VAR_5 = 18 + VAR_7; VAR_6 = 8; break; default: case AVMEDIA_TYPE_VIDEO: VAR_7 = par->extradata_size; VAR_5 = 0x33 + VAR_7; VAR_6 = 0; break; } hpos = put_header(pb, &ff_asf_stream_header); if (par->codec_type == AVMEDIA_TYPE_AUDIO) { put_guid(pb, &ff_asf_audio_stream); put_guid(pb, &ff_asf_audio_conceal_spread); } else { put_guid(pb, &ff_asf_video_stream); put_guid(pb, &ff_asf_video_conceal_none); } avio_wl64(pb, 0); es_pos = avio_tell(pb); avio_wl32(pb, VAR_5); avio_wl32(pb, VAR_6); avio_wl16(pb, VAR_4 + 1); avio_wl32(pb, 0); if (par->codec_type == AVMEDIA_TYPE_AUDIO) { int wavsize = ff_put_wav_header(VAR_0, pb, par); if (wavsize < 0) return -1; if (wavsize != VAR_5) { cur_pos = avio_tell(pb); avio_seek(pb, es_pos, SEEK_SET); avio_wl32(pb, wavsize); avio_seek(pb, cur_pos, SEEK_SET); } avio_w8(pb, 0x01); if (par->codec_id == AV_CODEC_ID_ADPCM_G726 || !par->block_align) { avio_wl16(pb, 0x0190); avio_wl16(pb, 0x0190); } else { avio_wl16(pb, par->block_align); avio_wl16(pb, par->block_align); } avio_wl16(pb, 0x01); avio_w8(pb, 0x00); } else { avio_wl32(pb, par->width); avio_wl32(pb, par->height); avio_w8(pb, 2); avio_wl16(pb, 40 + par->extradata_size); ff_put_bmp_header(pb, par, ff_codec_bmp_tags, 1); } end_header(pb, hpos); } hpos = put_header(pb, &ff_asf_codec_comment_header); put_guid(pb, &ff_asf_codec_comment1_header); avio_wl32(pb, VAR_0->nb_streams); for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) { const AVCodecDescriptor *codec_desc; const char *desc; par = VAR_0->streams[VAR_4]->codecpar; codec_desc = avcodec_descriptor_get(par->codec_id); if (par->codec_type == AVMEDIA_TYPE_AUDIO) avio_wl16(pb, 2); else if (par->codec_type == AVMEDIA_TYPE_VIDEO) avio_wl16(pb, 1); else avio_wl16(pb, -1); if (par->codec_id == AV_CODEC_ID_WMAV2) desc = "Windows Media Audio V8"; else desc = codec_desc ? codec_desc->name : NULL; if (desc) { AVIOContext *dyn_buf; uint8_t *buf; int VAR_12; if (avio_open_dyn_buf(&dyn_buf) < 0) return AVERROR(ENOMEM); avio_put_str16le(dyn_buf, desc); VAR_12 = avio_close_dyn_buf(dyn_buf, &buf); avio_wl16(pb, VAR_12 / 2); avio_write(pb, buf, VAR_12); av_freep(&buf); } else avio_wl16(pb, 0); avio_wl16(pb, 0); if (par->codec_type == AVMEDIA_TYPE_AUDIO) { avio_wl16(pb, 2); avio_wl16(pb, par->codec_tag); } else { avio_wl16(pb, 4); avio_wl32(pb, par->codec_tag); } if (!par->codec_tag) return -1; } end_header(pb, hpos); cur_pos = avio_tell(pb); VAR_3 = cur_pos - header_offset; if (asf->is_streamed) { VAR_3 += 8 + 30 + DATA_HEADER_SIZE; avio_seek(pb, header_offset - 10 - 30, SEEK_SET); avio_wl16(pb, VAR_3); avio_seek(pb, header_offset - 2 - 30, SEEK_SET); avio_wl16(pb, VAR_3); VAR_3 -= 8 + 30 + DATA_HEADER_SIZE; } VAR_3 += 24 + 6; avio_seek(pb, header_offset - 14, SEEK_SET); avio_wl64(pb, VAR_3); avio_seek(pb, cur_pos, SEEK_SET); asf->data_offset = cur_pos; put_guid(pb, &ff_asf_data_header); avio_wl64(pb, VAR_2); put_guid(pb, &ff_asf_my_guid); avio_wl64(pb, asf->nb_packets); avio_w8(pb, 1); avio_w8(pb, 1); return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int64_t VAR_1,\nint64_t VAR_2)\n{", "ASFContext *asf = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "AVDictionaryEntry *tags[5];", "int VAR_3, VAR_4, VAR_5, VAR_6, VAR_7, VAR_8;", "int VAR_9;", "int VAR_10;", "AVCodecParameters *par;", "int64_t header_offset, cur_pos, hpos;", "int VAR_11;", "int64_t duration;", "ff_metadata_conv(&VAR_0->metadata, ff_asf_metadata_conv, NULL);", "tags[0] = av_dict_get(VAR_0->metadata, \"title\", NULL, 0);", "tags[1] = av_dict_get(VAR_0->metadata, \"author\", NULL, 0);", "tags[2] = av_dict_get(VAR_0->metadata, \"copyright\", NULL, 0);", "tags[3] = av_dict_get(VAR_0->metadata, \"comment\", NULL, 0);", "tags[4] = av_dict_get(VAR_0->metadata, \"rating\", NULL, 0);", "duration = asf->duration + PREROLL_TIME * 10000;", "VAR_9 = tags[0] || tags[1] || tags[2] || tags[3] || tags[4];", "VAR_10 = av_dict_count(VAR_0->metadata);", "VAR_11 = 0;", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) {", "par = VAR_0->streams[VAR_4]->codecpar;", "avpriv_set_pts_info(VAR_0->streams[VAR_4], 32, 1, 1000);", "VAR_11 += par->VAR_11;", "}", "if (asf->is_streamed) {", "put_chunk(VAR_0, 0x4824, 0, 0xc00);", "}", "put_guid(pb, &ff_asf_header);", "avio_wl64(pb, -1);", "avio_wl32(pb, 3 + VAR_9 + !!VAR_10 + VAR_0->nb_streams);", "avio_w8(pb, 1);", "avio_w8(pb, 2);", "header_offset = avio_tell(pb);", "hpos = put_header(pb, &ff_asf_file_header);", "put_guid(pb, &ff_asf_my_guid);", "avio_wl64(pb, VAR_1);", "VAR_8 = 0;", "avio_wl64(pb, unix_to_file_time(VAR_8));", "avio_wl64(pb, asf->nb_packets);", "avio_wl64(pb, duration);", "avio_wl64(pb, asf->duration);", "avio_wl64(pb, PREROLL_TIME);", "avio_wl32(pb, (asf->is_streamed || !pb->seekable) ? 3 : 2);", "avio_wl32(pb, VAR_0->packet_size);", "avio_wl32(pb, VAR_0->packet_size);", "avio_wl32(pb, VAR_11);", "end_header(pb, hpos);", "hpos = put_header(pb, &ff_asf_head1_guid);", "put_guid(pb, &ff_asf_head2_guid);", "avio_wl32(pb, 6);", "avio_wl16(pb, 0);", "end_header(pb, hpos);", "if (VAR_9) {", "int VAR_12;", "uint8_t *buf;", "AVIOContext *dyn_buf;", "if (avio_open_dyn_buf(&dyn_buf) < 0)\nreturn AVERROR(ENOMEM);", "hpos = put_header(pb, &ff_asf_comment_header);", "for (VAR_4 = 0; VAR_4 < FF_ARRAY_ELEMS(tags); VAR_4++) {", "VAR_12 = tags[VAR_4] ? avio_put_str16le(dyn_buf, tags[VAR_4]->value) : 0;", "avio_wl16(pb, VAR_12);", "}", "VAR_12 = avio_close_dyn_buf(dyn_buf, &buf);", "avio_write(pb, buf, VAR_12);", "av_freep(&buf);", "end_header(pb, hpos);", "}", "if (VAR_10) {", "AVDictionaryEntry *tag = NULL;", "hpos = put_header(pb, &ff_asf_extended_content_header);", "avio_wl16(pb, VAR_10);", "while ((tag = av_dict_get(VAR_0->metadata, \"\", tag, AV_DICT_IGNORE_SUFFIX))) {", "put_str16(pb, tag->key);", "avio_wl16(pb, 0);", "put_str16(pb, tag->value);", "}", "end_header(pb, hpos);", "}", "if (!asf->is_streamed && VAR_0->nb_chapters) {", "int VAR_13;", "if (VAR_13 = asf_write_markers(VAR_0))\nreturn VAR_13;", "}", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) {", "int64_t es_pos;", "par = VAR_0->streams[VAR_4]->codecpar;", "asf->streams[VAR_4].num = VAR_4 + 1;", "asf->streams[VAR_4].seq = 0;", "switch (par->codec_type) {", "case AVMEDIA_TYPE_AUDIO:\nVAR_7 = 0;", "VAR_5 = 18 + VAR_7;", "VAR_6 = 8;", "break;", "default:\ncase AVMEDIA_TYPE_VIDEO:\nVAR_7 = par->extradata_size;", "VAR_5 = 0x33 + VAR_7;", "VAR_6 = 0;", "break;", "}", "hpos = put_header(pb, &ff_asf_stream_header);", "if (par->codec_type == AVMEDIA_TYPE_AUDIO) {", "put_guid(pb, &ff_asf_audio_stream);", "put_guid(pb, &ff_asf_audio_conceal_spread);", "} else {", "put_guid(pb, &ff_asf_video_stream);", "put_guid(pb, &ff_asf_video_conceal_none);", "}", "avio_wl64(pb, 0);", "es_pos = avio_tell(pb);", "avio_wl32(pb, VAR_5);", "avio_wl32(pb, VAR_6);", "avio_wl16(pb, VAR_4 + 1);", "avio_wl32(pb, 0);", "if (par->codec_type == AVMEDIA_TYPE_AUDIO) {", "int wavsize = ff_put_wav_header(VAR_0, pb, par);", "if (wavsize < 0)\nreturn -1;", "if (wavsize != VAR_5) {", "cur_pos = avio_tell(pb);", "avio_seek(pb, es_pos, SEEK_SET);", "avio_wl32(pb, wavsize);", "avio_seek(pb, cur_pos, SEEK_SET);", "}", "avio_w8(pb, 0x01);", "if (par->codec_id == AV_CODEC_ID_ADPCM_G726 || !par->block_align) {", "avio_wl16(pb, 0x0190);", "avio_wl16(pb, 0x0190);", "} else {", "avio_wl16(pb, par->block_align);", "avio_wl16(pb, par->block_align);", "}", "avio_wl16(pb, 0x01);", "avio_w8(pb, 0x00);", "} else {", "avio_wl32(pb, par->width);", "avio_wl32(pb, par->height);", "avio_w8(pb, 2);", "avio_wl16(pb, 40 + par->extradata_size);", "ff_put_bmp_header(pb, par, ff_codec_bmp_tags, 1);", "}", "end_header(pb, hpos);", "}", "hpos = put_header(pb, &ff_asf_codec_comment_header);", "put_guid(pb, &ff_asf_codec_comment1_header);", "avio_wl32(pb, VAR_0->nb_streams);", "for (VAR_4 = 0; VAR_4 < VAR_0->nb_streams; VAR_4++) {", "const AVCodecDescriptor *codec_desc;", "const char *desc;", "par = VAR_0->streams[VAR_4]->codecpar;", "codec_desc = avcodec_descriptor_get(par->codec_id);", "if (par->codec_type == AVMEDIA_TYPE_AUDIO)\navio_wl16(pb, 2);", "else if (par->codec_type == AVMEDIA_TYPE_VIDEO)\navio_wl16(pb, 1);", "else\navio_wl16(pb, -1);", "if (par->codec_id == AV_CODEC_ID_WMAV2)\ndesc = \"Windows Media Audio V8\";", "else\ndesc = codec_desc ? codec_desc->name : NULL;", "if (desc) {", "AVIOContext *dyn_buf;", "uint8_t *buf;", "int VAR_12;", "if (avio_open_dyn_buf(&dyn_buf) < 0)\nreturn AVERROR(ENOMEM);", "avio_put_str16le(dyn_buf, desc);", "VAR_12 = avio_close_dyn_buf(dyn_buf, &buf);", "avio_wl16(pb, VAR_12 / 2);", "avio_write(pb, buf, VAR_12);", "av_freep(&buf);", "} else", "avio_wl16(pb, 0);", "avio_wl16(pb, 0);", "if (par->codec_type == AVMEDIA_TYPE_AUDIO) {", "avio_wl16(pb, 2);", "avio_wl16(pb, par->codec_tag);", "} else {", "avio_wl16(pb, 4);", "avio_wl32(pb, par->codec_tag);", "}", "if (!par->codec_tag)\nreturn -1;", "}", "end_header(pb, hpos);", "cur_pos = avio_tell(pb);", "VAR_3 = cur_pos - header_offset;", "if (asf->is_streamed) {", "VAR_3 += 8 + 30 + DATA_HEADER_SIZE;", "avio_seek(pb, header_offset - 10 - 30, SEEK_SET);", "avio_wl16(pb, VAR_3);", "avio_seek(pb, header_offset - 2 - 30, SEEK_SET);", "avio_wl16(pb, VAR_3);", "VAR_3 -= 8 + 30 + DATA_HEADER_SIZE;", "}", "VAR_3 += 24 + 6;", "avio_seek(pb, header_offset - 14, SEEK_SET);", "avio_wl64(pb, VAR_3);", "avio_seek(pb, cur_pos, SEEK_SET);", "asf->data_offset = cur_pos;", "put_guid(pb, &ff_asf_data_header);", "avio_wl64(pb, VAR_2);", "put_guid(pb, &ff_asf_my_guid);", "avio_wl64(pb, asf->nb_packets);", "avio_w8(pb, 1);", "avio_w8(pb, 1);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 151, 153 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 203 ], [ 205 ], [ 207, 209 ], [ 211 ], [ 215 ], [ 217 ], [ 223 ], [ 225 ], [ 227 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243, 245, 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 289 ], [ 293 ], [ 297, 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 377 ], [ 379 ], [ 383, 385 ], [ 387, 389 ], [ 391, 393 ], [ 397, 399 ], [ 401, 403 ], [ 407 ], [ 409 ], [ 411 ], [ 413 ], [ 417, 419 ], [ 423 ], [ 425 ], [ 427 ], [ 431 ], [ 433 ], [ 435 ], [ 437 ], [ 441 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461, 463 ], [ 465 ], [ 467 ], [ 475 ], [ 477 ], [ 479 ], [ 481 ], [ 485 ], [ 487 ], [ 489 ], [ 491 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 505 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 525 ], [ 527 ] ]
15,112
void qemu_aio_wait(void) { sigset_t set; int nb_sigs; #if !defined(QEMU_IMG) && !defined(QEMU_NBD) if (qemu_bh_poll()) return; #endif sigemptyset(&set); sigaddset(&set, aio_sig_num); sigwait(&set, &nb_sigs); qemu_aio_poll(); }
true
qemu
baf35cb90204d75404892aa4e52628ae7a00669b
void qemu_aio_wait(void) { sigset_t set; int nb_sigs; #if !defined(QEMU_IMG) && !defined(QEMU_NBD) if (qemu_bh_poll()) return; #endif sigemptyset(&set); sigaddset(&set, aio_sig_num); sigwait(&set, &nb_sigs); qemu_aio_poll(); }
{ "code": [ "#if !defined(QEMU_IMG) && !defined(QEMU_NBD)", "#endif", "#endif", "#endif", " qemu_aio_poll();", " sigset_t set;", " sigemptyset(&set);", " sigaddset(&set, aio_sig_num);", " sigset_t set;", " int nb_sigs;", " sigemptyset(&set);", " sigaddset(&set, aio_sig_num);", " sigwait(&set, &nb_sigs);", " qemu_aio_poll();", " qemu_aio_poll();" ], "line_no": [ 11, 17, 17, 17, 25, 5, 19, 21, 5, 7, 19, 21, 23, 25, 25 ] }
void FUNC_0(void) { sigset_t set; int VAR_0; #if !defined(QEMU_IMG) && !defined(QEMU_NBD) if (qemu_bh_poll()) return; #endif sigemptyset(&set); sigaddset(&set, aio_sig_num); sigwait(&set, &VAR_0); qemu_aio_poll(); }
[ "void FUNC_0(void)\n{", "sigset_t set;", "int VAR_0;", "#if !defined(QEMU_IMG) && !defined(QEMU_NBD)\nif (qemu_bh_poll())\nreturn;", "#endif\nsigemptyset(&set);", "sigaddset(&set, aio_sig_num);", "sigwait(&set, &VAR_0);", "qemu_aio_poll();", "}" ]
[ 0, 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11, 13, 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
15,113
static void config_error(Monitor *mon, const char *fmt, ...) { va_list ap; va_start(ap, fmt); if (mon) { monitor_vprintf(mon, fmt, ap); } else { fprintf(stderr, "qemu: "); vfprintf(stderr, fmt, ap); exit(1); } va_end(ap); }
true
qemu
0752706de257b38763006ff5bb6b39a97e669ba2
static void config_error(Monitor *mon, const char *fmt, ...) { va_list ap; va_start(ap, fmt); if (mon) { monitor_vprintf(mon, fmt, ap); } else { fprintf(stderr, "qemu: "); vfprintf(stderr, fmt, ap); exit(1); } va_end(ap); }
{ "code": [ " exit(1);", " exit(1);" ], "line_no": [ 21, 21 ] }
static void FUNC_0(Monitor *VAR_0, const char *VAR_1, ...) { va_list ap; va_start(ap, VAR_1); if (VAR_0) { monitor_vprintf(VAR_0, VAR_1, ap); } else { fprintf(stderr, "qemu: "); vfprintf(stderr, VAR_1, ap); exit(1); } va_end(ap); }
[ "static void FUNC_0(Monitor *VAR_0, const char *VAR_1, ...)\n{", "va_list ap;", "va_start(ap, VAR_1);", "if (VAR_0) {", "monitor_vprintf(VAR_0, VAR_1, ap);", "} else {", "fprintf(stderr, \"qemu: \");", "vfprintf(stderr, VAR_1, ap);", "exit(1);", "}", "va_end(ap);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
15,114
static int coroutine_fn raw_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO); return bdrv_co_writev(bs->file, sector_num, nb_sectors, qiov); }
true
qemu
38f3ef574b48afc507c6f636ae4393fd36bda072
static int coroutine_fn raw_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO); return bdrv_co_writev(bs->file, sector_num, nb_sectors, qiov); }
{ "code": [ " return bdrv_co_writev(bs->file, sector_num, nb_sectors, qiov);" ], "line_no": [ 9 ] }
static int VAR_0 raw_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov) { BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO); return bdrv_co_writev(bs->file, sector_num, nb_sectors, qiov); }
[ "static int VAR_0 raw_co_writev(BlockDriverState *bs, int64_t sector_num,\nint nb_sectors, QEMUIOVector *qiov)\n{", "BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO);", "return bdrv_co_writev(bs->file, sector_num, nb_sectors, qiov);", "}" ]
[ 0, 0, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ] ]
15,117
void g_free(void *ptr) { /* FIXME: We should unmark the reserved pages here. However this gets complicated when one target page spans multiple host pages, so we don't bother. */ size_t *p; p = (size_t *)((char *)ptr - 16); munmap(p, *p); }
true
qemu
b7b5233ad7fdd9985bb6d05b7919f3a20723ff2c
void g_free(void *ptr) { size_t *p; p = (size_t *)((char *)ptr - 16); munmap(p, *p); }
{ "code": [ "void g_free(void *ptr)", " size_t *p;", " p = (size_t *)((char *)ptr - 16);", " munmap(p, *p);" ], "line_no": [ 1, 11, 13, 15 ] }
void FUNC_0(void *VAR_0) { size_t *p; p = (size_t *)((char *)VAR_0 - 16); munmap(p, *p); }
[ "void FUNC_0(void *VAR_0)\n{", "size_t *p;", "p = (size_t *)((char *)VAR_0 - 16);", "munmap(p, *p);", "}" ]
[ 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
15,118
static SCSIGenericReq *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun) { SCSIRequest *req; req = scsi_req_alloc(sizeof(SCSIGenericReq), d, tag, lun); return DO_UPCAST(SCSIGenericReq, req, req); }
true
qemu
5c6c0e513600ba57c3e73b7151d3c0664438f7b5
static SCSIGenericReq *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun) { SCSIRequest *req; req = scsi_req_alloc(sizeof(SCSIGenericReq), d, tag, lun); return DO_UPCAST(SCSIGenericReq, req, req); }
{ "code": [ " SCSIRequest *req;", "static SCSIGenericReq *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun)", " return DO_UPCAST(SCSIGenericReq, req, req);" ], "line_no": [ 5, 1, 11 ] }
static SCSIGenericReq *FUNC_0(SCSIDevice *d, uint32_t tag, uint32_t lun) { SCSIRequest *req; req = scsi_req_alloc(sizeof(SCSIGenericReq), d, tag, lun); return DO_UPCAST(SCSIGenericReq, req, req); }
[ "static SCSIGenericReq *FUNC_0(SCSIDevice *d, uint32_t tag, uint32_t lun)\n{", "SCSIRequest *req;", "req = scsi_req_alloc(sizeof(SCSIGenericReq), d, tag, lun);", "return DO_UPCAST(SCSIGenericReq, req, req);", "}" ]
[ 1, 1, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
15,119
static void test_reconnect(void) { gchar *path = g_strdup_printf("/%s/vhost-user/reconnect/subprocess", qtest_get_arch()); g_test_trap_subprocess(path, 0, 0); g_test_trap_assert_passed(); }
true
qemu
69179fe2fc0b91f68699012ba72d329e74ff629e
static void test_reconnect(void) { gchar *path = g_strdup_printf("/%s/vhost-user/reconnect/subprocess", qtest_get_arch()); g_test_trap_subprocess(path, 0, 0); g_test_trap_assert_passed(); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { gchar *path = g_strdup_printf("/%s/vhost-user/reconnect/subprocess", qtest_get_arch()); g_test_trap_subprocess(path, 0, 0); g_test_trap_assert_passed(); }
[ "static void FUNC_0(void)\n{", "gchar *path = g_strdup_printf(\"/%s/vhost-user/reconnect/subprocess\",\nqtest_get_arch());", "g_test_trap_subprocess(path, 0, 0);", "g_test_trap_assert_passed();", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9 ], [ 11 ], [ 14 ] ]
15,120
int64_t qdict_get_try_int(const QDict *qdict, const char *key, int64_t def_value) { QObject *obj; obj = qdict_get(qdict, key); if (!obj || qobject_type(obj) != QTYPE_QINT) return def_value; return qint_get_int(qobject_to_qint(obj)); }
true
qemu
fcf73f66a67f5e58c18216f8c8651e38cf4d90af
int64_t qdict_get_try_int(const QDict *qdict, const char *key, int64_t def_value) { QObject *obj; obj = qdict_get(qdict, key); if (!obj || qobject_type(obj) != QTYPE_QINT) return def_value; return qint_get_int(qobject_to_qint(obj)); }
{ "code": [ " return qint_get_int(qobject_to_qint(obj));", " QObject *obj;", " obj = qdict_get(qdict, key);", " if (!obj || qobject_type(obj) != QTYPE_QINT)", " return def_value;", " return qint_get_int(qobject_to_qint(obj));" ], "line_no": [ 19, 7, 11, 13, 15, 19 ] }
int64_t FUNC_0(const QDict *qdict, const char *key, int64_t def_value) { QObject *obj; obj = qdict_get(qdict, key); if (!obj || qobject_type(obj) != QTYPE_QINT) return def_value; return qint_get_int(qobject_to_qint(obj)); }
[ "int64_t FUNC_0(const QDict *qdict, const char *key,\nint64_t def_value)\n{", "QObject *obj;", "obj = qdict_get(qdict, key);", "if (!obj || qobject_type(obj) != QTYPE_QINT)\nreturn def_value;", "return qint_get_int(qobject_to_qint(obj));", "}" ]
[ 0, 1, 1, 1, 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 19 ], [ 21 ] ]
15,121
static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, int width) { #ifdef HAVE_MMX asm volatile( "mov %2, %%"REG_a" \n\t" "movq "MANGLE(bgr2YCoeff)", %%mm6 \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t" ".balign 16 \n\t" "1: \n\t" PREFETCH" 64(%0, %%"REG_b") \n\t" "movd (%0, %%"REG_b"), %%mm0 \n\t" "movd 3(%0, %%"REG_b"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 6(%0, %%"REG_b"), %%mm2 \n\t" "movd 9(%0, %%"REG_b"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm0 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm0 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm0 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm0 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "packssdw %%mm2, %%mm0 \n\t" "psraw $7, %%mm0 \n\t" "movd 12(%0, %%"REG_b"), %%mm4 \n\t" "movd 15(%0, %%"REG_b"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 18(%0, %%"REG_b"), %%mm2 \n\t" "movd 21(%0, %%"REG_b"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm4 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm4 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm4 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm4 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "add $24, %%"REG_b" \n\t" "packssdw %%mm2, %%mm4 \n\t" "psraw $7, %%mm4 \n\t" "packuswb %%mm4, %%mm0 \n\t" "paddusb "MANGLE(bgr2YOffset)", %%mm0 \n\t" "movq %%mm0, (%1, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "r" (src+width*3), "r" (dst+width), "g" ((long)-width) : "%"REG_a, "%"REG_b ); #else int i; for(i=0; i<width; i++) { int b= src[i*3+0]; int g= src[i*3+1]; int r= src[i*3+2]; dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); } #endif }
true
FFmpeg
7f526efd17973ec6d2204f7a47b6923e2be31363
static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, int width) { #ifdef HAVE_MMX asm volatile( "mov %2, %%"REG_a" \n\t" "movq "MANGLE(bgr2YCoeff)", %%mm6 \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t" ".balign 16 \n\t" "1: \n\t" PREFETCH" 64(%0, %%"REG_b") \n\t" "movd (%0, %%"REG_b"), %%mm0 \n\t" "movd 3(%0, %%"REG_b"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 6(%0, %%"REG_b"), %%mm2 \n\t" "movd 9(%0, %%"REG_b"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm0 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm0 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm0 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm0 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "packssdw %%mm2, %%mm0 \n\t" "psraw $7, %%mm0 \n\t" "movd 12(%0, %%"REG_b"), %%mm4 \n\t" "movd 15(%0, %%"REG_b"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 18(%0, %%"REG_b"), %%mm2 \n\t" "movd 21(%0, %%"REG_b"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm4 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm4 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm4 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm4 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "add $24, %%"REG_b" \n\t" "packssdw %%mm2, %%mm4 \n\t" "psraw $7, %%mm4 \n\t" "packuswb %%mm4, %%mm0 \n\t" "paddusb "MANGLE(bgr2YOffset)", %%mm0 \n\t" "movq %%mm0, (%1, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "r" (src+width*3), "r" (dst+width), "g" ((long)-width) : "%"REG_a, "%"REG_b ); #else int i; for(i=0; i<width; i++) { int b= src[i*3+0]; int g= src[i*3+1]; int r= src[i*3+2]; dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); } #endif }
{ "code": [ "static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, int width)", "\t\t: : \"r\" (src+width*3), \"r\" (dst+width), \"g\" ((long)-width)" ], "line_no": [ 1, 139 ] }
static inline void FUNC_0(bgr24ToY)(uint8_t *dst, uint8_t *src, int width) { #ifdef HAVE_MMX asm volatile( "mov %2, %%"REG_a" \n\t" "movq "MANGLE(bgr2YCoeff)", %%mm6 \n\t" "movq "MANGLE(w1111)", %%mm5 \n\t" "pxor %%mm7, %%mm7 \n\t" "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t" ".balign 16 \n\t" "1: \n\t" PREFETCH" 64(%0, %%"REG_b") \n\t" "movd (%0, %%"REG_b"), %%mm0 \n\t" "movd 3(%0, %%"REG_b"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 6(%0, %%"REG_b"), %%mm2 \n\t" "movd 9(%0, %%"REG_b"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm0 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm0 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm0 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm0 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "packssdw %%mm2, %%mm0 \n\t" "psraw $7, %%mm0 \n\t" "movd 12(%0, %%"REG_b"), %%mm4 \n\t" "movd 15(%0, %%"REG_b"), %%mm1 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "punpcklbw %%mm7, %%mm1 \n\t" "movd 18(%0, %%"REG_b"), %%mm2 \n\t" "movd 21(%0, %%"REG_b"), %%mm3 \n\t" "punpcklbw %%mm7, %%mm2 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "pmaddwd %%mm6, %%mm4 \n\t" "pmaddwd %%mm6, %%mm1 \n\t" "pmaddwd %%mm6, %%mm2 \n\t" "pmaddwd %%mm6, %%mm3 \n\t" #ifndef FAST_BGR2YV12 "psrad $8, %%mm4 \n\t" "psrad $8, %%mm1 \n\t" "psrad $8, %%mm2 \n\t" "psrad $8, %%mm3 \n\t" #endif "packssdw %%mm1, %%mm4 \n\t" "packssdw %%mm3, %%mm2 \n\t" "pmaddwd %%mm5, %%mm4 \n\t" "pmaddwd %%mm5, %%mm2 \n\t" "add $24, %%"REG_b" \n\t" "packssdw %%mm2, %%mm4 \n\t" "psraw $7, %%mm4 \n\t" "packuswb %%mm4, %%mm0 \n\t" "paddusb "MANGLE(bgr2YOffset)", %%mm0 \n\t" "movq %%mm0, (%1, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "r" (src+width*3), "r" (dst+width), "g" ((long)-width) : "%"REG_a, "%"REG_b ); #else int VAR_0; for(VAR_0=0; VAR_0<width; VAR_0++) { int b= src[VAR_0*3+0]; int g= src[VAR_0*3+1]; int r= src[VAR_0*3+2]; dst[VAR_0]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); } #endif }
[ "static inline void FUNC_0(bgr24ToY)(uint8_t *dst, uint8_t *src, int width)\n{", "#ifdef HAVE_MMX\nasm volatile(\n\"mov %2, %%\"REG_a\"\t\t\\n\\t\"\n\"movq \"MANGLE(bgr2YCoeff)\", %%mm6\t\t\\n\\t\"\n\"movq \"MANGLE(w1111)\", %%mm5\t\t\\n\\t\"\n\"pxor %%mm7, %%mm7\t\t\\n\\t\"\n\"lea (%%\"REG_a\", %%\"REG_a\", 2), %%\"REG_b\"\\n\\t\"\n\".balign 16\t\t\t\\n\\t\"\n\"1:\t\t\t\t\\n\\t\"\nPREFETCH\" 64(%0, %%\"REG_b\")\t\\n\\t\"\n\"movd (%0, %%\"REG_b\"), %%mm0\t\\n\\t\"\n\"movd 3(%0, %%\"REG_b\"), %%mm1\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm0\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"\n\"movd 6(%0, %%\"REG_b\"), %%mm2\t\\n\\t\"\n\"movd 9(%0, %%\"REG_b\"), %%mm3\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm0\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm1\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm2\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm3\t\t\\n\\t\"\n#ifndef FAST_BGR2YV12\n\"psrad $8, %%mm0\t\t\\n\\t\"\n\"psrad $8, %%mm1\t\t\\n\\t\"\n\"psrad $8, %%mm2\t\t\\n\\t\"\n\"psrad $8, %%mm3\t\t\\n\\t\"\n#endif\n\"packssdw %%mm1, %%mm0\t\t\\n\\t\"\n\"packssdw %%mm3, %%mm2\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm0\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm2\t\t\\n\\t\"\n\"packssdw %%mm2, %%mm0\t\t\\n\\t\"\n\"psraw $7, %%mm0\t\t\\n\\t\"\n\"movd 12(%0, %%\"REG_b\"), %%mm4\t\\n\\t\"\n\"movd 15(%0, %%\"REG_b\"), %%mm1\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm4\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm1\t\t\\n\\t\"\n\"movd 18(%0, %%\"REG_b\"), %%mm2\t\\n\\t\"\n\"movd 21(%0, %%\"REG_b\"), %%mm3\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm2\t\t\\n\\t\"\n\"punpcklbw %%mm7, %%mm3\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm4\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm1\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm2\t\t\\n\\t\"\n\"pmaddwd %%mm6, %%mm3\t\t\\n\\t\"\n#ifndef FAST_BGR2YV12\n\"psrad $8, %%mm4\t\t\\n\\t\"\n\"psrad $8, %%mm1\t\t\\n\\t\"\n\"psrad $8, %%mm2\t\t\\n\\t\"\n\"psrad $8, %%mm3\t\t\\n\\t\"\n#endif\n\"packssdw %%mm1, %%mm4\t\t\\n\\t\"\n\"packssdw %%mm3, %%mm2\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm4\t\t\\n\\t\"\n\"pmaddwd %%mm5, %%mm2\t\t\\n\\t\"\n\"add $24, %%\"REG_b\"\t\t\\n\\t\"\n\"packssdw %%mm2, %%mm4\t\t\\n\\t\"\n\"psraw $7, %%mm4\t\t\\n\\t\"\n\"packuswb %%mm4, %%mm0\t\t\\n\\t\"\n\"paddusb \"MANGLE(bgr2YOffset)\", %%mm0\t\\n\\t\"\n\"movq %%mm0, (%1, %%\"REG_a\")\t\\n\\t\"\n\"add $8, %%\"REG_a\"\t\t\\n\\t\"\n\" js 1b\t\t\t\t\\n\\t\"\n: : \"r\" (src+width*3), \"r\" (dst+width), \"g\" ((long)-width)\n: \"%\"REG_a, \"%\"REG_b\n);", "#else\nint VAR_0;", "for(VAR_0=0; VAR_0<width; VAR_0++)", "{", "int b= src[VAR_0*3+0];", "int g= src[VAR_0*3+1];", "int r= src[VAR_0*3+2];", "dst[VAR_0]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);", "}", "#endif\n}" ]
[ 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 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, 127, 129, 133, 135, 137, 139, 141, 143 ], [ 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 165, 167 ] ]
15,122
void dsputil_init_armv4l(void) { // ff_idct = j_rev_dct_ARM; }
false
FFmpeg
83f238cbf0c038245d2b2dffa5beb0916e7c36d2
void dsputil_init_armv4l(void) { }
{ "code": [], "line_no": [] }
void FUNC_0(void) { }
[ "void FUNC_0(void)\n{", "}" ]
[ 0, 0 ]
[ [ 1, 3 ], [ 7 ] ]
15,123
static void RENAME(resample_one)(DELEM *dst, const DELEM *src, int dst_size, int64_t index2, int64_t incr) { int dst_index; for (dst_index = 0; dst_index < dst_size; dst_index++) { dst[dst_index] = src[index2 >> 32]; index2 += incr; } }
false
FFmpeg
857cd1f33bcf86005529af2a77f861f884327be5
static void RENAME(resample_one)(DELEM *dst, const DELEM *src, int dst_size, int64_t index2, int64_t incr) { int dst_index; for (dst_index = 0; dst_index < dst_size; dst_index++) { dst[dst_index] = src[index2 >> 32]; index2 += incr; } }
{ "code": [], "line_no": [] }
static void FUNC_0(resample_one)(DELEM *dst, const DELEM *src, int dst_size, int64_t index2, int64_t incr) { int VAR_0; for (VAR_0 = 0; VAR_0 < dst_size; VAR_0++) { dst[VAR_0] = src[index2 >> 32]; index2 += incr; } }
[ "static void FUNC_0(resample_one)(DELEM *dst, const DELEM *src,\nint dst_size, int64_t index2, int64_t incr)\n{", "int VAR_0;", "for (VAR_0 = 0; VAR_0 < dst_size; VAR_0++) {", "dst[VAR_0] = src[index2 >> 32];", "index2 += incr;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
15,126
static int qemu_gluster_create(const char *filename, QEMUOptionParameter *options, Error **errp) { struct glfs *glfs; struct glfs_fd *fd; int ret = 0; int prealloc = 0; int64_t total_size = 0; GlusterConf *gconf = g_malloc0(sizeof(GlusterConf)); glfs = qemu_gluster_init(gconf, filename, errp); if (!glfs) { ret = -EINVAL; goto out; } while (options && options->name) { if (!strcmp(options->name, BLOCK_OPT_SIZE)) { total_size = options->value.n / BDRV_SECTOR_SIZE; } else if (!strcmp(options->name, BLOCK_OPT_PREALLOC)) { if (!options->value.s || !strcmp(options->value.s, "off")) { prealloc = 0; } else if (!strcmp(options->value.s, "full") && gluster_supports_zerofill()) { prealloc = 1; } else { error_setg(errp, "Invalid preallocation mode: '%s'" " or GlusterFS doesn't support zerofill API", options->value.s); ret = -EINVAL; goto out; } } options++; } fd = glfs_creat(glfs, gconf->image, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR); if (!fd) { ret = -errno; } else { if (!glfs_ftruncate(fd, total_size * BDRV_SECTOR_SIZE)) { if (prealloc && qemu_gluster_zerofill(fd, 0, total_size * BDRV_SECTOR_SIZE)) { ret = -errno; } } else { ret = -errno; } if (glfs_close(fd) != 0) { ret = -errno; } } out: qemu_gluster_gconf_free(gconf); if (glfs) { glfs_fini(glfs); } return ret; }
true
qemu
4557117d9eed8cadc360aec23b42fc39a7011864
static int qemu_gluster_create(const char *filename, QEMUOptionParameter *options, Error **errp) { struct glfs *glfs; struct glfs_fd *fd; int ret = 0; int prealloc = 0; int64_t total_size = 0; GlusterConf *gconf = g_malloc0(sizeof(GlusterConf)); glfs = qemu_gluster_init(gconf, filename, errp); if (!glfs) { ret = -EINVAL; goto out; } while (options && options->name) { if (!strcmp(options->name, BLOCK_OPT_SIZE)) { total_size = options->value.n / BDRV_SECTOR_SIZE; } else if (!strcmp(options->name, BLOCK_OPT_PREALLOC)) { if (!options->value.s || !strcmp(options->value.s, "off")) { prealloc = 0; } else if (!strcmp(options->value.s, "full") && gluster_supports_zerofill()) { prealloc = 1; } else { error_setg(errp, "Invalid preallocation mode: '%s'" " or GlusterFS doesn't support zerofill API", options->value.s); ret = -EINVAL; goto out; } } options++; } fd = glfs_creat(glfs, gconf->image, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR); if (!fd) { ret = -errno; } else { if (!glfs_ftruncate(fd, total_size * BDRV_SECTOR_SIZE)) { if (prealloc && qemu_gluster_zerofill(fd, 0, total_size * BDRV_SECTOR_SIZE)) { ret = -errno; } } else { ret = -errno; } if (glfs_close(fd) != 0) { ret = -errno; } } out: qemu_gluster_gconf_free(gconf); if (glfs) { glfs_fini(glfs); } return ret; }
{ "code": [ " ret = -EINVAL;" ], "line_no": [ 25 ] }
static int FUNC_0(const char *VAR_0, QEMUOptionParameter *VAR_1, Error **VAR_2) { struct VAR_3 *VAR_3; struct glfs_fd *VAR_4; int VAR_5 = 0; int VAR_6 = 0; int64_t total_size = 0; GlusterConf *gconf = g_malloc0(sizeof(GlusterConf)); VAR_3 = qemu_gluster_init(gconf, VAR_0, VAR_2); if (!VAR_3) { VAR_5 = -EINVAL; goto out; } while (VAR_1 && VAR_1->name) { if (!strcmp(VAR_1->name, BLOCK_OPT_SIZE)) { total_size = VAR_1->value.n / BDRV_SECTOR_SIZE; } else if (!strcmp(VAR_1->name, BLOCK_OPT_PREALLOC)) { if (!VAR_1->value.s || !strcmp(VAR_1->value.s, "off")) { VAR_6 = 0; } else if (!strcmp(VAR_1->value.s, "full") && gluster_supports_zerofill()) { VAR_6 = 1; } else { error_setg(VAR_2, "Invalid preallocation mode: '%s'" " or GlusterFS doesn't support zerofill API", VAR_1->value.s); VAR_5 = -EINVAL; goto out; } } VAR_1++; } VAR_4 = glfs_creat(VAR_3, gconf->image, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR); if (!VAR_4) { VAR_5 = -errno; } else { if (!glfs_ftruncate(VAR_4, total_size * BDRV_SECTOR_SIZE)) { if (VAR_6 && qemu_gluster_zerofill(VAR_4, 0, total_size * BDRV_SECTOR_SIZE)) { VAR_5 = -errno; } } else { VAR_5 = -errno; } if (glfs_close(VAR_4) != 0) { VAR_5 = -errno; } } out: qemu_gluster_gconf_free(gconf); if (VAR_3) { glfs_fini(VAR_3); } return VAR_5; }
[ "static int FUNC_0(const char *VAR_0,\nQEMUOptionParameter *VAR_1, Error **VAR_2)\n{", "struct VAR_3 *VAR_3;", "struct glfs_fd *VAR_4;", "int VAR_5 = 0;", "int VAR_6 = 0;", "int64_t total_size = 0;", "GlusterConf *gconf = g_malloc0(sizeof(GlusterConf));", "VAR_3 = qemu_gluster_init(gconf, VAR_0, VAR_2);", "if (!VAR_3) {", "VAR_5 = -EINVAL;", "goto out;", "}", "while (VAR_1 && VAR_1->name) {", "if (!strcmp(VAR_1->name, BLOCK_OPT_SIZE)) {", "total_size = VAR_1->value.n / BDRV_SECTOR_SIZE;", "} else if (!strcmp(VAR_1->name, BLOCK_OPT_PREALLOC)) {", "if (!VAR_1->value.s || !strcmp(VAR_1->value.s, \"off\")) {", "VAR_6 = 0;", "} else if (!strcmp(VAR_1->value.s, \"full\") &&", "gluster_supports_zerofill()) {", "VAR_6 = 1;", "} else {", "error_setg(VAR_2, \"Invalid preallocation mode: '%s'\"\n\" or GlusterFS doesn't support zerofill API\",\nVAR_1->value.s);", "VAR_5 = -EINVAL;", "goto out;", "}", "}", "VAR_1++;", "}", "VAR_4 = glfs_creat(VAR_3, gconf->image,\nO_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR);", "if (!VAR_4) {", "VAR_5 = -errno;", "} else {", "if (!glfs_ftruncate(VAR_4, total_size * BDRV_SECTOR_SIZE)) {", "if (VAR_6 && qemu_gluster_zerofill(VAR_4, 0,\ntotal_size * BDRV_SECTOR_SIZE)) {", "VAR_5 = -errno;", "}", "} else {", "VAR_5 = -errno;", "}", "if (glfs_close(VAR_4) != 0) {", "VAR_5 = -errno;", "}", "}", "out:\nqemu_gluster_gconf_free(gconf);", "if (VAR_3) {", "glfs_fini(VAR_3);", "}", "return VAR_5;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ] ]
15,127
void OPPROTO op_subfme (void) { T0 = ~T0 + xer_ca - 1; if (likely((uint32_t)T0 != (uint32_t)-1)) xer_ca = 1; RETURN(); }
true
qemu
c3e10c7b4377c1cbc0a4fbc12312c2cf41c0cda7
void OPPROTO op_subfme (void) { T0 = ~T0 + xer_ca - 1; if (likely((uint32_t)T0 != (uint32_t)-1)) xer_ca = 1; RETURN(); }
{ "code": [ " RETURN();", " RETURN();", " if (likely((uint32_t)T0 != (uint32_t)-1))", " RETURN();" ], "line_no": [ 11, 11, 7, 11 ] }
void VAR_0 op_subfme (void) { T0 = ~T0 + xer_ca - 1; if (likely((uint32_t)T0 != (uint32_t)-1)) xer_ca = 1; RETURN(); }
[ "void VAR_0 op_subfme (void)\n{", "T0 = ~T0 + xer_ca - 1;", "if (likely((uint32_t)T0 != (uint32_t)-1))\nxer_ca = 1;", "RETURN();", "}" ]
[ 0, 0, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ] ]
15,128
int nbd_client_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int count, BdrvRequestFlags flags) { ssize_t ret; NBDClientSession *client = nbd_get_client_session(bs); NBDRequest request = { .type = NBD_CMD_WRITE_ZEROES, .from = offset, .len = count, }; NBDReply reply; if (!(client->nbdflags & NBD_FLAG_SEND_WRITE_ZEROES)) { return -ENOTSUP; } if (flags & BDRV_REQ_FUA) { assert(client->nbdflags & NBD_FLAG_SEND_FUA); request.flags |= NBD_CMD_FLAG_FUA; } if (!(flags & BDRV_REQ_MAY_UNMAP)) { request.flags |= NBD_CMD_FLAG_NO_HOLE; } nbd_coroutine_start(client, &request); ret = nbd_co_send_request(bs, &request, NULL); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL); } nbd_coroutine_end(bs, &request); return -reply.error; }
true
qemu
6bdcc018a6ed760b9dfe43539124e420aed83092
int nbd_client_co_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int count, BdrvRequestFlags flags) { ssize_t ret; NBDClientSession *client = nbd_get_client_session(bs); NBDRequest request = { .type = NBD_CMD_WRITE_ZEROES, .from = offset, .len = count, }; NBDReply reply; if (!(client->nbdflags & NBD_FLAG_SEND_WRITE_ZEROES)) { return -ENOTSUP; } if (flags & BDRV_REQ_FUA) { assert(client->nbdflags & NBD_FLAG_SEND_FUA); request.flags |= NBD_CMD_FLAG_FUA; } if (!(flags & BDRV_REQ_MAY_UNMAP)) { request.flags |= NBD_CMD_FLAG_NO_HOLE; } nbd_coroutine_start(client, &request); ret = nbd_co_send_request(bs, &request, NULL); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL); } nbd_coroutine_end(bs, &request); return -reply.error; }
{ "code": [ " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);", " nbd_coroutine_start(client, &request);" ], "line_no": [ 49, 49, 49, 49, 49 ] }
int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, int VAR_2, BdrvRequestFlags VAR_3) { ssize_t ret; NBDClientSession *client = nbd_get_client_session(VAR_0); NBDRequest request = { .type = NBD_CMD_WRITE_ZEROES, .from = VAR_1, .len = VAR_2, }; NBDReply reply; if (!(client->nbdflags & NBD_FLAG_SEND_WRITE_ZEROES)) { return -ENOTSUP; } if (VAR_3 & BDRV_REQ_FUA) { assert(client->nbdflags & NBD_FLAG_SEND_FUA); request.VAR_3 |= NBD_CMD_FLAG_FUA; } if (!(VAR_3 & BDRV_REQ_MAY_UNMAP)) { request.VAR_3 |= NBD_CMD_FLAG_NO_HOLE; } nbd_coroutine_start(client, &request); ret = nbd_co_send_request(VAR_0, &request, NULL); if (ret < 0) { reply.error = -ret; } else { nbd_co_receive_reply(client, &request, &reply, NULL); } nbd_coroutine_end(VAR_0, &request); return -reply.error; }
[ "int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,\nint VAR_2, BdrvRequestFlags VAR_3)\n{", "ssize_t ret;", "NBDClientSession *client = nbd_get_client_session(VAR_0);", "NBDRequest request = {", ".type = NBD_CMD_WRITE_ZEROES,\n.from = VAR_1,\n.len = VAR_2,\n};", "NBDReply reply;", "if (!(client->nbdflags & NBD_FLAG_SEND_WRITE_ZEROES)) {", "return -ENOTSUP;", "}", "if (VAR_3 & BDRV_REQ_FUA) {", "assert(client->nbdflags & NBD_FLAG_SEND_FUA);", "request.VAR_3 |= NBD_CMD_FLAG_FUA;", "}", "if (!(VAR_3 & BDRV_REQ_MAY_UNMAP)) {", "request.VAR_3 |= NBD_CMD_FLAG_NO_HOLE;", "}", "nbd_coroutine_start(client, &request);", "ret = nbd_co_send_request(VAR_0, &request, NULL);", "if (ret < 0) {", "reply.error = -ret;", "} else {", "nbd_co_receive_reply(client, &request, &reply, NULL);", "}", "nbd_coroutine_end(VAR_0, &request);", "return -reply.error;", "}" ]
[ 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 ], [ 11 ], [ 13, 15, 17, 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ] ]
15,129
static void usbredir_control_packet(void *priv, uint32_t id, struct usb_redir_control_packet_header *control_packet, uint8_t *data, int data_len) { USBRedirDevice *dev = priv; int len = control_packet->length; AsyncURB *aurb; DPRINTF("ctrl-in status %d len %d id %u\n", control_packet->status, len, id); aurb = async_find(dev, id); if (!aurb) { free(data); return; } aurb->control_packet.status = control_packet->status; aurb->control_packet.length = control_packet->length; if (memcmp(&aurb->control_packet, control_packet, sizeof(*control_packet))) { ERROR("return control packet mismatch, please report this!\n"); len = USB_RET_NAK; } if (aurb->packet) { len = usbredir_handle_status(dev, control_packet->status, len); if (len > 0) { usbredir_log_data(dev, "ctrl data in:", data, data_len); if (data_len <= sizeof(dev->dev.data_buf)) { memcpy(dev->dev.data_buf, data, data_len); } else { ERROR("ctrl buffer too small (%d > %zu)\n", data_len, sizeof(dev->dev.data_buf)); len = USB_RET_STALL; } } aurb->packet->len = len; usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); free(data); }
true
qemu
4f4321c11ff6e98583846bfd6f0e81954924b003
static void usbredir_control_packet(void *priv, uint32_t id, struct usb_redir_control_packet_header *control_packet, uint8_t *data, int data_len) { USBRedirDevice *dev = priv; int len = control_packet->length; AsyncURB *aurb; DPRINTF("ctrl-in status %d len %d id %u\n", control_packet->status, len, id); aurb = async_find(dev, id); if (!aurb) { free(data); return; } aurb->control_packet.status = control_packet->status; aurb->control_packet.length = control_packet->length; if (memcmp(&aurb->control_packet, control_packet, sizeof(*control_packet))) { ERROR("return control packet mismatch, please report this!\n"); len = USB_RET_NAK; } if (aurb->packet) { len = usbredir_handle_status(dev, control_packet->status, len); if (len > 0) { usbredir_log_data(dev, "ctrl data in:", data, data_len); if (data_len <= sizeof(dev->dev.data_buf)) { memcpy(dev->dev.data_buf, data, data_len); } else { ERROR("ctrl buffer too small (%d > %zu)\n", data_len, sizeof(dev->dev.data_buf)); len = USB_RET_STALL; } } aurb->packet->len = len; usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); free(data); }
{ "code": [ " aurb->packet->len = len;", " aurb->packet->len = len;" ], "line_no": [ 75, 75 ] }
static void FUNC_0(void *VAR_0, uint32_t VAR_1, struct usb_redir_control_packet_header *VAR_2, uint8_t *VAR_3, int VAR_4) { USBRedirDevice *dev = VAR_0; int VAR_5 = VAR_2->length; AsyncURB *aurb; DPRINTF("ctrl-in status %d VAR_5 %d VAR_1 %u\n", VAR_2->status, VAR_5, VAR_1); aurb = async_find(dev, VAR_1); if (!aurb) { free(VAR_3); return; } aurb->VAR_2.status = VAR_2->status; aurb->VAR_2.length = VAR_2->length; if (memcmp(&aurb->VAR_2, VAR_2, sizeof(*VAR_2))) { ERROR("return control packet mismatch, please report this!\n"); VAR_5 = USB_RET_NAK; } if (aurb->packet) { VAR_5 = usbredir_handle_status(dev, VAR_2->status, VAR_5); if (VAR_5 > 0) { usbredir_log_data(dev, "ctrl VAR_3 in:", VAR_3, VAR_4); if (VAR_4 <= sizeof(dev->dev.data_buf)) { memcpy(dev->dev.data_buf, VAR_3, VAR_4); } else { ERROR("ctrl buffer too small (%d > %zu)\n", VAR_4, sizeof(dev->dev.data_buf)); VAR_5 = USB_RET_STALL; } } aurb->packet->VAR_5 = VAR_5; usb_generic_async_ctrl_complete(&dev->dev, aurb->packet); } async_free(dev, aurb); free(VAR_3); }
[ "static void FUNC_0(void *VAR_0, uint32_t VAR_1,\nstruct usb_redir_control_packet_header *VAR_2,\nuint8_t *VAR_3, int VAR_4)\n{", "USBRedirDevice *dev = VAR_0;", "int VAR_5 = VAR_2->length;", "AsyncURB *aurb;", "DPRINTF(\"ctrl-in status %d VAR_5 %d VAR_1 %u\\n\", VAR_2->status,\nVAR_5, VAR_1);", "aurb = async_find(dev, VAR_1);", "if (!aurb) {", "free(VAR_3);", "return;", "}", "aurb->VAR_2.status = VAR_2->status;", "aurb->VAR_2.length = VAR_2->length;", "if (memcmp(&aurb->VAR_2, VAR_2,\nsizeof(*VAR_2))) {", "ERROR(\"return control packet mismatch, please report this!\\n\");", "VAR_5 = USB_RET_NAK;", "}", "if (aurb->packet) {", "VAR_5 = usbredir_handle_status(dev, VAR_2->status, VAR_5);", "if (VAR_5 > 0) {", "usbredir_log_data(dev, \"ctrl VAR_3 in:\", VAR_3, VAR_4);", "if (VAR_4 <= sizeof(dev->dev.data_buf)) {", "memcpy(dev->dev.data_buf, VAR_3, VAR_4);", "} else {", "ERROR(\"ctrl buffer too small (%d > %zu)\\n\",\nVAR_4, sizeof(dev->dev.data_buf));", "VAR_5 = USB_RET_STALL;", "}", "}", "aurb->packet->VAR_5 = VAR_5;", "usb_generic_async_ctrl_complete(&dev->dev, aurb->packet);", "}", "async_free(dev, aurb);", "free(VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17, 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ] ]
15,131
int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) { if (avctx->internal->pkt) { frame->pkt_pts = avctx->internal->pkt->pts; av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos); av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration); av_frame_set_pkt_size (frame, avctx->internal->pkt->size); } else { frame->pkt_pts = AV_NOPTS_VALUE; av_frame_set_pkt_pos (frame, -1); av_frame_set_pkt_duration(frame, 0); av_frame_set_pkt_size (frame, -1); } frame->reordered_opaque = avctx->reordered_opaque; switch (avctx->codec->type) { case AVMEDIA_TYPE_VIDEO: if (frame->format < 0) frame->format = avctx->pix_fmt; if (!frame->sample_aspect_ratio.num) frame->sample_aspect_ratio = avctx->sample_aspect_ratio; if (av_frame_get_colorspace(frame) == AVCOL_SPC_UNSPECIFIED) av_frame_set_colorspace(frame, avctx->colorspace); if (av_frame_get_color_range(frame) == AVCOL_RANGE_UNSPECIFIED) av_frame_set_color_range(frame, avctx->color_range); break; case AVMEDIA_TYPE_AUDIO: if (!frame->sample_rate) frame->sample_rate = avctx->sample_rate; if (frame->format < 0) frame->format = avctx->sample_fmt; if (!frame->channel_layout) { if (avctx->channel_layout) { if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { av_log(avctx, AV_LOG_ERROR, "Inconsistent channel " "configuration.\n"); return AVERROR(EINVAL); } frame->channel_layout = avctx->channel_layout; } else { if (avctx->channels > FF_SANE_NB_CHANNELS) { av_log(avctx, AV_LOG_ERROR, "Too many channels: %d.\n", avctx->channels); return AVERROR(ENOSYS); } } } av_frame_set_channels(frame, avctx->channels); break; } return 0; }
false
FFmpeg
e5c7229999182ad1cef13b9eca050dba7a5a08da
int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) { if (avctx->internal->pkt) { frame->pkt_pts = avctx->internal->pkt->pts; av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos); av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration); av_frame_set_pkt_size (frame, avctx->internal->pkt->size); } else { frame->pkt_pts = AV_NOPTS_VALUE; av_frame_set_pkt_pos (frame, -1); av_frame_set_pkt_duration(frame, 0); av_frame_set_pkt_size (frame, -1); } frame->reordered_opaque = avctx->reordered_opaque; switch (avctx->codec->type) { case AVMEDIA_TYPE_VIDEO: if (frame->format < 0) frame->format = avctx->pix_fmt; if (!frame->sample_aspect_ratio.num) frame->sample_aspect_ratio = avctx->sample_aspect_ratio; if (av_frame_get_colorspace(frame) == AVCOL_SPC_UNSPECIFIED) av_frame_set_colorspace(frame, avctx->colorspace); if (av_frame_get_color_range(frame) == AVCOL_RANGE_UNSPECIFIED) av_frame_set_color_range(frame, avctx->color_range); break; case AVMEDIA_TYPE_AUDIO: if (!frame->sample_rate) frame->sample_rate = avctx->sample_rate; if (frame->format < 0) frame->format = avctx->sample_fmt; if (!frame->channel_layout) { if (avctx->channel_layout) { if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { av_log(avctx, AV_LOG_ERROR, "Inconsistent channel " "configuration.\n"); return AVERROR(EINVAL); } frame->channel_layout = avctx->channel_layout; } else { if (avctx->channels > FF_SANE_NB_CHANNELS) { av_log(avctx, AV_LOG_ERROR, "Too many channels: %d.\n", avctx->channels); return AVERROR(ENOSYS); } } } av_frame_set_channels(frame, avctx->channels); break; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1) { if (VAR_0->internal->pkt) { VAR_1->pkt_pts = VAR_0->internal->pkt->pts; av_frame_set_pkt_pos (VAR_1, VAR_0->internal->pkt->pos); av_frame_set_pkt_duration(VAR_1, VAR_0->internal->pkt->duration); av_frame_set_pkt_size (VAR_1, VAR_0->internal->pkt->size); } else { VAR_1->pkt_pts = AV_NOPTS_VALUE; av_frame_set_pkt_pos (VAR_1, -1); av_frame_set_pkt_duration(VAR_1, 0); av_frame_set_pkt_size (VAR_1, -1); } VAR_1->reordered_opaque = VAR_0->reordered_opaque; switch (VAR_0->codec->type) { case AVMEDIA_TYPE_VIDEO: if (VAR_1->format < 0) VAR_1->format = VAR_0->pix_fmt; if (!VAR_1->sample_aspect_ratio.num) VAR_1->sample_aspect_ratio = VAR_0->sample_aspect_ratio; if (av_frame_get_colorspace(VAR_1) == AVCOL_SPC_UNSPECIFIED) av_frame_set_colorspace(VAR_1, VAR_0->colorspace); if (av_frame_get_color_range(VAR_1) == AVCOL_RANGE_UNSPECIFIED) av_frame_set_color_range(VAR_1, VAR_0->color_range); break; case AVMEDIA_TYPE_AUDIO: if (!VAR_1->sample_rate) VAR_1->sample_rate = VAR_0->sample_rate; if (VAR_1->format < 0) VAR_1->format = VAR_0->sample_fmt; if (!VAR_1->channel_layout) { if (VAR_0->channel_layout) { if (av_get_channel_layout_nb_channels(VAR_0->channel_layout) != VAR_0->channels) { av_log(VAR_0, AV_LOG_ERROR, "Inconsistent channel " "configuration.\n"); return AVERROR(EINVAL); } VAR_1->channel_layout = VAR_0->channel_layout; } else { if (VAR_0->channels > FF_SANE_NB_CHANNELS) { av_log(VAR_0, AV_LOG_ERROR, "Too many channels: %d.\n", VAR_0->channels); return AVERROR(ENOSYS); } } } av_frame_set_channels(VAR_1, VAR_0->channels); break; } return 0; }
[ "int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1)\n{", "if (VAR_0->internal->pkt) {", "VAR_1->pkt_pts = VAR_0->internal->pkt->pts;", "av_frame_set_pkt_pos (VAR_1, VAR_0->internal->pkt->pos);", "av_frame_set_pkt_duration(VAR_1, VAR_0->internal->pkt->duration);", "av_frame_set_pkt_size (VAR_1, VAR_0->internal->pkt->size);", "} else {", "VAR_1->pkt_pts = AV_NOPTS_VALUE;", "av_frame_set_pkt_pos (VAR_1, -1);", "av_frame_set_pkt_duration(VAR_1, 0);", "av_frame_set_pkt_size (VAR_1, -1);", "}", "VAR_1->reordered_opaque = VAR_0->reordered_opaque;", "switch (VAR_0->codec->type) {", "case AVMEDIA_TYPE_VIDEO:\nif (VAR_1->format < 0)\nVAR_1->format = VAR_0->pix_fmt;", "if (!VAR_1->sample_aspect_ratio.num)\nVAR_1->sample_aspect_ratio = VAR_0->sample_aspect_ratio;", "if (av_frame_get_colorspace(VAR_1) == AVCOL_SPC_UNSPECIFIED)\nav_frame_set_colorspace(VAR_1, VAR_0->colorspace);", "if (av_frame_get_color_range(VAR_1) == AVCOL_RANGE_UNSPECIFIED)\nav_frame_set_color_range(VAR_1, VAR_0->color_range);", "break;", "case AVMEDIA_TYPE_AUDIO:\nif (!VAR_1->sample_rate)\nVAR_1->sample_rate = VAR_0->sample_rate;", "if (VAR_1->format < 0)\nVAR_1->format = VAR_0->sample_fmt;", "if (!VAR_1->channel_layout) {", "if (VAR_0->channel_layout) {", "if (av_get_channel_layout_nb_channels(VAR_0->channel_layout) !=\nVAR_0->channels) {", "av_log(VAR_0, AV_LOG_ERROR, \"Inconsistent channel \"\n\"configuration.\\n\");", "return AVERROR(EINVAL);", "}", "VAR_1->channel_layout = VAR_0->channel_layout;", "} else {", "if (VAR_0->channels > FF_SANE_NB_CHANNELS) {", "av_log(VAR_0, AV_LOG_ERROR, \"Too many channels: %d.\\n\",\nVAR_0->channels);", "return AVERROR(ENOSYS);", "}", "}", "}", "av_frame_set_channels(VAR_1, VAR_0->channels);", "break;", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 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 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ] ]
15,135
AVFilterContext *avfilter_open(AVFilter *filter, char *inst_name) { AVFilterContext *ret = av_malloc(sizeof(AVFilterContext)); ret->av_class = av_mallocz(sizeof(AVClass)); ret->av_class->item_name = filter_name; ret->filter = filter; ret->name = inst_name ? av_strdup(inst_name) : NULL; ret->priv = av_mallocz(filter->priv_size); ret->input_count = pad_count(filter->inputs); ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad)*ret->input_count); ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); ret->output_count = pad_count(filter->outputs); ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count); memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad)*ret->output_count); ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); return ret; }
true
FFmpeg
8f618f4c048e3579b62768665c255b89bd99b89f
AVFilterContext *avfilter_open(AVFilter *filter, char *inst_name) { AVFilterContext *ret = av_malloc(sizeof(AVFilterContext)); ret->av_class = av_mallocz(sizeof(AVClass)); ret->av_class->item_name = filter_name; ret->filter = filter; ret->name = inst_name ? av_strdup(inst_name) : NULL; ret->priv = av_mallocz(filter->priv_size); ret->input_count = pad_count(filter->inputs); ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad)*ret->input_count); ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); ret->output_count = pad_count(filter->outputs); ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count); memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad)*ret->output_count); ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); return ret; }
{ "code": [ " AVFilterContext *ret = av_malloc(sizeof(AVFilterContext));" ], "line_no": [ 5 ] }
AVFilterContext *FUNC_0(AVFilter *filter, char *inst_name) { AVFilterContext *ret = av_malloc(sizeof(AVFilterContext)); ret->av_class = av_mallocz(sizeof(AVClass)); ret->av_class->item_name = filter_name; ret->filter = filter; ret->name = inst_name ? av_strdup(inst_name) : NULL; ret->priv = av_mallocz(filter->priv_size); ret->input_count = pad_count(filter->inputs); ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count); memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad)*ret->input_count); ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count); ret->output_count = pad_count(filter->outputs); ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count); memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad)*ret->output_count); ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count); return ret; }
[ "AVFilterContext *FUNC_0(AVFilter *filter, char *inst_name)\n{", "AVFilterContext *ret = av_malloc(sizeof(AVFilterContext));", "ret->av_class = av_mallocz(sizeof(AVClass));", "ret->av_class->item_name = filter_name;", "ret->filter = filter;", "ret->name = inst_name ? av_strdup(inst_name) : NULL;", "ret->priv = av_mallocz(filter->priv_size);", "ret->input_count = pad_count(filter->inputs);", "ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count);", "memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad)*ret->input_count);", "ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count);", "ret->output_count = pad_count(filter->outputs);", "ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count);", "memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad)*ret->output_count);", "ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count);", "return ret;", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
15,137
static int vnc_zlib_stop(VncState *vs) { z_streamp zstream = &vs->zlib.stream; int previous_out; // switch back to normal output/zlib buffers vs->zlib.zlib = vs->output; vs->output = vs->zlib.tmp; // compress the zlib buffer // initialize the stream // XXX need one stream per session if (zstream->opaque != vs) { int err; VNC_DEBUG("VNC: initializing zlib stream\n"); VNC_DEBUG("VNC: opaque = %p | vs = %p\n", zstream->opaque, vs); zstream->zalloc = vnc_zlib_zalloc; zstream->zfree = vnc_zlib_zfree; err = deflateInit2(zstream, vs->tight.compression, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); if (err != Z_OK) { fprintf(stderr, "VNC: error initializing zlib\n"); return -1; } vs->zlib.level = vs->tight.compression; zstream->opaque = vs; } if (vs->tight.compression != vs->zlib.level) { if (deflateParams(zstream, vs->tight.compression, Z_DEFAULT_STRATEGY) != Z_OK) { return -1; } vs->zlib.level = vs->tight.compression; } // reserve memory in output buffer buffer_reserve(&vs->output, vs->zlib.zlib.offset + 64); // set pointers zstream->next_in = vs->zlib.zlib.buffer; zstream->avail_in = vs->zlib.zlib.offset; zstream->next_out = vs->output.buffer + vs->output.offset; zstream->avail_out = vs->output.capacity - vs->output.offset; zstream->data_type = Z_BINARY; previous_out = zstream->total_out; // start encoding if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) { fprintf(stderr, "VNC: error during zlib compression\n"); return -1; } vs->output.offset = vs->output.capacity - zstream->avail_out; return zstream->total_out - previous_out; }
true
qemu
2caa9e9d2e0f356cc244bc41ce1d3e81663f6782
static int vnc_zlib_stop(VncState *vs) { z_streamp zstream = &vs->zlib.stream; int previous_out; vs->zlib.zlib = vs->output; vs->output = vs->zlib.tmp; if (zstream->opaque != vs) { int err; VNC_DEBUG("VNC: initializing zlib stream\n"); VNC_DEBUG("VNC: opaque = %p | vs = %p\n", zstream->opaque, vs); zstream->zalloc = vnc_zlib_zalloc; zstream->zfree = vnc_zlib_zfree; err = deflateInit2(zstream, vs->tight.compression, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); if (err != Z_OK) { fprintf(stderr, "VNC: error initializing zlib\n"); return -1; } vs->zlib.level = vs->tight.compression; zstream->opaque = vs; } if (vs->tight.compression != vs->zlib.level) { if (deflateParams(zstream, vs->tight.compression, Z_DEFAULT_STRATEGY) != Z_OK) { return -1; } vs->zlib.level = vs->tight.compression; } buffer_reserve(&vs->output, vs->zlib.zlib.offset + 64); zstream->next_in = vs->zlib.zlib.buffer; zstream->avail_in = vs->zlib.zlib.offset; zstream->next_out = vs->output.buffer + vs->output.offset; zstream->avail_out = vs->output.capacity - vs->output.offset; zstream->data_type = Z_BINARY; previous_out = zstream->total_out; if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) { fprintf(stderr, "VNC: error during zlib compression\n"); return -1; } vs->output.offset = vs->output.capacity - zstream->avail_out; return zstream->total_out - previous_out; }
{ "code": [ " previous_out = zstream->total_out;", " previous_out = zstream->total_out;", " return zstream->total_out - previous_out;" ], "line_no": [ 101, 101, 119 ] }
static int FUNC_0(VncState *VAR_0) { z_streamp zstream = &VAR_0->zlib.stream; int VAR_1; VAR_0->zlib.zlib = VAR_0->output; VAR_0->output = VAR_0->zlib.tmp; if (zstream->opaque != VAR_0) { int VAR_2; VNC_DEBUG("VNC: initializing zlib stream\n"); VNC_DEBUG("VNC: opaque = %p | VAR_0 = %p\n", zstream->opaque, VAR_0); zstream->zalloc = vnc_zlib_zalloc; zstream->zfree = vnc_zlib_zfree; VAR_2 = deflateInit2(zstream, VAR_0->tight.compression, Z_DEFLATED, MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); if (VAR_2 != Z_OK) { fprintf(stderr, "VNC: error initializing zlib\n"); return -1; } VAR_0->zlib.level = VAR_0->tight.compression; zstream->opaque = VAR_0; } if (VAR_0->tight.compression != VAR_0->zlib.level) { if (deflateParams(zstream, VAR_0->tight.compression, Z_DEFAULT_STRATEGY) != Z_OK) { return -1; } VAR_0->zlib.level = VAR_0->tight.compression; } buffer_reserve(&VAR_0->output, VAR_0->zlib.zlib.offset + 64); zstream->next_in = VAR_0->zlib.zlib.buffer; zstream->avail_in = VAR_0->zlib.zlib.offset; zstream->next_out = VAR_0->output.buffer + VAR_0->output.offset; zstream->avail_out = VAR_0->output.capacity - VAR_0->output.offset; zstream->data_type = Z_BINARY; VAR_1 = zstream->total_out; if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) { fprintf(stderr, "VNC: error during zlib compression\n"); return -1; } VAR_0->output.offset = VAR_0->output.capacity - zstream->avail_out; return zstream->total_out - VAR_1; }
[ "static int FUNC_0(VncState *VAR_0)\n{", "z_streamp zstream = &VAR_0->zlib.stream;", "int VAR_1;", "VAR_0->zlib.zlib = VAR_0->output;", "VAR_0->output = VAR_0->zlib.tmp;", "if (zstream->opaque != VAR_0) {", "int VAR_2;", "VNC_DEBUG(\"VNC: initializing zlib stream\\n\");", "VNC_DEBUG(\"VNC: opaque = %p | VAR_0 = %p\\n\", zstream->opaque, VAR_0);", "zstream->zalloc = vnc_zlib_zalloc;", "zstream->zfree = vnc_zlib_zfree;", "VAR_2 = deflateInit2(zstream, VAR_0->tight.compression, Z_DEFLATED, MAX_WBITS,\nMAX_MEM_LEVEL, Z_DEFAULT_STRATEGY);", "if (VAR_2 != Z_OK) {", "fprintf(stderr, \"VNC: error initializing zlib\\n\");", "return -1;", "}", "VAR_0->zlib.level = VAR_0->tight.compression;", "zstream->opaque = VAR_0;", "}", "if (VAR_0->tight.compression != VAR_0->zlib.level) {", "if (deflateParams(zstream, VAR_0->tight.compression,\nZ_DEFAULT_STRATEGY) != Z_OK) {", "return -1;", "}", "VAR_0->zlib.level = VAR_0->tight.compression;", "}", "buffer_reserve(&VAR_0->output, VAR_0->zlib.zlib.offset + 64);", "zstream->next_in = VAR_0->zlib.zlib.buffer;", "zstream->avail_in = VAR_0->zlib.zlib.offset;", "zstream->next_out = VAR_0->output.buffer + VAR_0->output.offset;", "zstream->avail_out = VAR_0->output.capacity - VAR_0->output.offset;", "zstream->data_type = Z_BINARY;", "VAR_1 = zstream->total_out;", "if (deflate(zstream, Z_SYNC_FLUSH) != Z_OK) {", "fprintf(stderr, \"VNC: error during zlib compression\\n\");", "return -1;", "}", "VAR_0->output.offset = VAR_0->output.capacity - zstream->avail_out;", "return zstream->total_out - 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, 1, 0, 0, 0, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 13 ], [ 15 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69, 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 85 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ] ]
15,138
void OPPROTO op_divw_AX_T0(void) { unsigned int num, den, q, r; num = (EAX & 0xffff) | ((EDX & 0xffff) << 16); den = (T0 & 0xffff); if (den == 0) { raise_exception(EXCP00_DIVZ); } q = (num / den) & 0xffff; r = (num % den) & 0xffff; EAX = (EAX & ~0xffff) | q; EDX = (EDX & ~0xffff) | r; }
true
qemu
45bbbb466cf4a6280076ea5a51f67ef5bedee345
void OPPROTO op_divw_AX_T0(void) { unsigned int num, den, q, r; num = (EAX & 0xffff) | ((EDX & 0xffff) << 16); den = (T0 & 0xffff); if (den == 0) { raise_exception(EXCP00_DIVZ); } q = (num / den) & 0xffff; r = (num % den) & 0xffff; EAX = (EAX & ~0xffff) | q; EDX = (EDX & ~0xffff) | r; }
{ "code": [ " q = (num / den) & 0xffff;", " q = (num / den) & 0xffff;" ], "line_no": [ 19, 19 ] }
void VAR_0 op_divw_AX_T0(void) { unsigned int num, den, q, r; num = (EAX & 0xffff) | ((EDX & 0xffff) << 16); den = (T0 & 0xffff); if (den == 0) { raise_exception(EXCP00_DIVZ); } q = (num / den) & 0xffff; r = (num % den) & 0xffff; EAX = (EAX & ~0xffff) | q; EDX = (EDX & ~0xffff) | r; }
[ "void VAR_0 op_divw_AX_T0(void)\n{", "unsigned int num, den, q, r;", "num = (EAX & 0xffff) | ((EDX & 0xffff) << 16);", "den = (T0 & 0xffff);", "if (den == 0) {", "raise_exception(EXCP00_DIVZ);", "}", "q = (num / den) & 0xffff;", "r = (num % den) & 0xffff;", "EAX = (EAX & ~0xffff) | q;", "EDX = (EDX & ~0xffff) | r;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ] ]
15,139
static void fic_draw_cursor(AVCodecContext *avctx, int cur_x, int cur_y) { FICContext *ctx = avctx->priv_data; uint8_t *ptr = ctx->cursor_buf; uint8_t *dstptr[3]; uint8_t planes[4][1024]; uint8_t chroma[3][256]; int i, j, p; /* Convert to YUVA444. */ for (i = 0; i < 1024; i++) { planes[0][i] = av_clip_uint8((( 25 * ptr[0] + 129 * ptr[1] + 66 * ptr[2]) / 255) + 16); planes[1][i] = av_clip_uint8(((-38 * ptr[0] + 112 * ptr[1] + -74 * ptr[2]) / 255) + 128); planes[2][i] = av_clip_uint8(((-18 * ptr[0] + 112 * ptr[1] + -94 * ptr[2]) / 255) + 128); planes[3][i] = ptr[3]; ptr += 4; } /* Subsample chroma. */ for (i = 0; i < 32; i += 2) for (j = 0; j < 32; j += 2) for (p = 0; p < 3; p++) chroma[p][16 * (i / 2) + j / 2] = (planes[p + 1][32 * i + j ] + planes[p + 1][32 * i + j + 1] + planes[p + 1][32 * (i + 1) + j ] + planes[p + 1][32 * (i + 1) + j + 1]) / 4; /* Seek to x/y pos of cursor. */ for (i = 0; i < 3; i++) dstptr[i] = ctx->final_frame->data[i] + (ctx->final_frame->linesize[i] * (cur_y >> !!i)) + (cur_x >> !!i) + !!i; /* Copy. */ for (i = 0; i < FFMIN(32, avctx->height - cur_y) - 1; i += 2) { int lsize = FFMIN(32, avctx->width - cur_x); int csize = lsize / 2; fic_alpha_blend(dstptr[0], planes[0] + i * 32, lsize, planes[3] + i * 32); fic_alpha_blend(dstptr[0] + ctx->final_frame->linesize[0], planes[0] + (i + 1) * 32, lsize, planes[3] + (i + 1) * 32); fic_alpha_blend(dstptr[1], chroma[0] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16); fic_alpha_blend(dstptr[2], chroma[1] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16); dstptr[0] += ctx->final_frame->linesize[0] * 2; dstptr[1] += ctx->final_frame->linesize[1]; dstptr[2] += ctx->final_frame->linesize[2]; } }
true
FFmpeg
7596fc3d4b616318ac42a6cc011fe20f3ff7aaa9
static void fic_draw_cursor(AVCodecContext *avctx, int cur_x, int cur_y) { FICContext *ctx = avctx->priv_data; uint8_t *ptr = ctx->cursor_buf; uint8_t *dstptr[3]; uint8_t planes[4][1024]; uint8_t chroma[3][256]; int i, j, p; for (i = 0; i < 1024; i++) { planes[0][i] = av_clip_uint8((( 25 * ptr[0] + 129 * ptr[1] + 66 * ptr[2]) / 255) + 16); planes[1][i] = av_clip_uint8(((-38 * ptr[0] + 112 * ptr[1] + -74 * ptr[2]) / 255) + 128); planes[2][i] = av_clip_uint8(((-18 * ptr[0] + 112 * ptr[1] + -94 * ptr[2]) / 255) + 128); planes[3][i] = ptr[3]; ptr += 4; } for (i = 0; i < 32; i += 2) for (j = 0; j < 32; j += 2) for (p = 0; p < 3; p++) chroma[p][16 * (i / 2) + j / 2] = (planes[p + 1][32 * i + j ] + planes[p + 1][32 * i + j + 1] + planes[p + 1][32 * (i + 1) + j ] + planes[p + 1][32 * (i + 1) + j + 1]) / 4; for (i = 0; i < 3; i++) dstptr[i] = ctx->final_frame->data[i] + (ctx->final_frame->linesize[i] * (cur_y >> !!i)) + (cur_x >> !!i) + !!i; for (i = 0; i < FFMIN(32, avctx->height - cur_y) - 1; i += 2) { int lsize = FFMIN(32, avctx->width - cur_x); int csize = lsize / 2; fic_alpha_blend(dstptr[0], planes[0] + i * 32, lsize, planes[3] + i * 32); fic_alpha_blend(dstptr[0] + ctx->final_frame->linesize[0], planes[0] + (i + 1) * 32, lsize, planes[3] + (i + 1) * 32); fic_alpha_blend(dstptr[1], chroma[0] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16); fic_alpha_blend(dstptr[2], chroma[1] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16); dstptr[0] += ctx->final_frame->linesize[0] * 2; dstptr[1] += ctx->final_frame->linesize[1]; dstptr[2] += ctx->final_frame->linesize[2]; } }
{ "code": [ " planes[0][i] = av_clip_uint8((( 25 * ptr[0] + 129 * ptr[1] + 66 * ptr[2]) / 255) + 16);", " planes[1][i] = av_clip_uint8(((-38 * ptr[0] + 112 * ptr[1] + -74 * ptr[2]) / 255) + 128);", " planes[2][i] = av_clip_uint8(((-18 * ptr[0] + 112 * ptr[1] + -94 * ptr[2]) / 255) + 128);" ], "line_no": [ 23, 25, 27 ] }
static void FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2) { FICContext *ctx = VAR_0->priv_data; uint8_t *ptr = ctx->cursor_buf; uint8_t *dstptr[3]; uint8_t planes[4][1024]; uint8_t chroma[3][256]; int VAR_3, VAR_4, VAR_5; for (VAR_3 = 0; VAR_3 < 1024; VAR_3++) { planes[0][VAR_3] = av_clip_uint8((( 25 * ptr[0] + 129 * ptr[1] + 66 * ptr[2]) / 255) + 16); planes[1][VAR_3] = av_clip_uint8(((-38 * ptr[0] + 112 * ptr[1] + -74 * ptr[2]) / 255) + 128); planes[2][VAR_3] = av_clip_uint8(((-18 * ptr[0] + 112 * ptr[1] + -94 * ptr[2]) / 255) + 128); planes[3][VAR_3] = ptr[3]; ptr += 4; } for (VAR_3 = 0; VAR_3 < 32; VAR_3 += 2) for (VAR_4 = 0; VAR_4 < 32; VAR_4 += 2) for (VAR_5 = 0; VAR_5 < 3; VAR_5++) chroma[VAR_5][16 * (VAR_3 / 2) + VAR_4 / 2] = (planes[VAR_5 + 1][32 * VAR_3 + VAR_4 ] + planes[VAR_5 + 1][32 * VAR_3 + VAR_4 + 1] + planes[VAR_5 + 1][32 * (VAR_3 + 1) + VAR_4 ] + planes[VAR_5 + 1][32 * (VAR_3 + 1) + VAR_4 + 1]) / 4; for (VAR_3 = 0; VAR_3 < 3; VAR_3++) dstptr[VAR_3] = ctx->final_frame->data[VAR_3] + (ctx->final_frame->linesize[VAR_3] * (VAR_2 >> !!VAR_3)) + (VAR_1 >> !!VAR_3) + !!VAR_3; for (VAR_3 = 0; VAR_3 < FFMIN(32, VAR_0->height - VAR_2) - 1; VAR_3 += 2) { int lsize = FFMIN(32, VAR_0->width - VAR_1); int csize = lsize / 2; fic_alpha_blend(dstptr[0], planes[0] + VAR_3 * 32, lsize, planes[3] + VAR_3 * 32); fic_alpha_blend(dstptr[0] + ctx->final_frame->linesize[0], planes[0] + (VAR_3 + 1) * 32, lsize, planes[3] + (VAR_3 + 1) * 32); fic_alpha_blend(dstptr[1], chroma[0] + (VAR_3 / 2) * 16, csize, chroma[2] + (VAR_3 / 2) * 16); fic_alpha_blend(dstptr[2], chroma[1] + (VAR_3 / 2) * 16, csize, chroma[2] + (VAR_3 / 2) * 16); dstptr[0] += ctx->final_frame->linesize[0] * 2; dstptr[1] += ctx->final_frame->linesize[1]; dstptr[2] += ctx->final_frame->linesize[2]; } }
[ "static void FUNC_0(AVCodecContext *VAR_0, int VAR_1, int VAR_2)\n{", "FICContext *ctx = VAR_0->priv_data;", "uint8_t *ptr = ctx->cursor_buf;", "uint8_t *dstptr[3];", "uint8_t planes[4][1024];", "uint8_t chroma[3][256];", "int VAR_3, VAR_4, VAR_5;", "for (VAR_3 = 0; VAR_3 < 1024; VAR_3++) {", "planes[0][VAR_3] = av_clip_uint8((( 25 * ptr[0] + 129 * ptr[1] + 66 * ptr[2]) / 255) + 16);", "planes[1][VAR_3] = av_clip_uint8(((-38 * ptr[0] + 112 * ptr[1] + -74 * ptr[2]) / 255) + 128);", "planes[2][VAR_3] = av_clip_uint8(((-18 * ptr[0] + 112 * ptr[1] + -94 * ptr[2]) / 255) + 128);", "planes[3][VAR_3] = ptr[3];", "ptr += 4;", "}", "for (VAR_3 = 0; VAR_3 < 32; VAR_3 += 2)", "for (VAR_4 = 0; VAR_4 < 32; VAR_4 += 2)", "for (VAR_5 = 0; VAR_5 < 3; VAR_5++)", "chroma[VAR_5][16 * (VAR_3 / 2) + VAR_4 / 2] = (planes[VAR_5 + 1][32 * VAR_3 + VAR_4 ] +\nplanes[VAR_5 + 1][32 * VAR_3 + VAR_4 + 1] +\nplanes[VAR_5 + 1][32 * (VAR_3 + 1) + VAR_4 ] +\nplanes[VAR_5 + 1][32 * (VAR_3 + 1) + VAR_4 + 1]) / 4;", "for (VAR_3 = 0; VAR_3 < 3; VAR_3++)", "dstptr[VAR_3] = ctx->final_frame->data[VAR_3] +\n(ctx->final_frame->linesize[VAR_3] * (VAR_2 >> !!VAR_3)) +\n(VAR_1 >> !!VAR_3) + !!VAR_3;", "for (VAR_3 = 0; VAR_3 < FFMIN(32, VAR_0->height - VAR_2) - 1; VAR_3 += 2) {", "int lsize = FFMIN(32, VAR_0->width - VAR_1);", "int csize = lsize / 2;", "fic_alpha_blend(dstptr[0],\nplanes[0] + VAR_3 * 32, lsize, planes[3] + VAR_3 * 32);", "fic_alpha_blend(dstptr[0] + ctx->final_frame->linesize[0],\nplanes[0] + (VAR_3 + 1) * 32, lsize, planes[3] + (VAR_3 + 1) * 32);", "fic_alpha_blend(dstptr[1],\nchroma[0] + (VAR_3 / 2) * 16, csize, chroma[2] + (VAR_3 / 2) * 16);", "fic_alpha_blend(dstptr[2],\nchroma[1] + (VAR_3 / 2) * 16, csize, chroma[2] + (VAR_3 / 2) * 16);", "dstptr[0] += ctx->final_frame->linesize[0] * 2;", "dstptr[1] += ctx->final_frame->linesize[1];", "dstptr[2] += ctx->final_frame->linesize[2];", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49, 51, 53 ], [ 59 ], [ 61, 63, 65 ], [ 71 ], [ 73 ], [ 75 ], [ 79, 81 ], [ 83, 85 ], [ 87, 89 ], [ 91, 93 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ] ]
15,140
static int decode_ref_pic_list_reordering(H264Context *h){ MpegEncContext * const s = &h->s; int list, index; print_short_term(h); print_long_term(h); if(h->slice_type==I_TYPE || h->slice_type==SI_TYPE) return 0; //FIXME move before func for(list=0; list<2; list++){ memcpy(h->ref_list[list], h->default_ref_list[list], sizeof(Picture)*h->ref_count[list]); if(get_bits1(&s->gb)){ int pred= h->curr_pic_num; for(index=0; ; index++){ int reordering_of_pic_nums_idc= get_ue_golomb(&s->gb); 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->s.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 int abs_diff_pic_num= get_ue_golomb(&s->gb) + 1; if(abs_diff_pic_num >= h->max_pic_num){ av_log(h->s.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; for(i= h->short_ref_count-1; i>=0; i--){ ref = h->short_ref[i]; assert(ref->reference == 3); assert(!ref->long_ref); if(ref->data[0] != NULL && ref->frame_num == pred && ref->long_ref == 0) // ignore non existing pictures by testing data[0] pointer break; } if(i>=0) ref->pic_id= ref->frame_num; }else{ pic_id= get_ue_golomb(&s->gb); //long_term_pic_idx ref = h->long_ref[pic_id]; if(ref){ ref->pic_id= pic_id; assert(ref->reference == 3); assert(ref->long_ref); i=0; }else{ i=-1; } } if (i < 0) { av_log(h->s.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--){ h->ref_list[list][i]= h->ref_list[list][i-1]; } h->ref_list[list][index]= *ref; } }else{ av_log(h->s.avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n"); return -1; } } } if(h->slice_type!=B_TYPE) break; } for(list=0; list<2; list++){ for(index= 0; index < h->ref_count[list]; index++){ if(!h->ref_list[list][index].data[0]) h->ref_list[list][index]= s->current_picture; } if(h->slice_type!=B_TYPE) break; } if(h->slice_type==B_TYPE && !h->direct_spatial_mv_pred) direct_dist_scale_factor(h); direct_ref_list_init(h); return 0; }
true
FFmpeg
88e7a4d18c63799a21dff4a570ceb8008e310820
static int decode_ref_pic_list_reordering(H264Context *h){ MpegEncContext * const s = &h->s; int list, index; print_short_term(h); print_long_term(h); if(h->slice_type==I_TYPE || h->slice_type==SI_TYPE) return 0; for(list=0; list<2; list++){ memcpy(h->ref_list[list], h->default_ref_list[list], sizeof(Picture)*h->ref_count[list]); if(get_bits1(&s->gb)){ int pred= h->curr_pic_num; for(index=0; ; index++){ int reordering_of_pic_nums_idc= get_ue_golomb(&s->gb); 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->s.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 int abs_diff_pic_num= get_ue_golomb(&s->gb) + 1; if(abs_diff_pic_num >= h->max_pic_num){ av_log(h->s.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; for(i= h->short_ref_count-1; i>=0; i--){ ref = h->short_ref[i]; assert(ref->reference == 3); assert(!ref->long_ref); if(ref->data[0] != NULL && ref->frame_num == pred && ref->long_ref == 0) break; } if(i>=0) ref->pic_id= ref->frame_num; }else{ pic_id= get_ue_golomb(&s->gb); ref = h->long_ref[pic_id]; if(ref){ ref->pic_id= pic_id; assert(ref->reference == 3); assert(ref->long_ref); i=0; }else{ i=-1; } } if (i < 0) { av_log(h->s.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--){ h->ref_list[list][i]= h->ref_list[list][i-1]; } h->ref_list[list][index]= *ref; } }else{ av_log(h->s.avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n"); return -1; } } } if(h->slice_type!=B_TYPE) break; } for(list=0; list<2; list++){ for(index= 0; index < h->ref_count[list]; index++){ if(!h->ref_list[list][index].data[0]) h->ref_list[list][index]= s->current_picture; } if(h->slice_type!=B_TYPE) break; } if(h->slice_type==B_TYPE && !h->direct_spatial_mv_pred) direct_dist_scale_factor(h); direct_ref_list_init(h); return 0; }
{ "code": [ " int reordering_of_pic_nums_idc= get_ue_golomb(&s->gb);", " int pic_id;", " const int abs_diff_pic_num= get_ue_golomb(&s->gb) + 1;" ], "line_no": [ 31, 33, 61 ] }
static int FUNC_0(H264Context *VAR_0){ MpegEncContext * const s = &VAR_0->s; int VAR_1, VAR_2; print_short_term(VAR_0); print_long_term(VAR_0); if(VAR_0->slice_type==I_TYPE || VAR_0->slice_type==SI_TYPE) return 0; for(VAR_1=0; VAR_1<2; VAR_1++){ memcpy(VAR_0->ref_list[VAR_1], VAR_0->default_ref_list[VAR_1], sizeof(Picture)*VAR_0->ref_count[VAR_1]); if(get_bits1(&s->gb)){ int VAR_3= VAR_0->curr_pic_num; for(VAR_2=0; ; VAR_2++){ int VAR_4= get_ue_golomb(&s->gb); int VAR_5; int VAR_6; Picture *ref = NULL; if(VAR_4==3) break; if(VAR_2 >= VAR_0->ref_count[VAR_1]){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "reference count overflow\n"); return -1; } if(VAR_4<3){ if(VAR_4<2){ const int VAR_7= get_ue_golomb(&s->gb) + 1; if(VAR_7 >= VAR_0->max_pic_num){ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "VAR_7 overflow\n"); return -1; } if(VAR_4 == 0) VAR_3-= VAR_7; else VAR_3+= VAR_7; VAR_3 &= VAR_0->max_pic_num - 1; for(VAR_6= VAR_0->short_ref_count-1; VAR_6>=0; VAR_6--){ ref = VAR_0->short_ref[VAR_6]; assert(ref->reference == 3); assert(!ref->long_ref); if(ref->data[0] != NULL && ref->frame_num == VAR_3 && ref->long_ref == 0) break; } if(VAR_6>=0) ref->VAR_5= ref->frame_num; }else{ VAR_5= get_ue_golomb(&s->gb); ref = VAR_0->long_ref[VAR_5]; if(ref){ ref->VAR_5= VAR_5; assert(ref->reference == 3); assert(ref->long_ref); VAR_6=0; }else{ VAR_6=-1; } } if (VAR_6 < 0) { av_log(VAR_0->s.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_6=VAR_2; VAR_6+1<VAR_0->ref_count[VAR_1]; VAR_6++){ if(ref->long_ref == VAR_0->ref_list[VAR_1][VAR_6].long_ref && ref->VAR_5 == VAR_0->ref_list[VAR_1][VAR_6].VAR_5) break; } for(; VAR_6 > VAR_2; VAR_6--){ VAR_0->ref_list[VAR_1][VAR_6]= VAR_0->ref_list[VAR_1][VAR_6-1]; } VAR_0->ref_list[VAR_1][VAR_2]= *ref; } }else{ av_log(VAR_0->s.avctx, AV_LOG_ERROR, "illegal VAR_4\n"); return -1; } } } if(VAR_0->slice_type!=B_TYPE) break; } for(VAR_1=0; VAR_1<2; 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].data[0]) VAR_0->ref_list[VAR_1][VAR_2]= s->current_picture; } if(VAR_0->slice_type!=B_TYPE) break; } if(VAR_0->slice_type==B_TYPE && !VAR_0->direct_spatial_mv_pred) direct_dist_scale_factor(VAR_0); direct_ref_list_init(VAR_0); return 0; }
[ "static int FUNC_0(H264Context *VAR_0){", "MpegEncContext * const s = &VAR_0->s;", "int VAR_1, VAR_2;", "print_short_term(VAR_0);", "print_long_term(VAR_0);", "if(VAR_0->slice_type==I_TYPE || VAR_0->slice_type==SI_TYPE) return 0;", "for(VAR_1=0; VAR_1<2; VAR_1++){", "memcpy(VAR_0->ref_list[VAR_1], VAR_0->default_ref_list[VAR_1], sizeof(Picture)*VAR_0->ref_count[VAR_1]);", "if(get_bits1(&s->gb)){", "int VAR_3= VAR_0->curr_pic_num;", "for(VAR_2=0; ; VAR_2++){", "int VAR_4= get_ue_golomb(&s->gb);", "int VAR_5;", "int VAR_6;", "Picture *ref = NULL;", "if(VAR_4==3)\nbreak;", "if(VAR_2 >= VAR_0->ref_count[VAR_1]){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"reference count overflow\\n\");", "return -1;", "}", "if(VAR_4<3){", "if(VAR_4<2){", "const int VAR_7= get_ue_golomb(&s->gb) + 1;", "if(VAR_7 >= VAR_0->max_pic_num){", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"VAR_7 overflow\\n\");", "return -1;", "}", "if(VAR_4 == 0) VAR_3-= VAR_7;", "else VAR_3+= VAR_7;", "VAR_3 &= VAR_0->max_pic_num - 1;", "for(VAR_6= VAR_0->short_ref_count-1; VAR_6>=0; VAR_6--){", "ref = VAR_0->short_ref[VAR_6];", "assert(ref->reference == 3);", "assert(!ref->long_ref);", "if(ref->data[0] != NULL && ref->frame_num == VAR_3 && ref->long_ref == 0)\nbreak;", "}", "if(VAR_6>=0)\nref->VAR_5= ref->frame_num;", "}else{", "VAR_5= get_ue_golomb(&s->gb);", "ref = VAR_0->long_ref[VAR_5];", "if(ref){", "ref->VAR_5= VAR_5;", "assert(ref->reference == 3);", "assert(ref->long_ref);", "VAR_6=0;", "}else{", "VAR_6=-1;", "}", "}", "if (VAR_6 < 0) {", "av_log(VAR_0->s.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_6=VAR_2; VAR_6+1<VAR_0->ref_count[VAR_1]; VAR_6++){", "if(ref->long_ref == VAR_0->ref_list[VAR_1][VAR_6].long_ref && ref->VAR_5 == VAR_0->ref_list[VAR_1][VAR_6].VAR_5)\nbreak;", "}", "for(; VAR_6 > VAR_2; VAR_6--){", "VAR_0->ref_list[VAR_1][VAR_6]= VAR_0->ref_list[VAR_1][VAR_6-1];", "}", "VAR_0->ref_list[VAR_1][VAR_2]= *ref;", "}", "}else{", "av_log(VAR_0->s.avctx, AV_LOG_ERROR, \"illegal VAR_4\\n\");", "return -1;", "}", "}", "}", "if(VAR_0->slice_type!=B_TYPE) break;", "}", "for(VAR_1=0; VAR_1<2; 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].data[0])\nVAR_0->ref_list[VAR_1][VAR_2]= s->current_picture;", "}", "if(VAR_0->slice_type!=B_TYPE) break;", "}", "if(VAR_0->slice_type==B_TYPE && !VAR_0->direct_spatial_mv_pred)\ndirect_dist_scale_factor(VAR_0);", "direct_ref_list_init(VAR_0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41, 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91, 93 ], [ 95 ], [ 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 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175, 177 ], [ 179 ], [ 181 ], [ 183 ], [ 187, 189 ], [ 191 ], [ 193 ], [ 195 ] ]
15,141
TCGOp *tcg_op_insert_before(TCGContext *s, TCGOp *old_op, TCGOpcode opc, int nargs) { int oi = s->gen_next_op_idx; int prev = old_op->prev; int next = old_op - s->gen_op_buf; TCGOp *new_op; tcg_debug_assert(oi < OPC_BUF_SIZE); s->gen_next_op_idx = oi + 1; new_op = &s->gen_op_buf[oi]; *new_op = (TCGOp){ .opc = opc, .prev = prev, .next = next }; s->gen_op_buf[prev].next = oi; old_op->prev = oi; return new_op; }
true
qemu
15fa08f8451babc88d733bd411d4c94976f9d0f8
TCGOp *tcg_op_insert_before(TCGContext *s, TCGOp *old_op, TCGOpcode opc, int nargs) { int oi = s->gen_next_op_idx; int prev = old_op->prev; int next = old_op - s->gen_op_buf; TCGOp *new_op; tcg_debug_assert(oi < OPC_BUF_SIZE); s->gen_next_op_idx = oi + 1; new_op = &s->gen_op_buf[oi]; *new_op = (TCGOp){ .opc = opc, .prev = prev, .next = next }; s->gen_op_buf[prev].next = oi; old_op->prev = oi; return new_op; }
{ "code": [ " tcg_debug_assert(oi < OPC_BUF_SIZE);", "TCGOp *tcg_op_insert_before(TCGContext *s, TCGOp *old_op,", " TCGOpcode opc, int nargs)", " int oi = s->gen_next_op_idx;", " int prev = old_op->prev;", " int next = old_op - s->gen_op_buf;", " TCGOp *new_op;", " tcg_debug_assert(oi < OPC_BUF_SIZE);", " s->gen_next_op_idx = oi + 1;", " new_op = &s->gen_op_buf[oi];", " *new_op = (TCGOp){", " .opc = opc,", " .prev = prev,", " .next = next", " };", " s->gen_op_buf[prev].next = oi;", " old_op->prev = oi;", " int oi = s->gen_next_op_idx;", " TCGOp *new_op;", " tcg_debug_assert(oi < OPC_BUF_SIZE);", " s->gen_next_op_idx = oi + 1;", " new_op = &s->gen_op_buf[oi];", " *new_op = (TCGOp){", " .opc = opc,", " .prev = prev,", " .next = next", " };" ], "line_no": [ 17, 1, 3, 7, 9, 11, 13, 17, 19, 23, 25, 27, 29, 31, 33, 35, 37, 7, 13, 17, 19, 23, 25, 27, 29, 31, 33 ] }
TCGOp *FUNC_0(TCGContext *s, TCGOp *old_op, TCGOpcode opc, int nargs) { int VAR_0 = s->gen_next_op_idx; int VAR_1 = old_op->VAR_1; int VAR_2 = old_op - s->gen_op_buf; TCGOp *new_op; tcg_debug_assert(VAR_0 < OPC_BUF_SIZE); s->gen_next_op_idx = VAR_0 + 1; new_op = &s->gen_op_buf[VAR_0]; *new_op = (TCGOp){ .opc = opc, .VAR_1 = VAR_1, .VAR_2 = VAR_2 }; s->gen_op_buf[VAR_1].VAR_2 = VAR_0; old_op->VAR_1 = VAR_0; return new_op; }
[ "TCGOp *FUNC_0(TCGContext *s, TCGOp *old_op,\nTCGOpcode opc, int nargs)\n{", "int VAR_0 = s->gen_next_op_idx;", "int VAR_1 = old_op->VAR_1;", "int VAR_2 = old_op - s->gen_op_buf;", "TCGOp *new_op;", "tcg_debug_assert(VAR_0 < OPC_BUF_SIZE);", "s->gen_next_op_idx = VAR_0 + 1;", "new_op = &s->gen_op_buf[VAR_0];", "*new_op = (TCGOp){", ".opc = opc,\n.VAR_1 = VAR_1,\n.VAR_2 = VAR_2\n};", "s->gen_op_buf[VAR_1].VAR_2 = VAR_0;", "old_op->VAR_1 = VAR_0;", "return new_op;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29, 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ] ]
15,142
void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){ int i, j; int dc = (((dctcoef*)block)[0] + 32) >> 6; INIT_CLIP pixel *dst = (pixel*)_dst; stride /= sizeof(pixel); for( j = 0; j < 8; j++ ) { for( i = 0; i < 8; i++ ) dst[i] = CLIP( dst[i] + dc ); dst += stride; } }
true
FFmpeg
c23acbaed40101c677dfcfbbfe0d2c230a8e8f44
void FUNCC(ff_h264_idct8_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){ int i, j; int dc = (((dctcoef*)block)[0] + 32) >> 6; INIT_CLIP pixel *dst = (pixel*)_dst; stride /= sizeof(pixel); for( j = 0; j < 8; j++ ) { for( i = 0; i < 8; i++ ) dst[i] = CLIP( dst[i] + dc ); dst += stride; } }
{ "code": [ " INIT_CLIP", " INIT_CLIP", " INIT_CLIP", " dst[i] = CLIP( dst[i] + dc );", " INIT_CLIP", " dst[i] = CLIP( dst[i] + dc );" ], "line_no": [ 7, 7, 7, 19, 7, 19 ] }
void FUNC_0(ff_h264_idct8_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){ int VAR_0, VAR_1; int VAR_2 = (((dctcoef*)block)[0] + 32) >> 6; INIT_CLIP pixel *dst = (pixel*)_dst; stride /= sizeof(pixel); for( VAR_1 = 0; VAR_1 < 8; VAR_1++ ) { for( VAR_0 = 0; VAR_0 < 8; VAR_0++ ) dst[VAR_0] = CLIP( dst[VAR_0] + VAR_2 ); dst += stride; } }
[ "void FUNC_0(ff_h264_idct8_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){", "int VAR_0, VAR_1;", "int VAR_2 = (((dctcoef*)block)[0] + 32) >> 6;", "INIT_CLIP\npixel *dst = (pixel*)_dst;", "stride /= sizeof(pixel);", "for( VAR_1 = 0; VAR_1 < 8; VAR_1++ )", "{", "for( VAR_0 = 0; VAR_0 < 8; VAR_0++ )", "dst[VAR_0] = CLIP( dst[VAR_0] + VAR_2 );", "dst += stride;", "}", "}" ]
[ 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1 ], [ 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ] ]
15,143
static int svq3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; SVQ3Context *svq3 = avctx->priv_data; H264Context *h = &svq3->h; MpegEncContext *s = &h->s; int buf_size = avpkt->size; int m, mb_type; /* special case for last picture */ if (buf_size == 0) { if (s->next_picture_ptr && !s->low_delay) { *(AVFrame *) data = s->next_picture.f; s->next_picture_ptr = NULL; *got_frame = 1; } return 0; } init_get_bits(&s->gb, buf, 8 * buf_size); s->mb_x = s->mb_y = h->mb_xy = 0; if (svq3_decode_slice_header(avctx)) return -1; s->pict_type = h->slice_type; s->picture_number = h->slice_num; if (avctx->debug & FF_DEBUG_PICT_INFO) av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n", av_get_picture_type_char(s->pict_type), svq3->halfpel_flag, svq3->thirdpel_flag, s->adaptive_quant, s->qscale, h->slice_num); /* for skipping the frame */ s->current_picture.f.pict_type = s->pict_type; s->current_picture.f.key_frame = (s->pict_type == AV_PICTURE_TYPE_I); /* Skip B-frames if we do not have reference frames. */ if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B) return 0; if (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B || avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I || avctx->skip_frame >= AVDISCARD_ALL) return 0; if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) return 0; else s->next_p_frame_damaged = 0; } if (ff_h264_frame_start(h) < 0) return -1; if (s->pict_type == AV_PICTURE_TYPE_B) { h->frame_num_offset = h->slice_num - h->prev_frame_num; if (h->frame_num_offset < 0) h->frame_num_offset += 256; if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) { av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n"); return -1; } } else { h->prev_frame_num = h->frame_num; h->frame_num = h->slice_num; h->prev_frame_num_offset = h->frame_num - h->prev_frame_num; if (h->prev_frame_num_offset < 0) h->prev_frame_num_offset += 256; } for (m = 0; m < 2; m++) { int i; for (i = 0; i < 4; i++) { int j; for (j = -1; j < 4; j++) h->ref_cache[m][scan8[0] + 8 * i + j] = 1; if (i < 3) h->ref_cache[m][scan8[0] + 8 * i + j] = PART_NOT_AVAILABLE; } } for (s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { for (s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) { h->mb_xy = s->mb_x + s->mb_y * s->mb_stride; if ((get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits && ((get_bits_count(&s->gb) & 7) == 0 || show_bits(&s->gb, -get_bits_count(&s->gb) & 7) == 0)) { skip_bits(&s->gb, svq3->next_slice_index - get_bits_count(&s->gb)); s->gb.size_in_bits = 8 * buf_size; if (svq3_decode_slice_header(avctx)) return -1; /* TODO: support s->mb_skip_run */ } mb_type = svq3_get_ue_golomb(&s->gb); if (s->pict_type == AV_PICTURE_TYPE_I) mb_type += 8; else if (s->pict_type == AV_PICTURE_TYPE_B && mb_type >= 4) mb_type += 4; if ((unsigned)mb_type > 33 || svq3_decode_mb(svq3, mb_type)) { av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); return -1; } if (mb_type != 0) ff_h264_hl_decode_mb(h); if (s->pict_type != AV_PICTURE_TYPE_B && !s->low_delay) s->current_picture.f.mb_type[s->mb_x + s->mb_y * s->mb_stride] = (s->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? (mb_type - 1) : -1; } ff_draw_horiz_band(s, 16 * s->mb_y, 16); } ff_MPV_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) *(AVFrame *)data = s->current_picture.f; else *(AVFrame *)data = s->last_picture.f; /* Do not output the last pic after seeking. */ if (s->last_picture_ptr || s->low_delay) *got_frame = 1; return buf_size; }
true
FFmpeg
9a2e79116d6235c53d8e9663a8d30d1950d7431a
static int svq3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; SVQ3Context *svq3 = avctx->priv_data; H264Context *h = &svq3->h; MpegEncContext *s = &h->s; int buf_size = avpkt->size; int m, mb_type; if (buf_size == 0) { if (s->next_picture_ptr && !s->low_delay) { *(AVFrame *) data = s->next_picture.f; s->next_picture_ptr = NULL; *got_frame = 1; } return 0; } init_get_bits(&s->gb, buf, 8 * buf_size); s->mb_x = s->mb_y = h->mb_xy = 0; if (svq3_decode_slice_header(avctx)) return -1; s->pict_type = h->slice_type; s->picture_number = h->slice_num; if (avctx->debug & FF_DEBUG_PICT_INFO) av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n", av_get_picture_type_char(s->pict_type), svq3->halfpel_flag, svq3->thirdpel_flag, s->adaptive_quant, s->qscale, h->slice_num); s->current_picture.f.pict_type = s->pict_type; s->current_picture.f.key_frame = (s->pict_type == AV_PICTURE_TYPE_I); if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B) return 0; if (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B || avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I || avctx->skip_frame >= AVDISCARD_ALL) return 0; if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) return 0; else s->next_p_frame_damaged = 0; } if (ff_h264_frame_start(h) < 0) return -1; if (s->pict_type == AV_PICTURE_TYPE_B) { h->frame_num_offset = h->slice_num - h->prev_frame_num; if (h->frame_num_offset < 0) h->frame_num_offset += 256; if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) { av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n"); return -1; } } else { h->prev_frame_num = h->frame_num; h->frame_num = h->slice_num; h->prev_frame_num_offset = h->frame_num - h->prev_frame_num; if (h->prev_frame_num_offset < 0) h->prev_frame_num_offset += 256; } for (m = 0; m < 2; m++) { int i; for (i = 0; i < 4; i++) { int j; for (j = -1; j < 4; j++) h->ref_cache[m][scan8[0] + 8 * i + j] = 1; if (i < 3) h->ref_cache[m][scan8[0] + 8 * i + j] = PART_NOT_AVAILABLE; } } for (s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { for (s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) { h->mb_xy = s->mb_x + s->mb_y * s->mb_stride; if ((get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits && ((get_bits_count(&s->gb) & 7) == 0 || show_bits(&s->gb, -get_bits_count(&s->gb) & 7) == 0)) { skip_bits(&s->gb, svq3->next_slice_index - get_bits_count(&s->gb)); s->gb.size_in_bits = 8 * buf_size; if (svq3_decode_slice_header(avctx)) return -1; } mb_type = svq3_get_ue_golomb(&s->gb); if (s->pict_type == AV_PICTURE_TYPE_I) mb_type += 8; else if (s->pict_type == AV_PICTURE_TYPE_B && mb_type >= 4) mb_type += 4; if ((unsigned)mb_type > 33 || svq3_decode_mb(svq3, mb_type)) { av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); return -1; } if (mb_type != 0) ff_h264_hl_decode_mb(h); if (s->pict_type != AV_PICTURE_TYPE_B && !s->low_delay) s->current_picture.f.mb_type[s->mb_x + s->mb_y * s->mb_stride] = (s->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? (mb_type - 1) : -1; } ff_draw_horiz_band(s, 16 * s->mb_y, 16); } ff_MPV_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) *(AVFrame *)data = s->current_picture.f; else *(AVFrame *)data = s->last_picture.f; if (s->last_picture_ptr || s->low_delay) *got_frame = 1; return buf_size; }
{ "code": [ " return -1;", " int m, mb_type;", " if ((unsigned)mb_type > 33 || svq3_decode_mb(svq3, mb_type)) {" ], "line_no": [ 229, 17, 223 ] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { const uint8_t *VAR_4 = VAR_3->VAR_1; SVQ3Context *svq3 = VAR_0->priv_data; H264Context *h = &svq3->h; MpegEncContext *s = &h->s; int VAR_5 = VAR_3->size; int VAR_6, VAR_7; if (VAR_5 == 0) { if (s->next_picture_ptr && !s->low_delay) { *(AVFrame *) VAR_1 = s->next_picture.f; s->next_picture_ptr = NULL; *VAR_2 = 1; } return 0; } init_get_bits(&s->gb, VAR_4, 8 * VAR_5); s->mb_x = s->mb_y = h->mb_xy = 0; if (svq3_decode_slice_header(VAR_0)) return -1; s->pict_type = h->slice_type; s->picture_number = h->slice_num; if (VAR_0->debug & FF_DEBUG_PICT_INFO) av_log(h->s.VAR_0, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n", av_get_picture_type_char(s->pict_type), svq3->halfpel_flag, svq3->thirdpel_flag, s->adaptive_quant, s->qscale, h->slice_num); s->current_picture.f.pict_type = s->pict_type; s->current_picture.f.key_frame = (s->pict_type == AV_PICTURE_TYPE_I); if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B) return 0; if (VAR_0->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B || VAR_0->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I || VAR_0->skip_frame >= AVDISCARD_ALL) return 0; if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) return 0; else s->next_p_frame_damaged = 0; } if (ff_h264_frame_start(h) < 0) return -1; if (s->pict_type == AV_PICTURE_TYPE_B) { h->frame_num_offset = h->slice_num - h->prev_frame_num; if (h->frame_num_offset < 0) h->frame_num_offset += 256; if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) { av_log(h->s.VAR_0, AV_LOG_ERROR, "error in B-frame picture id\n"); return -1; } } else { h->prev_frame_num = h->frame_num; h->frame_num = h->slice_num; h->prev_frame_num_offset = h->frame_num - h->prev_frame_num; if (h->prev_frame_num_offset < 0) h->prev_frame_num_offset += 256; } for (VAR_6 = 0; VAR_6 < 2; VAR_6++) { int VAR_8; for (VAR_8 = 0; VAR_8 < 4; VAR_8++) { int VAR_9; for (VAR_9 = -1; VAR_9 < 4; VAR_9++) h->ref_cache[VAR_6][scan8[0] + 8 * VAR_8 + VAR_9] = 1; if (VAR_8 < 3) h->ref_cache[VAR_6][scan8[0] + 8 * VAR_8 + VAR_9] = PART_NOT_AVAILABLE; } } for (s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) { for (s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) { h->mb_xy = s->mb_x + s->mb_y * s->mb_stride; if ((get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits && ((get_bits_count(&s->gb) & 7) == 0 || show_bits(&s->gb, -get_bits_count(&s->gb) & 7) == 0)) { skip_bits(&s->gb, svq3->next_slice_index - get_bits_count(&s->gb)); s->gb.size_in_bits = 8 * VAR_5; if (svq3_decode_slice_header(VAR_0)) return -1; } VAR_7 = svq3_get_ue_golomb(&s->gb); if (s->pict_type == AV_PICTURE_TYPE_I) VAR_7 += 8; else if (s->pict_type == AV_PICTURE_TYPE_B && VAR_7 >= 4) VAR_7 += 4; if ((unsigned)VAR_7 > 33 || svq3_decode_mb(svq3, VAR_7)) { av_log(h->s.VAR_0, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y); return -1; } if (VAR_7 != 0) ff_h264_hl_decode_mb(h); if (s->pict_type != AV_PICTURE_TYPE_B && !s->low_delay) s->current_picture.f.VAR_7[s->mb_x + s->mb_y * s->mb_stride] = (s->pict_type == AV_PICTURE_TYPE_P && VAR_7 < 8) ? (VAR_7 - 1) : -1; } ff_draw_horiz_band(s, 16 * s->mb_y, 16); } ff_MPV_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) *(AVFrame *)VAR_1 = s->current_picture.f; else *(AVFrame *)VAR_1 = s->last_picture.f; if (s->last_picture_ptr || s->low_delay) *VAR_2 = 1; return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1,\nint *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "SVQ3Context *svq3 = VAR_0->priv_data;", "H264Context *h = &svq3->h;", "MpegEncContext *s = &h->s;", "int VAR_5 = VAR_3->size;", "int VAR_6, VAR_7;", "if (VAR_5 == 0) {", "if (s->next_picture_ptr && !s->low_delay) {", "*(AVFrame *) VAR_1 = s->next_picture.f;", "s->next_picture_ptr = NULL;", "*VAR_2 = 1;", "}", "return 0;", "}", "init_get_bits(&s->gb, VAR_4, 8 * VAR_5);", "s->mb_x = s->mb_y = h->mb_xy = 0;", "if (svq3_decode_slice_header(VAR_0))\nreturn -1;", "s->pict_type = h->slice_type;", "s->picture_number = h->slice_num;", "if (VAR_0->debug & FF_DEBUG_PICT_INFO)\nav_log(h->s.VAR_0, AV_LOG_DEBUG,\n\"%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\\n\",\nav_get_picture_type_char(s->pict_type),\nsvq3->halfpel_flag, svq3->thirdpel_flag,\ns->adaptive_quant, s->qscale, h->slice_num);", "s->current_picture.f.pict_type = s->pict_type;", "s->current_picture.f.key_frame = (s->pict_type == AV_PICTURE_TYPE_I);", "if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B)\nreturn 0;", "if (VAR_0->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B ||\nVAR_0->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I ||\nVAR_0->skip_frame >= AVDISCARD_ALL)\nreturn 0;", "if (s->next_p_frame_damaged) {", "if (s->pict_type == AV_PICTURE_TYPE_B)\nreturn 0;", "else\ns->next_p_frame_damaged = 0;", "}", "if (ff_h264_frame_start(h) < 0)\nreturn -1;", "if (s->pict_type == AV_PICTURE_TYPE_B) {", "h->frame_num_offset = h->slice_num - h->prev_frame_num;", "if (h->frame_num_offset < 0)\nh->frame_num_offset += 256;", "if (h->frame_num_offset == 0 ||\nh->frame_num_offset >= h->prev_frame_num_offset) {", "av_log(h->s.VAR_0, AV_LOG_ERROR, \"error in B-frame picture id\\n\");", "return -1;", "}", "} else {", "h->prev_frame_num = h->frame_num;", "h->frame_num = h->slice_num;", "h->prev_frame_num_offset = h->frame_num - h->prev_frame_num;", "if (h->prev_frame_num_offset < 0)\nh->prev_frame_num_offset += 256;", "}", "for (VAR_6 = 0; VAR_6 < 2; VAR_6++) {", "int VAR_8;", "for (VAR_8 = 0; VAR_8 < 4; VAR_8++) {", "int VAR_9;", "for (VAR_9 = -1; VAR_9 < 4; VAR_9++)", "h->ref_cache[VAR_6][scan8[0] + 8 * VAR_8 + VAR_9] = 1;", "if (VAR_8 < 3)\nh->ref_cache[VAR_6][scan8[0] + 8 * VAR_8 + VAR_9] = PART_NOT_AVAILABLE;", "}", "}", "for (s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {", "for (s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {", "h->mb_xy = s->mb_x + s->mb_y * s->mb_stride;", "if ((get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&\n((get_bits_count(&s->gb) & 7) == 0 ||\nshow_bits(&s->gb, -get_bits_count(&s->gb) & 7) == 0)) {", "skip_bits(&s->gb, svq3->next_slice_index - get_bits_count(&s->gb));", "s->gb.size_in_bits = 8 * VAR_5;", "if (svq3_decode_slice_header(VAR_0))\nreturn -1;", "}", "VAR_7 = svq3_get_ue_golomb(&s->gb);", "if (s->pict_type == AV_PICTURE_TYPE_I)\nVAR_7 += 8;", "else if (s->pict_type == AV_PICTURE_TYPE_B && VAR_7 >= 4)\nVAR_7 += 4;", "if ((unsigned)VAR_7 > 33 || svq3_decode_mb(svq3, VAR_7)) {", "av_log(h->s.VAR_0, AV_LOG_ERROR,\n\"error while decoding MB %d %d\\n\", s->mb_x, s->mb_y);", "return -1;", "}", "if (VAR_7 != 0)\nff_h264_hl_decode_mb(h);", "if (s->pict_type != AV_PICTURE_TYPE_B && !s->low_delay)\ns->current_picture.f.VAR_7[s->mb_x + s->mb_y * s->mb_stride] =\n(s->pict_type == AV_PICTURE_TYPE_P && VAR_7 < 8) ? (VAR_7 - 1) : -1;", "}", "ff_draw_horiz_band(s, 16 * s->mb_y, 16);", "}", "ff_MPV_frame_end(s);", "if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay)\n*(AVFrame *)VAR_1 = s->current_picture.f;", "else\n*(AVFrame *)VAR_1 = s->last_picture.f;", "if (s->last_picture_ptr || s->low_delay)\n*VAR_2 = 1;", "return VAR_5;", "}" ]
[ 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, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 45 ], [ 49, 51 ], [ 55 ], [ 57 ], [ 61, 63, 65, 67, 69, 71 ], [ 77 ], [ 79 ], [ 85, 87 ], [ 89, 91, 93, 95 ], [ 99 ], [ 101, 103 ], [ 105, 107 ], [ 109 ], [ 113, 115 ], [ 119 ], [ 121 ], [ 125, 127 ], [ 129, 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 149, 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181 ], [ 183 ], [ 187, 189, 191 ], [ 193 ], [ 195 ], [ 199, 201 ], [ 207 ], [ 211 ], [ 215, 217 ], [ 219, 221 ], [ 223 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 235, 237 ], [ 241, 243, 245 ], [ 247 ], [ 251 ], [ 253 ], [ 257 ], [ 261, 263 ], [ 265, 267 ], [ 273, 275 ], [ 279 ], [ 281 ] ]
15,144
static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb) { int i; int a= 2<<s->sprite_warping_accuracy; int rho= 3-s->sprite_warping_accuracy; int r=16/a; const int vop_ref[4][2]= {{0,0}, {s->width,0}, {0, s->height}, {s->width, s->height}}; // only true for rectangle shapes int d[4][2]={{0,0}, {0,0}, {0,0}, {0,0}}; int sprite_ref[4][2]; int virtual_ref[2][2]; int w2, h2, w3, h3; int alpha=0, beta=0; int w= s->width; int h= s->height; int min_ab; for(i=0; i<s->num_sprite_warping_points; i++){ int length; int x=0, y=0; length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); if(length){ x= get_xbits(gb, length); } if(!(s->divx_version==500 && s->divx_build==413)) skip_bits1(gb); /* marker bit */ length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); if(length){ y=get_xbits(gb, length); } skip_bits1(gb); /* marker bit */ s->sprite_traj[i][0]= d[i][0]= x; s->sprite_traj[i][1]= d[i][1]= y; } for(; i<4; i++) s->sprite_traj[i][0]= s->sprite_traj[i][1]= 0; while((1<<alpha)<w) alpha++; while((1<<beta )<h) beta++; // there seems to be a typo in the mpeg4 std for the definition of w' and h' w2= 1<<alpha; h2= 1<<beta; // Note, the 4th point isn't used for GMC if(s->divx_version==500 && s->divx_build==413){ sprite_ref[0][0]= a*vop_ref[0][0] + d[0][0]; sprite_ref[0][1]= a*vop_ref[0][1] + d[0][1]; sprite_ref[1][0]= a*vop_ref[1][0] + d[0][0] + d[1][0]; sprite_ref[1][1]= a*vop_ref[1][1] + d[0][1] + d[1][1]; sprite_ref[2][0]= a*vop_ref[2][0] + d[0][0] + d[2][0]; sprite_ref[2][1]= a*vop_ref[2][1] + d[0][1] + d[2][1]; } else { sprite_ref[0][0]= (a>>1)*(2*vop_ref[0][0] + d[0][0]); sprite_ref[0][1]= (a>>1)*(2*vop_ref[0][1] + d[0][1]); sprite_ref[1][0]= (a>>1)*(2*vop_ref[1][0] + d[0][0] + d[1][0]); sprite_ref[1][1]= (a>>1)*(2*vop_ref[1][1] + d[0][1] + d[1][1]); sprite_ref[2][0]= (a>>1)*(2*vop_ref[2][0] + d[0][0] + d[2][0]); sprite_ref[2][1]= (a>>1)*(2*vop_ref[2][1] + d[0][1] + d[2][1]); } /* sprite_ref[3][0]= (a>>1)*(2*vop_ref[3][0] + d[0][0] + d[1][0] + d[2][0] + d[3][0]); sprite_ref[3][1]= (a>>1)*(2*vop_ref[3][1] + d[0][1] + d[1][1] + d[2][1] + d[3][1]); */ // this is mostly identical to the mpeg4 std (and is totally unreadable because of that ...) // perhaps it should be reordered to be more readable ... // the idea behind this virtual_ref mess is to be able to use shifts later per pixel instead of divides // so the distance between points is converted from w&h based to w2&h2 based which are of the 2^x form virtual_ref[0][0]= 16*(vop_ref[0][0] + w2) + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + w2*(r*sprite_ref[1][0] - 16*vop_ref[1][0])),w); virtual_ref[0][1]= 16*vop_ref[0][1] + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + w2*(r*sprite_ref[1][1] - 16*vop_ref[1][1])),w); virtual_ref[1][0]= 16*vop_ref[0][0] + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + h2*(r*sprite_ref[2][0] - 16*vop_ref[2][0])),h); virtual_ref[1][1]= 16*(vop_ref[0][1] + h2) + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + h2*(r*sprite_ref[2][1] - 16*vop_ref[2][1])),h); switch(s->num_sprite_warping_points) { case 0: s->sprite_offset[0][0]= 0; s->sprite_offset[0][1]= 0; s->sprite_offset[1][0]= 0; s->sprite_offset[1][1]= 0; s->sprite_delta[0][0]= a; s->sprite_delta[0][1]= 0; s->sprite_delta[1][0]= 0; s->sprite_delta[1][1]= a; s->sprite_shift[0]= 0; s->sprite_shift[1]= 0; break; case 1: //GMC only s->sprite_offset[0][0]= sprite_ref[0][0] - a*vop_ref[0][0]; s->sprite_offset[0][1]= sprite_ref[0][1] - a*vop_ref[0][1]; s->sprite_offset[1][0]= ((sprite_ref[0][0]>>1)|(sprite_ref[0][0]&1)) - a*(vop_ref[0][0]/2); s->sprite_offset[1][1]= ((sprite_ref[0][1]>>1)|(sprite_ref[0][1]&1)) - a*(vop_ref[0][1]/2); s->sprite_delta[0][0]= a; s->sprite_delta[0][1]= 0; s->sprite_delta[1][0]= 0; s->sprite_delta[1][1]= a; s->sprite_shift[0]= 0; s->sprite_shift[1]= 0; break; case 2: s->sprite_offset[0][0]= (sprite_ref[0][0]<<(alpha+rho)) + (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-vop_ref[0][0]) + ( r*sprite_ref[0][1] - virtual_ref[0][1])*(-vop_ref[0][1]) + (1<<(alpha+rho-1)); s->sprite_offset[0][1]= (sprite_ref[0][1]<<(alpha+rho)) + (-r*sprite_ref[0][1] + virtual_ref[0][1])*(-vop_ref[0][0]) + (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-vop_ref[0][1]) + (1<<(alpha+rho-1)); s->sprite_offset[1][0]= ( (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-2*vop_ref[0][0] + 1) +( r*sprite_ref[0][1] - virtual_ref[0][1])*(-2*vop_ref[0][1] + 1) +2*w2*r*sprite_ref[0][0] - 16*w2 + (1<<(alpha+rho+1))); s->sprite_offset[1][1]= ( (-r*sprite_ref[0][1] + virtual_ref[0][1])*(-2*vop_ref[0][0] + 1) +(-r*sprite_ref[0][0] + virtual_ref[0][0])*(-2*vop_ref[0][1] + 1) +2*w2*r*sprite_ref[0][1] - 16*w2 + (1<<(alpha+rho+1))); s->sprite_delta[0][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0]); s->sprite_delta[0][1]= (+r*sprite_ref[0][1] - virtual_ref[0][1]); s->sprite_delta[1][0]= (-r*sprite_ref[0][1] + virtual_ref[0][1]); s->sprite_delta[1][1]= (-r*sprite_ref[0][0] + virtual_ref[0][0]); s->sprite_shift[0]= alpha+rho; s->sprite_shift[1]= alpha+rho+2; break; case 3: min_ab= FFMIN(alpha, beta); w3= w2>>min_ab; h3= h2>>min_ab; s->sprite_offset[0][0]= (sprite_ref[0][0]<<(alpha+beta+rho-min_ab)) + (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3*(-vop_ref[0][0]) + (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3*(-vop_ref[0][1]) + (1<<(alpha+beta+rho-min_ab-1)); s->sprite_offset[0][1]= (sprite_ref[0][1]<<(alpha+beta+rho-min_ab)) + (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3*(-vop_ref[0][0]) + (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3*(-vop_ref[0][1]) + (1<<(alpha+beta+rho-min_ab-1)); s->sprite_offset[1][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3*(-2*vop_ref[0][0] + 1) + (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3*(-2*vop_ref[0][1] + 1) + 2*w2*h3*r*sprite_ref[0][0] - 16*w2*h3 + (1<<(alpha+beta+rho-min_ab+1)); s->sprite_offset[1][1]= (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3*(-2*vop_ref[0][0] + 1) + (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3*(-2*vop_ref[0][1] + 1) + 2*w2*h3*r*sprite_ref[0][1] - 16*w2*h3 + (1<<(alpha+beta+rho-min_ab+1)); s->sprite_delta[0][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3; s->sprite_delta[0][1]= (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3; s->sprite_delta[1][0]= (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3; s->sprite_delta[1][1]= (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3; s->sprite_shift[0]= alpha + beta + rho - min_ab; s->sprite_shift[1]= alpha + beta + rho - min_ab + 2; break; } /* try to simplify the situation */ if( s->sprite_delta[0][0] == a<<s->sprite_shift[0] && s->sprite_delta[0][1] == 0 && s->sprite_delta[1][0] == 0 && s->sprite_delta[1][1] == a<<s->sprite_shift[0]) { s->sprite_offset[0][0]>>=s->sprite_shift[0]; s->sprite_offset[0][1]>>=s->sprite_shift[0]; s->sprite_offset[1][0]>>=s->sprite_shift[1]; s->sprite_offset[1][1]>>=s->sprite_shift[1]; s->sprite_delta[0][0]= a; s->sprite_delta[0][1]= 0; s->sprite_delta[1][0]= 0; s->sprite_delta[1][1]= a; s->sprite_shift[0]= 0; s->sprite_shift[1]= 0; s->real_sprite_warping_points=1; } else{ int shift_y= 16 - s->sprite_shift[0]; int shift_c= 16 - s->sprite_shift[1]; for(i=0; i<2; i++){ s->sprite_offset[0][i]<<= shift_y; s->sprite_offset[1][i]<<= shift_c; s->sprite_delta[0][i]<<= shift_y; s->sprite_delta[1][i]<<= shift_y; s->sprite_shift[i]= 16; } s->real_sprite_warping_points= s->num_sprite_warping_points; } }
true
FFmpeg
fc5c49ab3247533e0a5cb203cf7122143389eb5c
static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb) { int i; int a= 2<<s->sprite_warping_accuracy; int rho= 3-s->sprite_warping_accuracy; int r=16/a; const int vop_ref[4][2]= {{0,0}, {s->width,0}, {0, s->height}, {s->width, s->height}}; int d[4][2]={{0,0}, {0,0}, {0,0}, {0,0}}; int sprite_ref[4][2]; int virtual_ref[2][2]; int w2, h2, w3, h3; int alpha=0, beta=0; int w= s->width; int h= s->height; int min_ab; for(i=0; i<s->num_sprite_warping_points; i++){ int length; int x=0, y=0; length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); if(length){ x= get_xbits(gb, length); } if(!(s->divx_version==500 && s->divx_build==413)) skip_bits1(gb); length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); if(length){ y=get_xbits(gb, length); } skip_bits1(gb); s->sprite_traj[i][0]= d[i][0]= x; s->sprite_traj[i][1]= d[i][1]= y; } for(; i<4; i++) s->sprite_traj[i][0]= s->sprite_traj[i][1]= 0; while((1<<alpha)<w) alpha++; while((1<<beta )<h) beta++; w2= 1<<alpha; h2= 1<<beta; if(s->divx_version==500 && s->divx_build==413){ sprite_ref[0][0]= a*vop_ref[0][0] + d[0][0]; sprite_ref[0][1]= a*vop_ref[0][1] + d[0][1]; sprite_ref[1][0]= a*vop_ref[1][0] + d[0][0] + d[1][0]; sprite_ref[1][1]= a*vop_ref[1][1] + d[0][1] + d[1][1]; sprite_ref[2][0]= a*vop_ref[2][0] + d[0][0] + d[2][0]; sprite_ref[2][1]= a*vop_ref[2][1] + d[0][1] + d[2][1]; } else { sprite_ref[0][0]= (a>>1)*(2*vop_ref[0][0] + d[0][0]); sprite_ref[0][1]= (a>>1)*(2*vop_ref[0][1] + d[0][1]); sprite_ref[1][0]= (a>>1)*(2*vop_ref[1][0] + d[0][0] + d[1][0]); sprite_ref[1][1]= (a>>1)*(2*vop_ref[1][1] + d[0][1] + d[1][1]); sprite_ref[2][0]= (a>>1)*(2*vop_ref[2][0] + d[0][0] + d[2][0]); sprite_ref[2][1]= (a>>1)*(2*vop_ref[2][1] + d[0][1] + d[2][1]); } virtual_ref[0][0]= 16*(vop_ref[0][0] + w2) + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + w2*(r*sprite_ref[1][0] - 16*vop_ref[1][0])),w); virtual_ref[0][1]= 16*vop_ref[0][1] + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + w2*(r*sprite_ref[1][1] - 16*vop_ref[1][1])),w); virtual_ref[1][0]= 16*vop_ref[0][0] + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + h2*(r*sprite_ref[2][0] - 16*vop_ref[2][0])),h); virtual_ref[1][1]= 16*(vop_ref[0][1] + h2) + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + h2*(r*sprite_ref[2][1] - 16*vop_ref[2][1])),h); switch(s->num_sprite_warping_points) { case 0: s->sprite_offset[0][0]= 0; s->sprite_offset[0][1]= 0; s->sprite_offset[1][0]= 0; s->sprite_offset[1][1]= 0; s->sprite_delta[0][0]= a; s->sprite_delta[0][1]= 0; s->sprite_delta[1][0]= 0; s->sprite_delta[1][1]= a; s->sprite_shift[0]= 0; s->sprite_shift[1]= 0; break; case 1: s->sprite_offset[0][0]= sprite_ref[0][0] - a*vop_ref[0][0]; s->sprite_offset[0][1]= sprite_ref[0][1] - a*vop_ref[0][1]; s->sprite_offset[1][0]= ((sprite_ref[0][0]>>1)|(sprite_ref[0][0]&1)) - a*(vop_ref[0][0]/2); s->sprite_offset[1][1]= ((sprite_ref[0][1]>>1)|(sprite_ref[0][1]&1)) - a*(vop_ref[0][1]/2); s->sprite_delta[0][0]= a; s->sprite_delta[0][1]= 0; s->sprite_delta[1][0]= 0; s->sprite_delta[1][1]= a; s->sprite_shift[0]= 0; s->sprite_shift[1]= 0; break; case 2: s->sprite_offset[0][0]= (sprite_ref[0][0]<<(alpha+rho)) + (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-vop_ref[0][0]) + ( r*sprite_ref[0][1] - virtual_ref[0][1])*(-vop_ref[0][1]) + (1<<(alpha+rho-1)); s->sprite_offset[0][1]= (sprite_ref[0][1]<<(alpha+rho)) + (-r*sprite_ref[0][1] + virtual_ref[0][1])*(-vop_ref[0][0]) + (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-vop_ref[0][1]) + (1<<(alpha+rho-1)); s->sprite_offset[1][0]= ( (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-2*vop_ref[0][0] + 1) +( r*sprite_ref[0][1] - virtual_ref[0][1])*(-2*vop_ref[0][1] + 1) +2*w2*r*sprite_ref[0][0] - 16*w2 + (1<<(alpha+rho+1))); s->sprite_offset[1][1]= ( (-r*sprite_ref[0][1] + virtual_ref[0][1])*(-2*vop_ref[0][0] + 1) +(-r*sprite_ref[0][0] + virtual_ref[0][0])*(-2*vop_ref[0][1] + 1) +2*w2*r*sprite_ref[0][1] - 16*w2 + (1<<(alpha+rho+1))); s->sprite_delta[0][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0]); s->sprite_delta[0][1]= (+r*sprite_ref[0][1] - virtual_ref[0][1]); s->sprite_delta[1][0]= (-r*sprite_ref[0][1] + virtual_ref[0][1]); s->sprite_delta[1][1]= (-r*sprite_ref[0][0] + virtual_ref[0][0]); s->sprite_shift[0]= alpha+rho; s->sprite_shift[1]= alpha+rho+2; break; case 3: min_ab= FFMIN(alpha, beta); w3= w2>>min_ab; h3= h2>>min_ab; s->sprite_offset[0][0]= (sprite_ref[0][0]<<(alpha+beta+rho-min_ab)) + (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3*(-vop_ref[0][0]) + (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3*(-vop_ref[0][1]) + (1<<(alpha+beta+rho-min_ab-1)); s->sprite_offset[0][1]= (sprite_ref[0][1]<<(alpha+beta+rho-min_ab)) + (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3*(-vop_ref[0][0]) + (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3*(-vop_ref[0][1]) + (1<<(alpha+beta+rho-min_ab-1)); s->sprite_offset[1][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3*(-2*vop_ref[0][0] + 1) + (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3*(-2*vop_ref[0][1] + 1) + 2*w2*h3*r*sprite_ref[0][0] - 16*w2*h3 + (1<<(alpha+beta+rho-min_ab+1)); s->sprite_offset[1][1]= (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3*(-2*vop_ref[0][0] + 1) + (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3*(-2*vop_ref[0][1] + 1) + 2*w2*h3*r*sprite_ref[0][1] - 16*w2*h3 + (1<<(alpha+beta+rho-min_ab+1)); s->sprite_delta[0][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3; s->sprite_delta[0][1]= (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3; s->sprite_delta[1][0]= (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3; s->sprite_delta[1][1]= (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3; s->sprite_shift[0]= alpha + beta + rho - min_ab; s->sprite_shift[1]= alpha + beta + rho - min_ab + 2; break; } if( s->sprite_delta[0][0] == a<<s->sprite_shift[0] && s->sprite_delta[0][1] == 0 && s->sprite_delta[1][0] == 0 && s->sprite_delta[1][1] == a<<s->sprite_shift[0]) { s->sprite_offset[0][0]>>=s->sprite_shift[0]; s->sprite_offset[0][1]>>=s->sprite_shift[0]; s->sprite_offset[1][0]>>=s->sprite_shift[1]; s->sprite_offset[1][1]>>=s->sprite_shift[1]; s->sprite_delta[0][0]= a; s->sprite_delta[0][1]= 0; s->sprite_delta[1][0]= 0; s->sprite_delta[1][1]= a; s->sprite_shift[0]= 0; s->sprite_shift[1]= 0; s->real_sprite_warping_points=1; } else{ int shift_y= 16 - s->sprite_shift[0]; int shift_c= 16 - s->sprite_shift[1]; for(i=0; i<2; i++){ s->sprite_offset[0][i]<<= shift_y; s->sprite_offset[1][i]<<= shift_c; s->sprite_delta[0][i]<<= shift_y; s->sprite_delta[1][i]<<= shift_y; s->sprite_shift[i]= 16; } s->real_sprite_warping_points= s->num_sprite_warping_points; } }
{ "code": [ "static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb)" ], "line_no": [ 1 ] }
static void FUNC_0(MpegEncContext * VAR_0, GetBitContext *VAR_1) { int VAR_2; int VAR_3= 2<<VAR_0->sprite_warping_accuracy; int VAR_4= 3-VAR_0->sprite_warping_accuracy; int VAR_5=16/VAR_3; const int VAR_6[4][2]= {{0,0}, {VAR_0->width,0}, {0, VAR_0->height}, {VAR_0->width, VAR_0->height}}; int VAR_7[4][2]={{0,0}, {0,0}, {0,0}, {0,0}}; int VAR_8[4][2]; int VAR_9[2][2]; int VAR_10, VAR_11, VAR_12, VAR_13; int VAR_14=0, VAR_15=0; int VAR_16= VAR_0->width; int VAR_17= VAR_0->height; int VAR_18; for(VAR_2=0; VAR_2<VAR_0->num_sprite_warping_points; VAR_2++){ int length; int x=0, y=0; length= get_vlc2(VAR_1, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); if(length){ x= get_xbits(VAR_1, length); } if(!(VAR_0->divx_version==500 && VAR_0->divx_build==413)) skip_bits1(VAR_1); length= get_vlc2(VAR_1, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); if(length){ y=get_xbits(VAR_1, length); } skip_bits1(VAR_1); VAR_0->sprite_traj[VAR_2][0]= VAR_7[VAR_2][0]= x; VAR_0->sprite_traj[VAR_2][1]= VAR_7[VAR_2][1]= y; } for(; VAR_2<4; VAR_2++) VAR_0->sprite_traj[VAR_2][0]= VAR_0->sprite_traj[VAR_2][1]= 0; while((1<<VAR_14)<VAR_16) VAR_14++; while((1<<VAR_15 )<VAR_17) VAR_15++; VAR_10= 1<<VAR_14; VAR_11= 1<<VAR_15; if(VAR_0->divx_version==500 && VAR_0->divx_build==413){ VAR_8[0][0]= VAR_3*VAR_6[0][0] + VAR_7[0][0]; VAR_8[0][1]= VAR_3*VAR_6[0][1] + VAR_7[0][1]; VAR_8[1][0]= VAR_3*VAR_6[1][0] + VAR_7[0][0] + VAR_7[1][0]; VAR_8[1][1]= VAR_3*VAR_6[1][1] + VAR_7[0][1] + VAR_7[1][1]; VAR_8[2][0]= VAR_3*VAR_6[2][0] + VAR_7[0][0] + VAR_7[2][0]; VAR_8[2][1]= VAR_3*VAR_6[2][1] + VAR_7[0][1] + VAR_7[2][1]; } else { VAR_8[0][0]= (VAR_3>>1)*(2*VAR_6[0][0] + VAR_7[0][0]); VAR_8[0][1]= (VAR_3>>1)*(2*VAR_6[0][1] + VAR_7[0][1]); VAR_8[1][0]= (VAR_3>>1)*(2*VAR_6[1][0] + VAR_7[0][0] + VAR_7[1][0]); VAR_8[1][1]= (VAR_3>>1)*(2*VAR_6[1][1] + VAR_7[0][1] + VAR_7[1][1]); VAR_8[2][0]= (VAR_3>>1)*(2*VAR_6[2][0] + VAR_7[0][0] + VAR_7[2][0]); VAR_8[2][1]= (VAR_3>>1)*(2*VAR_6[2][1] + VAR_7[0][1] + VAR_7[2][1]); } VAR_9[0][0]= 16*(VAR_6[0][0] + VAR_10) + ROUNDED_DIV(((VAR_16 - VAR_10)*(VAR_5*VAR_8[0][0] - 16*VAR_6[0][0]) + VAR_10*(VAR_5*VAR_8[1][0] - 16*VAR_6[1][0])),VAR_16); VAR_9[0][1]= 16*VAR_6[0][1] + ROUNDED_DIV(((VAR_16 - VAR_10)*(VAR_5*VAR_8[0][1] - 16*VAR_6[0][1]) + VAR_10*(VAR_5*VAR_8[1][1] - 16*VAR_6[1][1])),VAR_16); VAR_9[1][0]= 16*VAR_6[0][0] + ROUNDED_DIV(((VAR_17 - VAR_11)*(VAR_5*VAR_8[0][0] - 16*VAR_6[0][0]) + VAR_11*(VAR_5*VAR_8[2][0] - 16*VAR_6[2][0])),VAR_17); VAR_9[1][1]= 16*(VAR_6[0][1] + VAR_11) + ROUNDED_DIV(((VAR_17 - VAR_11)*(VAR_5*VAR_8[0][1] - 16*VAR_6[0][1]) + VAR_11*(VAR_5*VAR_8[2][1] - 16*VAR_6[2][1])),VAR_17); switch(VAR_0->num_sprite_warping_points) { case 0: VAR_0->sprite_offset[0][0]= 0; VAR_0->sprite_offset[0][1]= 0; VAR_0->sprite_offset[1][0]= 0; VAR_0->sprite_offset[1][1]= 0; VAR_0->sprite_delta[0][0]= VAR_3; VAR_0->sprite_delta[0][1]= 0; VAR_0->sprite_delta[1][0]= 0; VAR_0->sprite_delta[1][1]= VAR_3; VAR_0->sprite_shift[0]= 0; VAR_0->sprite_shift[1]= 0; break; case 1: VAR_0->sprite_offset[0][0]= VAR_8[0][0] - VAR_3*VAR_6[0][0]; VAR_0->sprite_offset[0][1]= VAR_8[0][1] - VAR_3*VAR_6[0][1]; VAR_0->sprite_offset[1][0]= ((VAR_8[0][0]>>1)|(VAR_8[0][0]&1)) - VAR_3*(VAR_6[0][0]/2); VAR_0->sprite_offset[1][1]= ((VAR_8[0][1]>>1)|(VAR_8[0][1]&1)) - VAR_3*(VAR_6[0][1]/2); VAR_0->sprite_delta[0][0]= VAR_3; VAR_0->sprite_delta[0][1]= 0; VAR_0->sprite_delta[1][0]= 0; VAR_0->sprite_delta[1][1]= VAR_3; VAR_0->sprite_shift[0]= 0; VAR_0->sprite_shift[1]= 0; break; case 2: VAR_0->sprite_offset[0][0]= (VAR_8[0][0]<<(VAR_14+VAR_4)) + (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*(-VAR_6[0][0]) + ( VAR_5*VAR_8[0][1] - VAR_9[0][1])*(-VAR_6[0][1]) + (1<<(VAR_14+VAR_4-1)); VAR_0->sprite_offset[0][1]= (VAR_8[0][1]<<(VAR_14+VAR_4)) + (-VAR_5*VAR_8[0][1] + VAR_9[0][1])*(-VAR_6[0][0]) + (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*(-VAR_6[0][1]) + (1<<(VAR_14+VAR_4-1)); VAR_0->sprite_offset[1][0]= ( (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*(-2*VAR_6[0][0] + 1) +( VAR_5*VAR_8[0][1] - VAR_9[0][1])*(-2*VAR_6[0][1] + 1) +2*VAR_10*VAR_5*VAR_8[0][0] - 16*VAR_10 + (1<<(VAR_14+VAR_4+1))); VAR_0->sprite_offset[1][1]= ( (-VAR_5*VAR_8[0][1] + VAR_9[0][1])*(-2*VAR_6[0][0] + 1) +(-VAR_5*VAR_8[0][0] + VAR_9[0][0])*(-2*VAR_6[0][1] + 1) +2*VAR_10*VAR_5*VAR_8[0][1] - 16*VAR_10 + (1<<(VAR_14+VAR_4+1))); VAR_0->sprite_delta[0][0]= (-VAR_5*VAR_8[0][0] + VAR_9[0][0]); VAR_0->sprite_delta[0][1]= (+VAR_5*VAR_8[0][1] - VAR_9[0][1]); VAR_0->sprite_delta[1][0]= (-VAR_5*VAR_8[0][1] + VAR_9[0][1]); VAR_0->sprite_delta[1][1]= (-VAR_5*VAR_8[0][0] + VAR_9[0][0]); VAR_0->sprite_shift[0]= VAR_14+VAR_4; VAR_0->sprite_shift[1]= VAR_14+VAR_4+2; break; case 3: VAR_18= FFMIN(VAR_14, VAR_15); VAR_12= VAR_10>>VAR_18; VAR_13= VAR_11>>VAR_18; VAR_0->sprite_offset[0][0]= (VAR_8[0][0]<<(VAR_14+VAR_15+VAR_4-VAR_18)) + (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*VAR_13*(-VAR_6[0][0]) + (-VAR_5*VAR_8[0][0] + VAR_9[1][0])*VAR_12*(-VAR_6[0][1]) + (1<<(VAR_14+VAR_15+VAR_4-VAR_18-1)); VAR_0->sprite_offset[0][1]= (VAR_8[0][1]<<(VAR_14+VAR_15+VAR_4-VAR_18)) + (-VAR_5*VAR_8[0][1] + VAR_9[0][1])*VAR_13*(-VAR_6[0][0]) + (-VAR_5*VAR_8[0][1] + VAR_9[1][1])*VAR_12*(-VAR_6[0][1]) + (1<<(VAR_14+VAR_15+VAR_4-VAR_18-1)); VAR_0->sprite_offset[1][0]= (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*VAR_13*(-2*VAR_6[0][0] + 1) + (-VAR_5*VAR_8[0][0] + VAR_9[1][0])*VAR_12*(-2*VAR_6[0][1] + 1) + 2*VAR_10*VAR_13*VAR_5*VAR_8[0][0] - 16*VAR_10*VAR_13 + (1<<(VAR_14+VAR_15+VAR_4-VAR_18+1)); VAR_0->sprite_offset[1][1]= (-VAR_5*VAR_8[0][1] + VAR_9[0][1])*VAR_13*(-2*VAR_6[0][0] + 1) + (-VAR_5*VAR_8[0][1] + VAR_9[1][1])*VAR_12*(-2*VAR_6[0][1] + 1) + 2*VAR_10*VAR_13*VAR_5*VAR_8[0][1] - 16*VAR_10*VAR_13 + (1<<(VAR_14+VAR_15+VAR_4-VAR_18+1)); VAR_0->sprite_delta[0][0]= (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*VAR_13; VAR_0->sprite_delta[0][1]= (-VAR_5*VAR_8[0][0] + VAR_9[1][0])*VAR_12; VAR_0->sprite_delta[1][0]= (-VAR_5*VAR_8[0][1] + VAR_9[0][1])*VAR_13; VAR_0->sprite_delta[1][1]= (-VAR_5*VAR_8[0][1] + VAR_9[1][1])*VAR_12; VAR_0->sprite_shift[0]= VAR_14 + VAR_15 + VAR_4 - VAR_18; VAR_0->sprite_shift[1]= VAR_14 + VAR_15 + VAR_4 - VAR_18 + 2; break; } if( VAR_0->sprite_delta[0][0] == VAR_3<<VAR_0->sprite_shift[0] && VAR_0->sprite_delta[0][1] == 0 && VAR_0->sprite_delta[1][0] == 0 && VAR_0->sprite_delta[1][1] == VAR_3<<VAR_0->sprite_shift[0]) { VAR_0->sprite_offset[0][0]>>=VAR_0->sprite_shift[0]; VAR_0->sprite_offset[0][1]>>=VAR_0->sprite_shift[0]; VAR_0->sprite_offset[1][0]>>=VAR_0->sprite_shift[1]; VAR_0->sprite_offset[1][1]>>=VAR_0->sprite_shift[1]; VAR_0->sprite_delta[0][0]= VAR_3; VAR_0->sprite_delta[0][1]= 0; VAR_0->sprite_delta[1][0]= 0; VAR_0->sprite_delta[1][1]= VAR_3; VAR_0->sprite_shift[0]= 0; VAR_0->sprite_shift[1]= 0; VAR_0->real_sprite_warping_points=1; } else{ int VAR_19= 16 - VAR_0->sprite_shift[0]; int VAR_20= 16 - VAR_0->sprite_shift[1]; for(VAR_2=0; VAR_2<2; VAR_2++){ VAR_0->sprite_offset[0][VAR_2]<<= VAR_19; VAR_0->sprite_offset[1][VAR_2]<<= VAR_20; VAR_0->sprite_delta[0][VAR_2]<<= VAR_19; VAR_0->sprite_delta[1][VAR_2]<<= VAR_19; VAR_0->sprite_shift[VAR_2]= 16; } VAR_0->real_sprite_warping_points= VAR_0->num_sprite_warping_points; } }
[ "static void FUNC_0(MpegEncContext * VAR_0, GetBitContext *VAR_1)\n{", "int VAR_2;", "int VAR_3= 2<<VAR_0->sprite_warping_accuracy;", "int VAR_4= 3-VAR_0->sprite_warping_accuracy;", "int VAR_5=16/VAR_3;", "const int VAR_6[4][2]= {{0,0}, {VAR_0->width,0}, {0, VAR_0->height}, {VAR_0->width, VAR_0->height}};", "int VAR_7[4][2]={{0,0}, {0,0}, {0,0}, {0,0}};", "int VAR_8[4][2];", "int VAR_9[2][2];", "int VAR_10, VAR_11, VAR_12, VAR_13;", "int VAR_14=0, VAR_15=0;", "int VAR_16= VAR_0->width;", "int VAR_17= VAR_0->height;", "int VAR_18;", "for(VAR_2=0; VAR_2<VAR_0->num_sprite_warping_points; VAR_2++){", "int length;", "int x=0, y=0;", "length= get_vlc2(VAR_1, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);", "if(length){", "x= get_xbits(VAR_1, length);", "}", "if(!(VAR_0->divx_version==500 && VAR_0->divx_build==413)) skip_bits1(VAR_1);", "length= get_vlc2(VAR_1, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3);", "if(length){", "y=get_xbits(VAR_1, length);", "}", "skip_bits1(VAR_1);", "VAR_0->sprite_traj[VAR_2][0]= VAR_7[VAR_2][0]= x;", "VAR_0->sprite_traj[VAR_2][1]= VAR_7[VAR_2][1]= y;", "}", "for(; VAR_2<4; VAR_2++)", "VAR_0->sprite_traj[VAR_2][0]= VAR_0->sprite_traj[VAR_2][1]= 0;", "while((1<<VAR_14)<VAR_16) VAR_14++;", "while((1<<VAR_15 )<VAR_17) VAR_15++;", "VAR_10= 1<<VAR_14;", "VAR_11= 1<<VAR_15;", "if(VAR_0->divx_version==500 && VAR_0->divx_build==413){", "VAR_8[0][0]= VAR_3*VAR_6[0][0] + VAR_7[0][0];", "VAR_8[0][1]= VAR_3*VAR_6[0][1] + VAR_7[0][1];", "VAR_8[1][0]= VAR_3*VAR_6[1][0] + VAR_7[0][0] + VAR_7[1][0];", "VAR_8[1][1]= VAR_3*VAR_6[1][1] + VAR_7[0][1] + VAR_7[1][1];", "VAR_8[2][0]= VAR_3*VAR_6[2][0] + VAR_7[0][0] + VAR_7[2][0];", "VAR_8[2][1]= VAR_3*VAR_6[2][1] + VAR_7[0][1] + VAR_7[2][1];", "} else {", "VAR_8[0][0]= (VAR_3>>1)*(2*VAR_6[0][0] + VAR_7[0][0]);", "VAR_8[0][1]= (VAR_3>>1)*(2*VAR_6[0][1] + VAR_7[0][1]);", "VAR_8[1][0]= (VAR_3>>1)*(2*VAR_6[1][0] + VAR_7[0][0] + VAR_7[1][0]);", "VAR_8[1][1]= (VAR_3>>1)*(2*VAR_6[1][1] + VAR_7[0][1] + VAR_7[1][1]);", "VAR_8[2][0]= (VAR_3>>1)*(2*VAR_6[2][0] + VAR_7[0][0] + VAR_7[2][0]);", "VAR_8[2][1]= (VAR_3>>1)*(2*VAR_6[2][1] + VAR_7[0][1] + VAR_7[2][1]);", "}", "VAR_9[0][0]= 16*(VAR_6[0][0] + VAR_10)\n+ ROUNDED_DIV(((VAR_16 - VAR_10)*(VAR_5*VAR_8[0][0] - 16*VAR_6[0][0]) + VAR_10*(VAR_5*VAR_8[1][0] - 16*VAR_6[1][0])),VAR_16);", "VAR_9[0][1]= 16*VAR_6[0][1]\n+ ROUNDED_DIV(((VAR_16 - VAR_10)*(VAR_5*VAR_8[0][1] - 16*VAR_6[0][1]) + VAR_10*(VAR_5*VAR_8[1][1] - 16*VAR_6[1][1])),VAR_16);", "VAR_9[1][0]= 16*VAR_6[0][0]\n+ ROUNDED_DIV(((VAR_17 - VAR_11)*(VAR_5*VAR_8[0][0] - 16*VAR_6[0][0]) + VAR_11*(VAR_5*VAR_8[2][0] - 16*VAR_6[2][0])),VAR_17);", "VAR_9[1][1]= 16*(VAR_6[0][1] + VAR_11)\n+ ROUNDED_DIV(((VAR_17 - VAR_11)*(VAR_5*VAR_8[0][1] - 16*VAR_6[0][1]) + VAR_11*(VAR_5*VAR_8[2][1] - 16*VAR_6[2][1])),VAR_17);", "switch(VAR_0->num_sprite_warping_points)\n{", "case 0:\nVAR_0->sprite_offset[0][0]= 0;", "VAR_0->sprite_offset[0][1]= 0;", "VAR_0->sprite_offset[1][0]= 0;", "VAR_0->sprite_offset[1][1]= 0;", "VAR_0->sprite_delta[0][0]= VAR_3;", "VAR_0->sprite_delta[0][1]= 0;", "VAR_0->sprite_delta[1][0]= 0;", "VAR_0->sprite_delta[1][1]= VAR_3;", "VAR_0->sprite_shift[0]= 0;", "VAR_0->sprite_shift[1]= 0;", "break;", "case 1:\nVAR_0->sprite_offset[0][0]= VAR_8[0][0] - VAR_3*VAR_6[0][0];", "VAR_0->sprite_offset[0][1]= VAR_8[0][1] - VAR_3*VAR_6[0][1];", "VAR_0->sprite_offset[1][0]= ((VAR_8[0][0]>>1)|(VAR_8[0][0]&1)) - VAR_3*(VAR_6[0][0]/2);", "VAR_0->sprite_offset[1][1]= ((VAR_8[0][1]>>1)|(VAR_8[0][1]&1)) - VAR_3*(VAR_6[0][1]/2);", "VAR_0->sprite_delta[0][0]= VAR_3;", "VAR_0->sprite_delta[0][1]= 0;", "VAR_0->sprite_delta[1][0]= 0;", "VAR_0->sprite_delta[1][1]= VAR_3;", "VAR_0->sprite_shift[0]= 0;", "VAR_0->sprite_shift[1]= 0;", "break;", "case 2:\nVAR_0->sprite_offset[0][0]= (VAR_8[0][0]<<(VAR_14+VAR_4))\n+ (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*(-VAR_6[0][0])\n+ ( VAR_5*VAR_8[0][1] - VAR_9[0][1])*(-VAR_6[0][1])\n+ (1<<(VAR_14+VAR_4-1));", "VAR_0->sprite_offset[0][1]= (VAR_8[0][1]<<(VAR_14+VAR_4))\n+ (-VAR_5*VAR_8[0][1] + VAR_9[0][1])*(-VAR_6[0][0])\n+ (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*(-VAR_6[0][1])\n+ (1<<(VAR_14+VAR_4-1));", "VAR_0->sprite_offset[1][0]= ( (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*(-2*VAR_6[0][0] + 1)\n+( VAR_5*VAR_8[0][1] - VAR_9[0][1])*(-2*VAR_6[0][1] + 1)\n+2*VAR_10*VAR_5*VAR_8[0][0]\n- 16*VAR_10\n+ (1<<(VAR_14+VAR_4+1)));", "VAR_0->sprite_offset[1][1]= ( (-VAR_5*VAR_8[0][1] + VAR_9[0][1])*(-2*VAR_6[0][0] + 1)\n+(-VAR_5*VAR_8[0][0] + VAR_9[0][0])*(-2*VAR_6[0][1] + 1)\n+2*VAR_10*VAR_5*VAR_8[0][1]\n- 16*VAR_10\n+ (1<<(VAR_14+VAR_4+1)));", "VAR_0->sprite_delta[0][0]= (-VAR_5*VAR_8[0][0] + VAR_9[0][0]);", "VAR_0->sprite_delta[0][1]= (+VAR_5*VAR_8[0][1] - VAR_9[0][1]);", "VAR_0->sprite_delta[1][0]= (-VAR_5*VAR_8[0][1] + VAR_9[0][1]);", "VAR_0->sprite_delta[1][1]= (-VAR_5*VAR_8[0][0] + VAR_9[0][0]);", "VAR_0->sprite_shift[0]= VAR_14+VAR_4;", "VAR_0->sprite_shift[1]= VAR_14+VAR_4+2;", "break;", "case 3:\nVAR_18= FFMIN(VAR_14, VAR_15);", "VAR_12= VAR_10>>VAR_18;", "VAR_13= VAR_11>>VAR_18;", "VAR_0->sprite_offset[0][0]= (VAR_8[0][0]<<(VAR_14+VAR_15+VAR_4-VAR_18))\n+ (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*VAR_13*(-VAR_6[0][0])\n+ (-VAR_5*VAR_8[0][0] + VAR_9[1][0])*VAR_12*(-VAR_6[0][1])\n+ (1<<(VAR_14+VAR_15+VAR_4-VAR_18-1));", "VAR_0->sprite_offset[0][1]= (VAR_8[0][1]<<(VAR_14+VAR_15+VAR_4-VAR_18))\n+ (-VAR_5*VAR_8[0][1] + VAR_9[0][1])*VAR_13*(-VAR_6[0][0])\n+ (-VAR_5*VAR_8[0][1] + VAR_9[1][1])*VAR_12*(-VAR_6[0][1])\n+ (1<<(VAR_14+VAR_15+VAR_4-VAR_18-1));", "VAR_0->sprite_offset[1][0]= (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*VAR_13*(-2*VAR_6[0][0] + 1)\n+ (-VAR_5*VAR_8[0][0] + VAR_9[1][0])*VAR_12*(-2*VAR_6[0][1] + 1)\n+ 2*VAR_10*VAR_13*VAR_5*VAR_8[0][0]\n- 16*VAR_10*VAR_13\n+ (1<<(VAR_14+VAR_15+VAR_4-VAR_18+1));", "VAR_0->sprite_offset[1][1]= (-VAR_5*VAR_8[0][1] + VAR_9[0][1])*VAR_13*(-2*VAR_6[0][0] + 1)\n+ (-VAR_5*VAR_8[0][1] + VAR_9[1][1])*VAR_12*(-2*VAR_6[0][1] + 1)\n+ 2*VAR_10*VAR_13*VAR_5*VAR_8[0][1]\n- 16*VAR_10*VAR_13\n+ (1<<(VAR_14+VAR_15+VAR_4-VAR_18+1));", "VAR_0->sprite_delta[0][0]= (-VAR_5*VAR_8[0][0] + VAR_9[0][0])*VAR_13;", "VAR_0->sprite_delta[0][1]= (-VAR_5*VAR_8[0][0] + VAR_9[1][0])*VAR_12;", "VAR_0->sprite_delta[1][0]= (-VAR_5*VAR_8[0][1] + VAR_9[0][1])*VAR_13;", "VAR_0->sprite_delta[1][1]= (-VAR_5*VAR_8[0][1] + VAR_9[1][1])*VAR_12;", "VAR_0->sprite_shift[0]= VAR_14 + VAR_15 + VAR_4 - VAR_18;", "VAR_0->sprite_shift[1]= VAR_14 + VAR_15 + VAR_4 - VAR_18 + 2;", "break;", "}", "if( VAR_0->sprite_delta[0][0] == VAR_3<<VAR_0->sprite_shift[0]\n&& VAR_0->sprite_delta[0][1] == 0\n&& VAR_0->sprite_delta[1][0] == 0\n&& VAR_0->sprite_delta[1][1] == VAR_3<<VAR_0->sprite_shift[0])\n{", "VAR_0->sprite_offset[0][0]>>=VAR_0->sprite_shift[0];", "VAR_0->sprite_offset[0][1]>>=VAR_0->sprite_shift[0];", "VAR_0->sprite_offset[1][0]>>=VAR_0->sprite_shift[1];", "VAR_0->sprite_offset[1][1]>>=VAR_0->sprite_shift[1];", "VAR_0->sprite_delta[0][0]= VAR_3;", "VAR_0->sprite_delta[0][1]= 0;", "VAR_0->sprite_delta[1][0]= 0;", "VAR_0->sprite_delta[1][1]= VAR_3;", "VAR_0->sprite_shift[0]= 0;", "VAR_0->sprite_shift[1]= 0;", "VAR_0->real_sprite_warping_points=1;", "}", "else{", "int VAR_19= 16 - VAR_0->sprite_shift[0];", "int VAR_20= 16 - VAR_0->sprite_shift[1];", "for(VAR_2=0; VAR_2<2; VAR_2++){", "VAR_0->sprite_offset[0][VAR_2]<<= VAR_19;", "VAR_0->sprite_offset[1][VAR_2]<<= VAR_20;", "VAR_0->sprite_delta[0][VAR_2]<<= VAR_19;", "VAR_0->sprite_delta[1][VAR_2]<<= VAR_19;", "VAR_0->sprite_shift[VAR_2]= 16;", "}", "VAR_0->real_sprite_warping_points= VAR_0->num_sprite_warping_points;", "}", "}" ]
[ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 131, 133 ], [ 135, 137 ], [ 139, 141 ], [ 143, 145 ], [ 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 ], [ 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 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 319, 321, 323, 325, 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 365 ], [ 367 ], [ 369 ], [ 371 ], [ 373 ], [ 375 ], [ 377 ] ]
15,145
static int parse(AVCodecParserContext *ctx, AVCodecContext *avctx, const uint8_t **out_data, int *out_size, const uint8_t *data, int size) { VP9ParseContext *s = ctx->priv_data; int full_size = size; int marker; if (size <= 0) { *out_size = 0; *out_data = data; return 0; } if (s->n_frames > 0) { *out_data = data; *out_size = s->size[--s->n_frames]; parse_frame(ctx, *out_data, *out_size); return s->n_frames > 0 ? *out_size : size /* i.e. include idx tail */; } marker = data[size - 1]; if ((marker & 0xe0) == 0xc0) { int nbytes = 1 + ((marker >> 3) & 0x3); int n_frames = 1 + (marker & 0x7), idx_sz = 2 + n_frames * nbytes; if (size >= idx_sz && data[size - idx_sz] == marker) { const uint8_t *idx = data + size + 1 - idx_sz; int first = 1; switch (nbytes) { #define case_n(a, rd) \ case a: \ while (n_frames--) { \ unsigned sz = rd; \ idx += a; \ if (sz > size) { \ s->n_frames = 0; \ *out_size = size; \ *out_data = data; \ av_log(avctx, AV_LOG_ERROR, \ "Superframe packet size too big: %u > %d\n", \ sz, size); \ return full_size; \ } \ if (first) { \ first = 0; \ *out_data = data; \ *out_size = sz; \ s->n_frames = n_frames; \ } else { \ s->size[n_frames] = sz; \ } \ data += sz; \ size -= sz; \ } \ parse_frame(ctx, *out_data, *out_size); \ return *out_size case_n(1, *idx); case_n(2, AV_RL16(idx)); case_n(3, AV_RL24(idx)); case_n(4, AV_RL32(idx)); } } } *out_data = data; *out_size = size; parse_frame(ctx, data, size); return size; }
true
FFmpeg
7b4367d93ea2a34baeab2c734630df5e0f11d4c1
static int parse(AVCodecParserContext *ctx, AVCodecContext *avctx, const uint8_t **out_data, int *out_size, const uint8_t *data, int size) { VP9ParseContext *s = ctx->priv_data; int full_size = size; int marker; if (size <= 0) { *out_size = 0; *out_data = data; return 0; } if (s->n_frames > 0) { *out_data = data; *out_size = s->size[--s->n_frames]; parse_frame(ctx, *out_data, *out_size); return s->n_frames > 0 ? *out_size : size ; } marker = data[size - 1]; if ((marker & 0xe0) == 0xc0) { int nbytes = 1 + ((marker >> 3) & 0x3); int n_frames = 1 + (marker & 0x7), idx_sz = 2 + n_frames * nbytes; if (size >= idx_sz && data[size - idx_sz] == marker) { const uint8_t *idx = data + size + 1 - idx_sz; int first = 1; switch (nbytes) { #define case_n(a, rd) \ case a: \ while (n_frames--) { \ unsigned sz = rd; \ idx += a; \ if (sz > size) { \ s->n_frames = 0; \ *out_size = size; \ *out_data = data; \ av_log(avctx, AV_LOG_ERROR, \ "Superframe packet size too big: %u > %d\n", \ sz, size); \ return full_size; \ } \ if (first) { \ first = 0; \ *out_data = data; \ *out_size = sz; \ s->n_frames = n_frames; \ } else { \ s->size[n_frames] = sz; \ } \ data += sz; \ size -= sz; \ } \ parse_frame(ctx, *out_data, *out_size); \ return *out_size case_n(1, *idx); case_n(2, AV_RL16(idx)); case_n(3, AV_RL24(idx)); case_n(4, AV_RL32(idx)); } } } *out_data = data; *out_size = size; parse_frame(ctx, data, size); return size; }
{ "code": [ " if (sz > size) { \\", " \"Superframe packet size too big: %u > %d\\n\", \\" ], "line_no": [ 79, 89 ] }
static int FUNC_0(AVCodecParserContext *VAR_0, AVCodecContext *VAR_1, const uint8_t **VAR_2, int *VAR_3, const uint8_t *VAR_4, int VAR_5) { VP9ParseContext *s = VAR_0->priv_data; int VAR_6 = VAR_5; int VAR_7; if (VAR_5 <= 0) { *VAR_3 = 0; *VAR_2 = VAR_4; return 0; } if (s->VAR_9 > 0) { *VAR_2 = VAR_4; *VAR_3 = s->VAR_5[--s->VAR_9]; parse_frame(VAR_0, *VAR_2, *VAR_3); return s->VAR_9 > 0 ? *VAR_3 : VAR_5 ; } VAR_7 = VAR_4[VAR_5 - 1]; if ((VAR_7 & 0xe0) == 0xc0) { int VAR_8 = 1 + ((VAR_7 >> 3) & 0x3); int VAR_9 = 1 + (VAR_7 & 0x7), VAR_10 = 2 + VAR_9 * VAR_8; if (VAR_5 >= VAR_10 && VAR_4[VAR_5 - VAR_10] == VAR_7) { const uint8_t *VAR_11 = VAR_4 + VAR_5 + 1 - VAR_10; int VAR_12 = 1; switch (VAR_8) { #define case_n(a, rd) \ case a: \ while (VAR_9--) { \ unsigned VAR_13 = rd; \ VAR_11 += a; \ if (VAR_13 > VAR_5) { \ s->VAR_9 = 0; \ *VAR_3 = VAR_5; \ *VAR_2 = VAR_4; \ av_log(VAR_1, AV_LOG_ERROR, \ "Superframe packet VAR_5 too big: %u > %d\n", \ VAR_13, VAR_5); \ return VAR_6; \ } \ if (VAR_12) { \ VAR_12 = 0; \ *VAR_2 = VAR_4; \ *VAR_3 = VAR_13; \ s->VAR_9 = VAR_9; \ } else { \ s->VAR_5[VAR_9] = VAR_13; \ } \ VAR_4 += VAR_13; \ VAR_5 -= VAR_13; \ } \ parse_frame(VAR_0, *VAR_2, *VAR_3); \ return *VAR_3 case_n(1, *VAR_11); case_n(2, AV_RL16(VAR_11)); case_n(3, AV_RL24(VAR_11)); case_n(4, AV_RL32(VAR_11)); } } } *VAR_2 = VAR_4; *VAR_3 = VAR_5; parse_frame(VAR_0, VAR_4, VAR_5); return VAR_5; }
[ "static int FUNC_0(AVCodecParserContext *VAR_0,\nAVCodecContext *VAR_1,\nconst uint8_t **VAR_2, int *VAR_3,\nconst uint8_t *VAR_4, int VAR_5)\n{", "VP9ParseContext *s = VAR_0->priv_data;", "int VAR_6 = VAR_5;", "int VAR_7;", "if (VAR_5 <= 0) {", "*VAR_3 = 0;", "*VAR_2 = VAR_4;", "return 0;", "}", "if (s->VAR_9 > 0) {", "*VAR_2 = VAR_4;", "*VAR_3 = s->VAR_5[--s->VAR_9];", "parse_frame(VAR_0, *VAR_2, *VAR_3);", "return s->VAR_9 > 0 ? *VAR_3 : VAR_5 ;", "}", "VAR_7 = VAR_4[VAR_5 - 1];", "if ((VAR_7 & 0xe0) == 0xc0) {", "int VAR_8 = 1 + ((VAR_7 >> 3) & 0x3);", "int VAR_9 = 1 + (VAR_7 & 0x7), VAR_10 = 2 + VAR_9 * VAR_8;", "if (VAR_5 >= VAR_10 && VAR_4[VAR_5 - VAR_10] == VAR_7) {", "const uint8_t *VAR_11 = VAR_4 + VAR_5 + 1 - VAR_10;", "int VAR_12 = 1;", "switch (VAR_8) {", "#define case_n(a, rd) \\\ncase a: \\\nwhile (VAR_9--) { \\", "unsigned VAR_13 = rd; \\", "VAR_11 += a; \\", "if (VAR_13 > VAR_5) { \\", "s->VAR_9 = 0; \\", "*VAR_3 = VAR_5; \\", "*VAR_2 = VAR_4; \\", "av_log(VAR_1, AV_LOG_ERROR, \\\n\"Superframe packet VAR_5 too big: %u > %d\\n\", \\\nVAR_13, VAR_5); \\", "return VAR_6; \\", "} \\", "if (VAR_12) { \\", "VAR_12 = 0; \\", "*VAR_2 = VAR_4; \\", "*VAR_3 = VAR_13; \\", "s->VAR_9 = VAR_9; \\", "} else { \\", "s->VAR_5[VAR_9] = VAR_13; \\", "} \\", "VAR_4 += VAR_13; \\", "VAR_5 -= VAR_13; \\", "} \\", "parse_frame(VAR_0, *VAR_2, *VAR_3); \\", "return *VAR_3\ncase_n(1, *VAR_11);", "case_n(2, AV_RL16(VAR_11));", "case_n(3, AV_RL24(VAR_11));", "case_n(4, AV_RL32(VAR_11));", "}", "}", "}", "*VAR_2 = VAR_4;", "*VAR_3 = VAR_5;", "parse_frame(VAR_0, VAR_4, VAR_5);", "return 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, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69, 71, 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87, 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151 ] ]
15,146
void axisdev88_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; CRISCPU *cpu; CPUCRISState *env; DeviceState *dev; SysBusDevice *s; DriveInfo *nand; qemu_irq irq[30], nmi[2]; void *etraxfs_dmac; struct etraxfs_dma_client *dma_eth; int i; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *phys_ram = g_new(MemoryRegion, 1); MemoryRegion *phys_intmem = g_new(MemoryRegion, 1); /* init CPUs */ if (cpu_model == NULL) { cpu_model = "crisv32"; } cpu = cpu_cris_init(cpu_model); env = &cpu->env; /* allocate RAM */ memory_region_allocate_system_memory(phys_ram, NULL, "axisdev88.ram", ram_size); memory_region_add_subregion(address_space_mem, 0x40000000, phys_ram); /* The ETRAX-FS has 128Kb on chip ram, the docs refer to it as the internal memory. */ memory_region_init_ram(phys_intmem, NULL, "axisdev88.chipram", INTMEM_SIZE, &error_abort); vmstate_register_ram_global(phys_intmem); memory_region_add_subregion(address_space_mem, 0x38000000, phys_intmem); /* Attach a NAND flash to CS1. */ nand = drive_get(IF_MTD, 0, 0); nand_state.nand = nand_init(nand ? blk_by_legacy_dinfo(nand) : NULL, NAND_MFR_STMICRO, 0x39); memory_region_init_io(&nand_state.iomem, NULL, &nand_ops, &nand_state, "nand", 0x05000000); memory_region_add_subregion(address_space_mem, 0x10000000, &nand_state.iomem); gpio_state.nand = &nand_state; memory_region_init_io(&gpio_state.iomem, NULL, &gpio_ops, &gpio_state, "gpio", 0x5c); memory_region_add_subregion(address_space_mem, 0x3001a000, &gpio_state.iomem); dev = qdev_create(NULL, "etraxfs,pic"); /* FIXME: Is there a proper way to signal vectors to the CPU core? */ qdev_prop_set_ptr(dev, "interrupt_vector", &env->interrupt_vector); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); sysbus_mmio_map(s, 0, 0x3001c000); sysbus_connect_irq(s, 0, qdev_get_gpio_in(DEVICE(cpu), CRIS_CPU_IRQ)); sysbus_connect_irq(s, 1, qdev_get_gpio_in(DEVICE(cpu), CRIS_CPU_NMI)); for (i = 0; i < 30; i++) { irq[i] = qdev_get_gpio_in(dev, i); } nmi[0] = qdev_get_gpio_in(dev, 30); nmi[1] = qdev_get_gpio_in(dev, 31); etraxfs_dmac = etraxfs_dmac_init(0x30000000, 10); for (i = 0; i < 10; i++) { /* On ETRAX, odd numbered channels are inputs. */ etraxfs_dmac_connect(etraxfs_dmac, i, irq + 7 + i, i & 1); } /* Add the two ethernet blocks. */ dma_eth = g_malloc0(sizeof dma_eth[0] * 4); /* Allocate 4 channels. */ etraxfs_eth_init(&nd_table[0], 0x30034000, 1, &dma_eth[0], &dma_eth[1]); if (nb_nics > 1) { etraxfs_eth_init(&nd_table[1], 0x30036000, 2, &dma_eth[2], &dma_eth[3]); } /* The DMA Connector block is missing, hardwire things for now. */ etraxfs_dmac_connect_client(etraxfs_dmac, 0, &dma_eth[0]); etraxfs_dmac_connect_client(etraxfs_dmac, 1, &dma_eth[1]); if (nb_nics > 1) { etraxfs_dmac_connect_client(etraxfs_dmac, 6, &dma_eth[2]); etraxfs_dmac_connect_client(etraxfs_dmac, 7, &dma_eth[3]); } /* 2 timers. */ sysbus_create_varargs("etraxfs,timer", 0x3001e000, irq[0x1b], nmi[1], NULL); sysbus_create_varargs("etraxfs,timer", 0x3005e000, irq[0x1b], nmi[1], NULL); for (i = 0; i < 4; i++) { sysbus_create_simple("etraxfs,serial", 0x30026000 + i * 0x2000, irq[0x14 + i]); } if (kernel_filename) { li.image_filename = kernel_filename; li.cmdline = kernel_cmdline; cris_load_image(cpu, &li); } else if (!qtest_enabled()) { fprintf(stderr, "Kernel image must be specified\n"); exit(1); } }
true
qemu
f8ed85ac992c48814d916d5df4d44f9a971c5de4
void axisdev88_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; CRISCPU *cpu; CPUCRISState *env; DeviceState *dev; SysBusDevice *s; DriveInfo *nand; qemu_irq irq[30], nmi[2]; void *etraxfs_dmac; struct etraxfs_dma_client *dma_eth; int i; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *phys_ram = g_new(MemoryRegion, 1); MemoryRegion *phys_intmem = g_new(MemoryRegion, 1); if (cpu_model == NULL) { cpu_model = "crisv32"; } cpu = cpu_cris_init(cpu_model); env = &cpu->env; memory_region_allocate_system_memory(phys_ram, NULL, "axisdev88.ram", ram_size); memory_region_add_subregion(address_space_mem, 0x40000000, phys_ram); memory_region_init_ram(phys_intmem, NULL, "axisdev88.chipram", INTMEM_SIZE, &error_abort); vmstate_register_ram_global(phys_intmem); memory_region_add_subregion(address_space_mem, 0x38000000, phys_intmem); nand = drive_get(IF_MTD, 0, 0); nand_state.nand = nand_init(nand ? blk_by_legacy_dinfo(nand) : NULL, NAND_MFR_STMICRO, 0x39); memory_region_init_io(&nand_state.iomem, NULL, &nand_ops, &nand_state, "nand", 0x05000000); memory_region_add_subregion(address_space_mem, 0x10000000, &nand_state.iomem); gpio_state.nand = &nand_state; memory_region_init_io(&gpio_state.iomem, NULL, &gpio_ops, &gpio_state, "gpio", 0x5c); memory_region_add_subregion(address_space_mem, 0x3001a000, &gpio_state.iomem); dev = qdev_create(NULL, "etraxfs,pic"); qdev_prop_set_ptr(dev, "interrupt_vector", &env->interrupt_vector); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); sysbus_mmio_map(s, 0, 0x3001c000); sysbus_connect_irq(s, 0, qdev_get_gpio_in(DEVICE(cpu), CRIS_CPU_IRQ)); sysbus_connect_irq(s, 1, qdev_get_gpio_in(DEVICE(cpu), CRIS_CPU_NMI)); for (i = 0; i < 30; i++) { irq[i] = qdev_get_gpio_in(dev, i); } nmi[0] = qdev_get_gpio_in(dev, 30); nmi[1] = qdev_get_gpio_in(dev, 31); etraxfs_dmac = etraxfs_dmac_init(0x30000000, 10); for (i = 0; i < 10; i++) { etraxfs_dmac_connect(etraxfs_dmac, i, irq + 7 + i, i & 1); } dma_eth = g_malloc0(sizeof dma_eth[0] * 4); etraxfs_eth_init(&nd_table[0], 0x30034000, 1, &dma_eth[0], &dma_eth[1]); if (nb_nics > 1) { etraxfs_eth_init(&nd_table[1], 0x30036000, 2, &dma_eth[2], &dma_eth[3]); } etraxfs_dmac_connect_client(etraxfs_dmac, 0, &dma_eth[0]); etraxfs_dmac_connect_client(etraxfs_dmac, 1, &dma_eth[1]); if (nb_nics > 1) { etraxfs_dmac_connect_client(etraxfs_dmac, 6, &dma_eth[2]); etraxfs_dmac_connect_client(etraxfs_dmac, 7, &dma_eth[3]); } sysbus_create_varargs("etraxfs,timer", 0x3001e000, irq[0x1b], nmi[1], NULL); sysbus_create_varargs("etraxfs,timer", 0x3005e000, irq[0x1b], nmi[1], NULL); for (i = 0; i < 4; i++) { sysbus_create_simple("etraxfs,serial", 0x30026000 + i * 0x2000, irq[0x14 + i]); } if (kernel_filename) { li.image_filename = kernel_filename; li.cmdline = kernel_cmdline; cris_load_image(cpu, &li); } else if (!qtest_enabled()) { fprintf(stderr, "Kernel image must be specified\n"); exit(1); } }
{ "code": [ " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);", " &error_abort);" ], "line_no": [ 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69 ] }
void FUNC_0(MachineState *VAR_0) { ram_addr_t ram_size = VAR_0->ram_size; const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; CRISCPU *cpu; CPUCRISState *env; DeviceState *dev; SysBusDevice *s; DriveInfo *nand; qemu_irq irq[30], nmi[2]; void *VAR_4; struct etraxfs_dma_client *VAR_5; int VAR_6; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *phys_ram = g_new(MemoryRegion, 1); MemoryRegion *phys_intmem = g_new(MemoryRegion, 1); if (VAR_1 == NULL) { VAR_1 = "crisv32"; } cpu = cpu_cris_init(VAR_1); env = &cpu->env; memory_region_allocate_system_memory(phys_ram, NULL, "axisdev88.ram", ram_size); memory_region_add_subregion(address_space_mem, 0x40000000, phys_ram); memory_region_init_ram(phys_intmem, NULL, "axisdev88.chipram", INTMEM_SIZE, &error_abort); vmstate_register_ram_global(phys_intmem); memory_region_add_subregion(address_space_mem, 0x38000000, phys_intmem); nand = drive_get(IF_MTD, 0, 0); nand_state.nand = nand_init(nand ? blk_by_legacy_dinfo(nand) : NULL, NAND_MFR_STMICRO, 0x39); memory_region_init_io(&nand_state.iomem, NULL, &nand_ops, &nand_state, "nand", 0x05000000); memory_region_add_subregion(address_space_mem, 0x10000000, &nand_state.iomem); gpio_state.nand = &nand_state; memory_region_init_io(&gpio_state.iomem, NULL, &gpio_ops, &gpio_state, "gpio", 0x5c); memory_region_add_subregion(address_space_mem, 0x3001a000, &gpio_state.iomem); dev = qdev_create(NULL, "etraxfs,pic"); qdev_prop_set_ptr(dev, "interrupt_vector", &env->interrupt_vector); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); sysbus_mmio_map(s, 0, 0x3001c000); sysbus_connect_irq(s, 0, qdev_get_gpio_in(DEVICE(cpu), CRIS_CPU_IRQ)); sysbus_connect_irq(s, 1, qdev_get_gpio_in(DEVICE(cpu), CRIS_CPU_NMI)); for (VAR_6 = 0; VAR_6 < 30; VAR_6++) { irq[VAR_6] = qdev_get_gpio_in(dev, VAR_6); } nmi[0] = qdev_get_gpio_in(dev, 30); nmi[1] = qdev_get_gpio_in(dev, 31); VAR_4 = etraxfs_dmac_init(0x30000000, 10); for (VAR_6 = 0; VAR_6 < 10; VAR_6++) { etraxfs_dmac_connect(VAR_4, VAR_6, irq + 7 + VAR_6, VAR_6 & 1); } VAR_5 = g_malloc0(sizeof VAR_5[0] * 4); etraxfs_eth_init(&nd_table[0], 0x30034000, 1, &VAR_5[0], &VAR_5[1]); if (nb_nics > 1) { etraxfs_eth_init(&nd_table[1], 0x30036000, 2, &VAR_5[2], &VAR_5[3]); } etraxfs_dmac_connect_client(VAR_4, 0, &VAR_5[0]); etraxfs_dmac_connect_client(VAR_4, 1, &VAR_5[1]); if (nb_nics > 1) { etraxfs_dmac_connect_client(VAR_4, 6, &VAR_5[2]); etraxfs_dmac_connect_client(VAR_4, 7, &VAR_5[3]); } sysbus_create_varargs("etraxfs,timer", 0x3001e000, irq[0x1b], nmi[1], NULL); sysbus_create_varargs("etraxfs,timer", 0x3005e000, irq[0x1b], nmi[1], NULL); for (VAR_6 = 0; VAR_6 < 4; VAR_6++) { sysbus_create_simple("etraxfs,serial", 0x30026000 + VAR_6 * 0x2000, irq[0x14 + VAR_6]); } if (VAR_2) { li.image_filename = VAR_2; li.cmdline = VAR_3; cris_load_image(cpu, &li); } else if (!qtest_enabled()) { fprintf(stderr, "Kernel image must be specified\n"); exit(1); } }
[ "void FUNC_0(MachineState *VAR_0)\n{", "ram_addr_t ram_size = VAR_0->ram_size;", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "const char *VAR_3 = VAR_0->VAR_3;", "CRISCPU *cpu;", "CPUCRISState *env;", "DeviceState *dev;", "SysBusDevice *s;", "DriveInfo *nand;", "qemu_irq irq[30], nmi[2];", "void *VAR_4;", "struct etraxfs_dma_client *VAR_5;", "int VAR_6;", "MemoryRegion *address_space_mem = get_system_memory();", "MemoryRegion *phys_ram = g_new(MemoryRegion, 1);", "MemoryRegion *phys_intmem = g_new(MemoryRegion, 1);", "if (VAR_1 == NULL) {", "VAR_1 = \"crisv32\";", "}", "cpu = cpu_cris_init(VAR_1);", "env = &cpu->env;", "memory_region_allocate_system_memory(phys_ram, NULL, \"axisdev88.ram\",\nram_size);", "memory_region_add_subregion(address_space_mem, 0x40000000, phys_ram);", "memory_region_init_ram(phys_intmem, NULL, \"axisdev88.chipram\", INTMEM_SIZE,\n&error_abort);", "vmstate_register_ram_global(phys_intmem);", "memory_region_add_subregion(address_space_mem, 0x38000000, phys_intmem);", "nand = drive_get(IF_MTD, 0, 0);", "nand_state.nand = nand_init(nand ? blk_by_legacy_dinfo(nand) : NULL,\nNAND_MFR_STMICRO, 0x39);", "memory_region_init_io(&nand_state.iomem, NULL, &nand_ops, &nand_state,\n\"nand\", 0x05000000);", "memory_region_add_subregion(address_space_mem, 0x10000000,\n&nand_state.iomem);", "gpio_state.nand = &nand_state;", "memory_region_init_io(&gpio_state.iomem, NULL, &gpio_ops, &gpio_state,\n\"gpio\", 0x5c);", "memory_region_add_subregion(address_space_mem, 0x3001a000,\n&gpio_state.iomem);", "dev = qdev_create(NULL, \"etraxfs,pic\");", "qdev_prop_set_ptr(dev, \"interrupt_vector\", &env->interrupt_vector);", "qdev_init_nofail(dev);", "s = SYS_BUS_DEVICE(dev);", "sysbus_mmio_map(s, 0, 0x3001c000);", "sysbus_connect_irq(s, 0, qdev_get_gpio_in(DEVICE(cpu), CRIS_CPU_IRQ));", "sysbus_connect_irq(s, 1, qdev_get_gpio_in(DEVICE(cpu), CRIS_CPU_NMI));", "for (VAR_6 = 0; VAR_6 < 30; VAR_6++) {", "irq[VAR_6] = qdev_get_gpio_in(dev, VAR_6);", "}", "nmi[0] = qdev_get_gpio_in(dev, 30);", "nmi[1] = qdev_get_gpio_in(dev, 31);", "VAR_4 = etraxfs_dmac_init(0x30000000, 10);", "for (VAR_6 = 0; VAR_6 < 10; VAR_6++) {", "etraxfs_dmac_connect(VAR_4, VAR_6, irq + 7 + VAR_6, VAR_6 & 1);", "}", "VAR_5 = g_malloc0(sizeof VAR_5[0] * 4);", "etraxfs_eth_init(&nd_table[0], 0x30034000, 1, &VAR_5[0], &VAR_5[1]);", "if (nb_nics > 1) {", "etraxfs_eth_init(&nd_table[1], 0x30036000, 2, &VAR_5[2], &VAR_5[3]);", "}", "etraxfs_dmac_connect_client(VAR_4, 0, &VAR_5[0]);", "etraxfs_dmac_connect_client(VAR_4, 1, &VAR_5[1]);", "if (nb_nics > 1) {", "etraxfs_dmac_connect_client(VAR_4, 6, &VAR_5[2]);", "etraxfs_dmac_connect_client(VAR_4, 7, &VAR_5[3]);", "}", "sysbus_create_varargs(\"etraxfs,timer\", 0x3001e000, irq[0x1b], nmi[1], NULL);", "sysbus_create_varargs(\"etraxfs,timer\", 0x3005e000, irq[0x1b], nmi[1], NULL);", "for (VAR_6 = 0; VAR_6 < 4; VAR_6++) {", "sysbus_create_simple(\"etraxfs,serial\", 0x30026000 + VAR_6 * 0x2000,\nirq[0x14 + VAR_6]);", "}", "if (VAR_2) {", "li.image_filename = VAR_2;", "li.cmdline = VAR_3;", "cris_load_image(cpu, &li);", "} else if (!qtest_enabled()) {", "fprintf(stderr, \"Kernel image must be specified\\n\");", "exit(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, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 55, 57 ], [ 59 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 79 ], [ 81, 83 ], [ 85, 87 ], [ 89, 91 ], [ 95 ], [ 97, 99 ], [ 101, 103 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 181 ], [ 183 ], [ 187 ], [ 189, 191 ], [ 193 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ] ]
15,148
static int mjpeg_decode_app(MJpegDecodeContext *s) { int len, id, i; len = get_bits(&s->gb, 16); if (len < 6) return AVERROR_INVALIDDATA; if (8 * len > get_bits_left(&s->gb)) return AVERROR_INVALIDDATA; id = get_bits_long(&s->gb, 32); len -= 6; if (s->avctx->debug & FF_DEBUG_STARTCODE) { char id_str[32]; av_get_codec_tag_string(id_str, sizeof(id_str), av_bswap32(id)); av_log(s->avctx, AV_LOG_DEBUG, "APPx (%s / %8X) len=%d\n", id_str, id, len); } /* Buggy AVID, it puts EOI only at every 10th frame. */ /* Also, this fourcc is used by non-avid files too, it holds some information, but it's always present in AVID-created files. */ if (id == AV_RB32("AVI1")) { /* structure: 4bytes AVI1 1bytes polarity 1bytes always zero 4bytes field_size 4bytes field_size_less_padding */ s->buggy_avid = 1; i = get_bits(&s->gb, 8); len--; av_log(s->avctx, AV_LOG_DEBUG, "polarity %d\n", i); #if 0 skip_bits(&s->gb, 8); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); len -= 10; #endif } // len -= 2; if (id == AV_RB32("JFIF")) { int t_w, t_h, v1, v2; skip_bits(&s->gb, 8); /* the trailing zero-byte */ v1 = get_bits(&s->gb, 8); v2 = get_bits(&s->gb, 8); skip_bits(&s->gb, 8); s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 16); s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 16); if ( s->avctx->sample_aspect_ratio.num <= 0 || s->avctx->sample_aspect_ratio.den <= 0) { s->avctx->sample_aspect_ratio.num = 0; s->avctx->sample_aspect_ratio.den = 1; } if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x) SAR=%d/%d\n", v1, v2, s->avctx->sample_aspect_ratio.num, s->avctx->sample_aspect_ratio.den); len -= 8; if (len >= 2) { t_w = get_bits(&s->gb, 8); t_h = get_bits(&s->gb, 8); if (t_w && t_h) { /* skip thumbnail */ if (len -10 - (t_w * t_h * 3) > 0) len -= t_w * t_h * 3; } len -= 2; } } if ( id == AV_RB32("Adob") && len >= 7 && show_bits(&s->gb, 8) == 'e' && show_bits_long(&s->gb, 32) != AV_RB32("e_CM")) { skip_bits(&s->gb, 8); /* 'e' */ skip_bits(&s->gb, 16); /* version */ skip_bits(&s->gb, 16); /* flags0 */ skip_bits(&s->gb, 16); /* flags1 */ s->adobe_transform = get_bits(&s->gb, 8); if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found, transform=%d\n", s->adobe_transform); len -= 7; } if (id == AV_RB32("LJIF")) { int rgb = s->rgb; int pegasus_rct = s->pegasus_rct; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n"); skip_bits(&s->gb, 16); /* version ? */ skip_bits(&s->gb, 16); /* unknown always 0? */ skip_bits(&s->gb, 16); /* unknown always 0? */ skip_bits(&s->gb, 16); /* unknown always 0? */ switch (i=get_bits(&s->gb, 8)) { case 1: rgb = 1; pegasus_rct = 0; break; case 2: rgb = 1; pegasus_rct = 1; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown colorspace %d\n", i); } len -= 9; if (s->got_picture) if (rgb != s->rgb || pegasus_rct != s->pegasus_rct) { av_log(s->avctx, AV_LOG_WARNING, "Mismatching LJIF tag\n"); } s->rgb = rgb; s->pegasus_rct = pegasus_rct; } if (id == AV_RL32("colr") && len > 0) { s->colr = get_bits(&s->gb, 8); if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "COLR %d\n", s->colr); len --; } if (id == AV_RL32("xfrm") && len > 0) { s->xfrm = get_bits(&s->gb, 8); if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "XFRM %d\n", s->xfrm); len --; } /* JPS extension by VRex */ if (s->start_code == APP3 && id == AV_RB32("_JPS") && len >= 10) { int flags, layout, type; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "_JPSJPS_\n"); skip_bits(&s->gb, 32); len -= 4; /* JPS_ */ skip_bits(&s->gb, 16); len -= 2; /* block length */ skip_bits(&s->gb, 8); /* reserved */ flags = get_bits(&s->gb, 8); layout = get_bits(&s->gb, 8); type = get_bits(&s->gb, 8); len -= 4; s->stereo3d = av_stereo3d_alloc(); if (!s->stereo3d) { } if (type == 0) { s->stereo3d->type = AV_STEREO3D_2D; } else if (type == 1) { switch (layout) { case 0x01: s->stereo3d->type = AV_STEREO3D_LINES; break; case 0x02: s->stereo3d->type = AV_STEREO3D_SIDEBYSIDE; break; case 0x03: s->stereo3d->type = AV_STEREO3D_TOPBOTTOM; break; } if (!(flags & 0x04)) { s->stereo3d->flags = AV_STEREO3D_FLAG_INVERT; } } } /* EXIF metadata */ if (s->start_code == APP1 && id == AV_RB32("Exif") && len >= 2) { GetByteContext gbytes; int ret, le, ifd_offset, bytes_read; const uint8_t *aligned; skip_bits(&s->gb, 16); // skip padding len -= 2; // init byte wise reading aligned = align_get_bits(&s->gb); bytestream2_init(&gbytes, aligned, len); // read TIFF header ret = ff_tdecode_header(&gbytes, &le, &ifd_offset); if (ret) { av_log(s->avctx, AV_LOG_ERROR, "mjpeg: invalid TIFF header in EXIF data\n"); } else { bytestream2_seek(&gbytes, ifd_offset, SEEK_SET); // read 0th IFD and store the metadata // (return values > 0 indicate the presence of subimage metadata) ret = avpriv_exif_decode_ifd(s->avctx, &gbytes, le, 0, &s->exif_metadata); if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error decoding EXIF data\n"); } } bytes_read = bytestream2_tell(&gbytes); skip_bits(&s->gb, bytes_read << 3); len -= bytes_read; } /* Apple MJPEG-A */ if ((s->start_code == APP1) && (len > (0x28 - 8))) { id = get_bits_long(&s->gb, 32); len -= 4; /* Apple MJPEG-A */ if (id == AV_RB32("mjpg")) { #if 0 skip_bits(&s->gb, 32); /* field size */ skip_bits(&s->gb, 32); /* pad field size */ skip_bits(&s->gb, 32); /* next off */ skip_bits(&s->gb, 32); /* quant off */ skip_bits(&s->gb, 32); /* huff off */ skip_bits(&s->gb, 32); /* image off */ skip_bits(&s->gb, 32); /* scan off */ skip_bits(&s->gb, 32); /* data off */ #endif if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: Apple MJPEG-A header found\n"); } } out: /* slow but needed for extreme adobe jpegs */ if (len < 0) av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error, decode_app parser read over the end\n"); while (--len > 0) skip_bits(&s->gb, 8); return 0; }
true
FFmpeg
4acea512f36b96256535b45b1a7e723c61c89c31
static int mjpeg_decode_app(MJpegDecodeContext *s) { int len, id, i; len = get_bits(&s->gb, 16); if (len < 6) return AVERROR_INVALIDDATA; if (8 * len > get_bits_left(&s->gb)) return AVERROR_INVALIDDATA; id = get_bits_long(&s->gb, 32); len -= 6; if (s->avctx->debug & FF_DEBUG_STARTCODE) { char id_str[32]; av_get_codec_tag_string(id_str, sizeof(id_str), av_bswap32(id)); av_log(s->avctx, AV_LOG_DEBUG, "APPx (%s / %8X) len=%d\n", id_str, id, len); } if (id == AV_RB32("AVI1")) { s->buggy_avid = 1; i = get_bits(&s->gb, 8); len--; av_log(s->avctx, AV_LOG_DEBUG, "polarity %d\n", i); #if 0 skip_bits(&s->gb, 8); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); len -= 10; #endif } if (id == AV_RB32("JFIF")) { int t_w, t_h, v1, v2; skip_bits(&s->gb, 8); v1 = get_bits(&s->gb, 8); v2 = get_bits(&s->gb, 8); skip_bits(&s->gb, 8); s->avctx->sample_aspect_ratio.num = get_bits(&s->gb, 16); s->avctx->sample_aspect_ratio.den = get_bits(&s->gb, 16); if ( s->avctx->sample_aspect_ratio.num <= 0 || s->avctx->sample_aspect_ratio.den <= 0) { s->avctx->sample_aspect_ratio.num = 0; s->avctx->sample_aspect_ratio.den = 1; } if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x) SAR=%d/%d\n", v1, v2, s->avctx->sample_aspect_ratio.num, s->avctx->sample_aspect_ratio.den); len -= 8; if (len >= 2) { t_w = get_bits(&s->gb, 8); t_h = get_bits(&s->gb, 8); if (t_w && t_h) { if (len -10 - (t_w * t_h * 3) > 0) len -= t_w * t_h * 3; } len -= 2; } } if ( id == AV_RB32("Adob") && len >= 7 && show_bits(&s->gb, 8) == 'e' && show_bits_long(&s->gb, 32) != AV_RB32("e_CM")) { skip_bits(&s->gb, 8); skip_bits(&s->gb, 16); skip_bits(&s->gb, 16); skip_bits(&s->gb, 16); s->adobe_transform = get_bits(&s->gb, 8); if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: Adobe header found, transform=%d\n", s->adobe_transform); len -= 7; } if (id == AV_RB32("LJIF")) { int rgb = s->rgb; int pegasus_rct = s->pegasus_rct; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n"); skip_bits(&s->gb, 16); skip_bits(&s->gb, 16); skip_bits(&s->gb, 16); skip_bits(&s->gb, 16); switch (i=get_bits(&s->gb, 8)) { case 1: rgb = 1; pegasus_rct = 0; break; case 2: rgb = 1; pegasus_rct = 1; break; default: av_log(s->avctx, AV_LOG_ERROR, "unknown colorspace %d\n", i); } len -= 9; if (s->got_picture) if (rgb != s->rgb || pegasus_rct != s->pegasus_rct) { av_log(s->avctx, AV_LOG_WARNING, "Mismatching LJIF tag\n"); } s->rgb = rgb; s->pegasus_rct = pegasus_rct; } if (id == AV_RL32("colr") && len > 0) { s->colr = get_bits(&s->gb, 8); if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "COLR %d\n", s->colr); len --; } if (id == AV_RL32("xfrm") && len > 0) { s->xfrm = get_bits(&s->gb, 8); if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "XFRM %d\n", s->xfrm); len --; } if (s->start_code == APP3 && id == AV_RB32("_JPS") && len >= 10) { int flags, layout, type; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "_JPSJPS_\n"); skip_bits(&s->gb, 32); len -= 4; skip_bits(&s->gb, 16); len -= 2; skip_bits(&s->gb, 8); flags = get_bits(&s->gb, 8); layout = get_bits(&s->gb, 8); type = get_bits(&s->gb, 8); len -= 4; s->stereo3d = av_stereo3d_alloc(); if (!s->stereo3d) { } if (type == 0) { s->stereo3d->type = AV_STEREO3D_2D; } else if (type == 1) { switch (layout) { case 0x01: s->stereo3d->type = AV_STEREO3D_LINES; break; case 0x02: s->stereo3d->type = AV_STEREO3D_SIDEBYSIDE; break; case 0x03: s->stereo3d->type = AV_STEREO3D_TOPBOTTOM; break; } if (!(flags & 0x04)) { s->stereo3d->flags = AV_STEREO3D_FLAG_INVERT; } } } if (s->start_code == APP1 && id == AV_RB32("Exif") && len >= 2) { GetByteContext gbytes; int ret, le, ifd_offset, bytes_read; const uint8_t *aligned; skip_bits(&s->gb, 16); len -= 2; aligned = align_get_bits(&s->gb); bytestream2_init(&gbytes, aligned, len); ret = ff_tdecode_header(&gbytes, &le, &ifd_offset); if (ret) { av_log(s->avctx, AV_LOG_ERROR, "mjpeg: invalid TIFF header in EXIF data\n"); } else { bytestream2_seek(&gbytes, ifd_offset, SEEK_SET); ret = avpriv_exif_decode_ifd(s->avctx, &gbytes, le, 0, &s->exif_metadata); if (ret < 0) { av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error decoding EXIF data\n"); } } bytes_read = bytestream2_tell(&gbytes); skip_bits(&s->gb, bytes_read << 3); len -= bytes_read; } if ((s->start_code == APP1) && (len > (0x28 - 8))) { id = get_bits_long(&s->gb, 32); len -= 4; if (id == AV_RB32("mjpg")) { #if 0 skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); skip_bits(&s->gb, 32); #endif if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, "mjpeg: Apple MJPEG-A header found\n"); } } out: if (len < 0) av_log(s->avctx, AV_LOG_ERROR, "mjpeg: error, decode_app parser read over the end\n"); while (--len > 0) skip_bits(&s->gb, 8); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(MJpegDecodeContext *VAR_0) { int VAR_1, VAR_2, VAR_3; VAR_1 = get_bits(&VAR_0->gb, 16); if (VAR_1 < 6) return AVERROR_INVALIDDATA; if (8 * VAR_1 > get_bits_left(&VAR_0->gb)) return AVERROR_INVALIDDATA; VAR_2 = get_bits_long(&VAR_0->gb, 32); VAR_1 -= 6; if (VAR_0->avctx->debug & FF_DEBUG_STARTCODE) { char VAR_4[32]; av_get_codec_tag_string(VAR_4, sizeof(VAR_4), av_bswap32(VAR_2)); av_log(VAR_0->avctx, AV_LOG_DEBUG, "APPx (%VAR_0 / %8X) VAR_1=%d\n", VAR_4, VAR_2, VAR_1); } if (VAR_2 == AV_RB32("AVI1")) { VAR_0->buggy_avid = 1; VAR_3 = get_bits(&VAR_0->gb, 8); VAR_1--; av_log(VAR_0->avctx, AV_LOG_DEBUG, "polarity %d\n", VAR_3); #if 0 skip_bits(&VAR_0->gb, 8); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); VAR_1 -= 10; #endif } if (VAR_2 == AV_RB32("JFIF")) { int VAR_5, VAR_6, VAR_7, VAR_8; skip_bits(&VAR_0->gb, 8); VAR_7 = get_bits(&VAR_0->gb, 8); VAR_8 = get_bits(&VAR_0->gb, 8); skip_bits(&VAR_0->gb, 8); VAR_0->avctx->sample_aspect_ratio.num = get_bits(&VAR_0->gb, 16); VAR_0->avctx->sample_aspect_ratio.den = get_bits(&VAR_0->gb, 16); if ( VAR_0->avctx->sample_aspect_ratio.num <= 0 || VAR_0->avctx->sample_aspect_ratio.den <= 0) { VAR_0->avctx->sample_aspect_ratio.num = 0; VAR_0->avctx->sample_aspect_ratio.den = 1; } if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "mjpeg: JFIF header found (version: %x.%x) SAR=%d/%d\n", VAR_7, VAR_8, VAR_0->avctx->sample_aspect_ratio.num, VAR_0->avctx->sample_aspect_ratio.den); VAR_1 -= 8; if (VAR_1 >= 2) { VAR_5 = get_bits(&VAR_0->gb, 8); VAR_6 = get_bits(&VAR_0->gb, 8); if (VAR_5 && VAR_6) { if (VAR_1 -10 - (VAR_5 * VAR_6 * 3) > 0) VAR_1 -= VAR_5 * VAR_6 * 3; } VAR_1 -= 2; } } if ( VAR_2 == AV_RB32("Adob") && VAR_1 >= 7 && show_bits(&VAR_0->gb, 8) == 'e' && show_bits_long(&VAR_0->gb, 32) != AV_RB32("e_CM")) { skip_bits(&VAR_0->gb, 8); skip_bits(&VAR_0->gb, 16); skip_bits(&VAR_0->gb, 16); skip_bits(&VAR_0->gb, 16); VAR_0->adobe_transform = get_bits(&VAR_0->gb, 8); if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "mjpeg: Adobe header found, transform=%d\n", VAR_0->adobe_transform); VAR_1 -= 7; } if (VAR_2 == AV_RB32("LJIF")) { int VAR_9 = VAR_0->VAR_9; int VAR_10 = VAR_0->VAR_10; if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "Pegasus lossless jpeg header found\n"); skip_bits(&VAR_0->gb, 16); skip_bits(&VAR_0->gb, 16); skip_bits(&VAR_0->gb, 16); skip_bits(&VAR_0->gb, 16); switch (VAR_3=get_bits(&VAR_0->gb, 8)) { case 1: VAR_9 = 1; VAR_10 = 0; break; case 2: VAR_9 = 1; VAR_10 = 1; break; default: av_log(VAR_0->avctx, AV_LOG_ERROR, "unknown colorspace %d\n", VAR_3); } VAR_1 -= 9; if (VAR_0->got_picture) if (VAR_9 != VAR_0->VAR_9 || VAR_10 != VAR_0->VAR_10) { av_log(VAR_0->avctx, AV_LOG_WARNING, "Mismatching LJIF tag\n"); } VAR_0->VAR_9 = VAR_9; VAR_0->VAR_10 = VAR_10; } if (VAR_2 == AV_RL32("colr") && VAR_1 > 0) { VAR_0->colr = get_bits(&VAR_0->gb, 8); if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "COLR %d\n", VAR_0->colr); VAR_1 --; } if (VAR_2 == AV_RL32("xfrm") && VAR_1 > 0) { VAR_0->xfrm = get_bits(&VAR_0->gb, 8); if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "XFRM %d\n", VAR_0->xfrm); VAR_1 --; } if (VAR_0->start_code == APP3 && VAR_2 == AV_RB32("_JPS") && VAR_1 >= 10) { int VAR_11, VAR_12, VAR_13; if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "_JPSJPS_\n"); skip_bits(&VAR_0->gb, 32); VAR_1 -= 4; skip_bits(&VAR_0->gb, 16); VAR_1 -= 2; skip_bits(&VAR_0->gb, 8); VAR_11 = get_bits(&VAR_0->gb, 8); VAR_12 = get_bits(&VAR_0->gb, 8); VAR_13 = get_bits(&VAR_0->gb, 8); VAR_1 -= 4; VAR_0->stereo3d = av_stereo3d_alloc(); if (!VAR_0->stereo3d) { } if (VAR_13 == 0) { VAR_0->stereo3d->VAR_13 = AV_STEREO3D_2D; } else if (VAR_13 == 1) { switch (VAR_12) { case 0x01: VAR_0->stereo3d->VAR_13 = AV_STEREO3D_LINES; break; case 0x02: VAR_0->stereo3d->VAR_13 = AV_STEREO3D_SIDEBYSIDE; break; case 0x03: VAR_0->stereo3d->VAR_13 = AV_STEREO3D_TOPBOTTOM; break; } if (!(VAR_11 & 0x04)) { VAR_0->stereo3d->VAR_11 = AV_STEREO3D_FLAG_INVERT; } } } if (VAR_0->start_code == APP1 && VAR_2 == AV_RB32("Exif") && VAR_1 >= 2) { GetByteContext gbytes; int VAR_14, VAR_15, VAR_16, VAR_17; const uint8_t *VAR_18; skip_bits(&VAR_0->gb, 16); VAR_1 -= 2; VAR_18 = align_get_bits(&VAR_0->gb); bytestream2_init(&gbytes, VAR_18, VAR_1); VAR_14 = ff_tdecode_header(&gbytes, &VAR_15, &VAR_16); if (VAR_14) { av_log(VAR_0->avctx, AV_LOG_ERROR, "mjpeg: invalid TIFF header in EXIF data\n"); } else { bytestream2_seek(&gbytes, VAR_16, SEEK_SET); VAR_14 = avpriv_exif_decode_ifd(VAR_0->avctx, &gbytes, VAR_15, 0, &VAR_0->exif_metadata); if (VAR_14 < 0) { av_log(VAR_0->avctx, AV_LOG_ERROR, "mjpeg: error decoding EXIF data\n"); } } VAR_17 = bytestream2_tell(&gbytes); skip_bits(&VAR_0->gb, VAR_17 << 3); VAR_1 -= VAR_17; } if ((VAR_0->start_code == APP1) && (VAR_1 > (0x28 - 8))) { VAR_2 = get_bits_long(&VAR_0->gb, 32); VAR_1 -= 4; if (VAR_2 == AV_RB32("mjpg")) { #if 0 skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); skip_bits(&VAR_0->gb, 32); #endif if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO) av_log(VAR_0->avctx, AV_LOG_INFO, "mjpeg: Apple MJPEG-A header found\n"); } } out: if (VAR_1 < 0) av_log(VAR_0->avctx, AV_LOG_ERROR, "mjpeg: error, decode_app parser read over the end\n"); while (--VAR_1 > 0) skip_bits(&VAR_0->gb, 8); return 0; }
[ "static int FUNC_0(MJpegDecodeContext *VAR_0)\n{", "int VAR_1, VAR_2, VAR_3;", "VAR_1 = get_bits(&VAR_0->gb, 16);", "if (VAR_1 < 6)\nreturn AVERROR_INVALIDDATA;", "if (8 * VAR_1 > get_bits_left(&VAR_0->gb))\nreturn AVERROR_INVALIDDATA;", "VAR_2 = get_bits_long(&VAR_0->gb, 32);", "VAR_1 -= 6;", "if (VAR_0->avctx->debug & FF_DEBUG_STARTCODE) {", "char VAR_4[32];", "av_get_codec_tag_string(VAR_4, sizeof(VAR_4), av_bswap32(VAR_2));", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"APPx (%VAR_0 / %8X) VAR_1=%d\\n\", VAR_4, VAR_2, VAR_1);", "}", "if (VAR_2 == AV_RB32(\"AVI1\")) {", "VAR_0->buggy_avid = 1;", "VAR_3 = get_bits(&VAR_0->gb, 8); VAR_1--;", "av_log(VAR_0->avctx, AV_LOG_DEBUG, \"polarity %d\\n\", VAR_3);", "#if 0\nskip_bits(&VAR_0->gb, 8);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "VAR_1 -= 10;", "#endif\n}", "if (VAR_2 == AV_RB32(\"JFIF\")) {", "int VAR_5, VAR_6, VAR_7, VAR_8;", "skip_bits(&VAR_0->gb, 8);", "VAR_7 = get_bits(&VAR_0->gb, 8);", "VAR_8 = get_bits(&VAR_0->gb, 8);", "skip_bits(&VAR_0->gb, 8);", "VAR_0->avctx->sample_aspect_ratio.num = get_bits(&VAR_0->gb, 16);", "VAR_0->avctx->sample_aspect_ratio.den = get_bits(&VAR_0->gb, 16);", "if ( VAR_0->avctx->sample_aspect_ratio.num <= 0\n|| VAR_0->avctx->sample_aspect_ratio.den <= 0) {", "VAR_0->avctx->sample_aspect_ratio.num = 0;", "VAR_0->avctx->sample_aspect_ratio.den = 1;", "}", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO,\n\"mjpeg: JFIF header found (version: %x.%x) SAR=%d/%d\\n\",\nVAR_7, VAR_8,\nVAR_0->avctx->sample_aspect_ratio.num,\nVAR_0->avctx->sample_aspect_ratio.den);", "VAR_1 -= 8;", "if (VAR_1 >= 2) {", "VAR_5 = get_bits(&VAR_0->gb, 8);", "VAR_6 = get_bits(&VAR_0->gb, 8);", "if (VAR_5 && VAR_6) {", "if (VAR_1 -10 - (VAR_5 * VAR_6 * 3) > 0)\nVAR_1 -= VAR_5 * VAR_6 * 3;", "}", "VAR_1 -= 2;", "}", "}", "if ( VAR_2 == AV_RB32(\"Adob\")\n&& VAR_1 >= 7\n&& show_bits(&VAR_0->gb, 8) == 'e'\n&& show_bits_long(&VAR_0->gb, 32) != AV_RB32(\"e_CM\")) {", "skip_bits(&VAR_0->gb, 8);", "skip_bits(&VAR_0->gb, 16);", "skip_bits(&VAR_0->gb, 16);", "skip_bits(&VAR_0->gb, 16);", "VAR_0->adobe_transform = get_bits(&VAR_0->gb, 8);", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO, \"mjpeg: Adobe header found, transform=%d\\n\", VAR_0->adobe_transform);", "VAR_1 -= 7;", "}", "if (VAR_2 == AV_RB32(\"LJIF\")) {", "int VAR_9 = VAR_0->VAR_9;", "int VAR_10 = VAR_0->VAR_10;", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO,\n\"Pegasus lossless jpeg header found\\n\");", "skip_bits(&VAR_0->gb, 16);", "skip_bits(&VAR_0->gb, 16);", "skip_bits(&VAR_0->gb, 16);", "skip_bits(&VAR_0->gb, 16);", "switch (VAR_3=get_bits(&VAR_0->gb, 8)) {", "case 1:\nVAR_9 = 1;", "VAR_10 = 0;", "break;", "case 2:\nVAR_9 = 1;", "VAR_10 = 1;", "break;", "default:\nav_log(VAR_0->avctx, AV_LOG_ERROR, \"unknown colorspace %d\\n\", VAR_3);", "}", "VAR_1 -= 9;", "if (VAR_0->got_picture)\nif (VAR_9 != VAR_0->VAR_9 || VAR_10 != VAR_0->VAR_10) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"Mismatching LJIF tag\\n\");", "}", "VAR_0->VAR_9 = VAR_9;", "VAR_0->VAR_10 = VAR_10;", "}", "if (VAR_2 == AV_RL32(\"colr\") && VAR_1 > 0) {", "VAR_0->colr = get_bits(&VAR_0->gb, 8);", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO, \"COLR %d\\n\", VAR_0->colr);", "VAR_1 --;", "}", "if (VAR_2 == AV_RL32(\"xfrm\") && VAR_1 > 0) {", "VAR_0->xfrm = get_bits(&VAR_0->gb, 8);", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO, \"XFRM %d\\n\", VAR_0->xfrm);", "VAR_1 --;", "}", "if (VAR_0->start_code == APP3 && VAR_2 == AV_RB32(\"_JPS\") && VAR_1 >= 10) {", "int VAR_11, VAR_12, VAR_13;", "if (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO, \"_JPSJPS_\\n\");", "skip_bits(&VAR_0->gb, 32); VAR_1 -= 4;", "skip_bits(&VAR_0->gb, 16); VAR_1 -= 2;", "skip_bits(&VAR_0->gb, 8);", "VAR_11 = get_bits(&VAR_0->gb, 8);", "VAR_12 = get_bits(&VAR_0->gb, 8);", "VAR_13 = get_bits(&VAR_0->gb, 8);", "VAR_1 -= 4;", "VAR_0->stereo3d = av_stereo3d_alloc();", "if (!VAR_0->stereo3d) {", "}", "if (VAR_13 == 0) {", "VAR_0->stereo3d->VAR_13 = AV_STEREO3D_2D;", "} else if (VAR_13 == 1) {", "switch (VAR_12) {", "case 0x01:\nVAR_0->stereo3d->VAR_13 = AV_STEREO3D_LINES;", "break;", "case 0x02:\nVAR_0->stereo3d->VAR_13 = AV_STEREO3D_SIDEBYSIDE;", "break;", "case 0x03:\nVAR_0->stereo3d->VAR_13 = AV_STEREO3D_TOPBOTTOM;", "break;", "}", "if (!(VAR_11 & 0x04)) {", "VAR_0->stereo3d->VAR_11 = AV_STEREO3D_FLAG_INVERT;", "}", "}", "}", "if (VAR_0->start_code == APP1 && VAR_2 == AV_RB32(\"Exif\") && VAR_1 >= 2) {", "GetByteContext gbytes;", "int VAR_14, VAR_15, VAR_16, VAR_17;", "const uint8_t *VAR_18;", "skip_bits(&VAR_0->gb, 16);", "VAR_1 -= 2;", "VAR_18 = align_get_bits(&VAR_0->gb);", "bytestream2_init(&gbytes, VAR_18, VAR_1);", "VAR_14 = ff_tdecode_header(&gbytes, &VAR_15, &VAR_16);", "if (VAR_14) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"mjpeg: invalid TIFF header in EXIF data\\n\");", "} else {", "bytestream2_seek(&gbytes, VAR_16, SEEK_SET);", "VAR_14 = avpriv_exif_decode_ifd(VAR_0->avctx, &gbytes, VAR_15, 0, &VAR_0->exif_metadata);", "if (VAR_14 < 0) {", "av_log(VAR_0->avctx, AV_LOG_ERROR, \"mjpeg: error decoding EXIF data\\n\");", "}", "}", "VAR_17 = bytestream2_tell(&gbytes);", "skip_bits(&VAR_0->gb, VAR_17 << 3);", "VAR_1 -= VAR_17;", "}", "if ((VAR_0->start_code == APP1) && (VAR_1 > (0x28 - 8))) {", "VAR_2 = get_bits_long(&VAR_0->gb, 32);", "VAR_1 -= 4;", "if (VAR_2 == AV_RB32(\"mjpg\")) {", "#if 0\nskip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "skip_bits(&VAR_0->gb, 32);", "#endif\nif (VAR_0->avctx->debug & FF_DEBUG_PICT_INFO)\nav_log(VAR_0->avctx, AV_LOG_INFO, \"mjpeg: Apple MJPEG-A header found\\n\");", "}", "}", "out:\nif (VAR_1 < 0)\nav_log(VAR_0->avctx, AV_LOG_ERROR,\n\"mjpeg: error, decode_app parser read over the end\\n\");", "while (--VAR_1 > 0)\nskip_bits(&VAR_0->gb, 8);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 45 ], [ 61 ], [ 63 ], [ 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77, 80 ], [ 88 ], [ 90 ], [ 94 ], [ 96 ], [ 98 ], [ 100 ], [ 104 ], [ 106 ], [ 108, 110 ], [ 112 ], [ 114 ], [ 116 ], [ 120, 122, 124, 126, 128, 130 ], [ 134 ], [ 136 ], [ 138 ], [ 140 ], [ 142 ], [ 146, 148 ], [ 150 ], [ 152 ], [ 154 ], [ 157 ], [ 161, 163, 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 186 ], [ 190 ], [ 192 ], [ 194 ], [ 196, 198, 200 ], [ 202 ], [ 204 ], [ 206 ], [ 208 ], [ 210 ], [ 212, 214 ], [ 216 ], [ 218 ], [ 220, 222 ], [ 224 ], [ 226 ], [ 228, 230 ], [ 232 ], [ 236 ], [ 238, 240 ], [ 242 ], [ 245 ], [ 249 ], [ 251 ], [ 256 ], [ 258 ], [ 260 ], [ 262, 264 ], [ 266 ], [ 269 ], [ 271 ], [ 273 ], [ 275, 277 ], [ 279 ], [ 282 ], [ 288 ], [ 290 ], [ 292, 294 ], [ 298 ], [ 300 ], [ 302 ], [ 304 ], [ 306 ], [ 308 ], [ 310 ], [ 314 ], [ 316 ], [ 319 ], [ 321 ], [ 323 ], [ 325 ], [ 327 ], [ 329, 331 ], [ 333 ], [ 335, 337 ], [ 339 ], [ 341, 343 ], [ 345 ], [ 347 ], [ 349 ], [ 351 ], [ 353 ], [ 355 ], [ 358 ], [ 364 ], [ 366 ], [ 368 ], [ 370 ], [ 374 ], [ 376 ], [ 382 ], [ 384 ], [ 390 ], [ 392 ], [ 394 ], [ 396 ], [ 398 ], [ 406 ], [ 408 ], [ 410 ], [ 412 ], [ 414 ], [ 418 ], [ 420 ], [ 422 ], [ 427 ], [ 433 ], [ 435 ], [ 437 ], [ 441 ], [ 443, 445 ], [ 447 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461, 463, 465 ], [ 467 ], [ 469 ], [ 473, 477, 479, 481 ], [ 483, 485 ], [ 489 ], [ 491 ] ]
15,149
static int do_decode(AVCodecContext *avctx, AVPacket *pkt) { int got_frame; int ret; av_assert0(!avctx->internal->buffer_frame->buf[0]); if (!pkt) pkt = avctx->internal->buffer_pkt; // This is the lesser evil. The field is for compatibility with legacy users // of the legacy API, and users using the new API should not be forced to // even know about this field. avctx->refcounted_frames = 1; // Some codecs (at least wma lossless) will crash when feeding drain packets // after EOF was signaled. if (avctx->internal->draining_done) return AVERROR_EOF; if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { ret = avcodec_decode_video2(avctx, avctx->internal->buffer_frame, &got_frame, pkt); if (ret >= 0 && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED)) ret = pkt->size; } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { ret = avcodec_decode_audio4(avctx, avctx->internal->buffer_frame, &got_frame, pkt); } else { ret = AVERROR(EINVAL); } if (ret == AVERROR(EAGAIN)) ret = pkt->size; if (avctx->internal->draining && !got_frame) avctx->internal->draining_done = 1; if (ret < 0) return ret; if (ret >= pkt->size) { av_packet_unref(avctx->internal->buffer_pkt); } else { int consumed = ret; if (pkt != avctx->internal->buffer_pkt) { av_packet_unref(avctx->internal->buffer_pkt); if ((ret = av_packet_ref(avctx->internal->buffer_pkt, pkt)) < 0) return ret; } avctx->internal->buffer_pkt->data += consumed; avctx->internal->buffer_pkt->size -= consumed; avctx->internal->buffer_pkt->pts = AV_NOPTS_VALUE; avctx->internal->buffer_pkt->dts = AV_NOPTS_VALUE; } if (got_frame) av_assert0(avctx->internal->buffer_frame->buf[0]); return 0; }
true
FFmpeg
b4b8ca24f62473528949fe047085eb084364124b
static int do_decode(AVCodecContext *avctx, AVPacket *pkt) { int got_frame; int ret; av_assert0(!avctx->internal->buffer_frame->buf[0]); if (!pkt) pkt = avctx->internal->buffer_pkt; avctx->refcounted_frames = 1; if (avctx->internal->draining_done) return AVERROR_EOF; if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { ret = avcodec_decode_video2(avctx, avctx->internal->buffer_frame, &got_frame, pkt); if (ret >= 0 && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED)) ret = pkt->size; } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { ret = avcodec_decode_audio4(avctx, avctx->internal->buffer_frame, &got_frame, pkt); } else { ret = AVERROR(EINVAL); } if (ret == AVERROR(EAGAIN)) ret = pkt->size; if (avctx->internal->draining && !got_frame) avctx->internal->draining_done = 1; if (ret < 0) return ret; if (ret >= pkt->size) { av_packet_unref(avctx->internal->buffer_pkt); } else { int consumed = ret; if (pkt != avctx->internal->buffer_pkt) { av_packet_unref(avctx->internal->buffer_pkt); if ((ret = av_packet_ref(avctx->internal->buffer_pkt, pkt)) < 0) return ret; } avctx->internal->buffer_pkt->data += consumed; avctx->internal->buffer_pkt->size -= consumed; avctx->internal->buffer_pkt->pts = AV_NOPTS_VALUE; avctx->internal->buffer_pkt->dts = AV_NOPTS_VALUE; } if (got_frame) av_assert0(avctx->internal->buffer_frame->buf[0]); return 0; }
{ "code": [ " int got_frame;" ], "line_no": [ 5 ] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1) { int VAR_2; int VAR_3; av_assert0(!VAR_0->internal->buffer_frame->buf[0]); if (!VAR_1) VAR_1 = VAR_0->internal->buffer_pkt; VAR_0->refcounted_frames = 1; if (VAR_0->internal->draining_done) return AVERROR_EOF; if (VAR_0->codec_type == AVMEDIA_TYPE_VIDEO) { VAR_3 = avcodec_decode_video2(VAR_0, VAR_0->internal->buffer_frame, &VAR_2, VAR_1); if (VAR_3 >= 0 && !(VAR_0->flags & AV_CODEC_FLAG_TRUNCATED)) VAR_3 = VAR_1->size; } else if (VAR_0->codec_type == AVMEDIA_TYPE_AUDIO) { VAR_3 = avcodec_decode_audio4(VAR_0, VAR_0->internal->buffer_frame, &VAR_2, VAR_1); } else { VAR_3 = AVERROR(EINVAL); } if (VAR_3 == AVERROR(EAGAIN)) VAR_3 = VAR_1->size; if (VAR_0->internal->draining && !VAR_2) VAR_0->internal->draining_done = 1; if (VAR_3 < 0) return VAR_3; if (VAR_3 >= VAR_1->size) { av_packet_unref(VAR_0->internal->buffer_pkt); } else { int VAR_4 = VAR_3; if (VAR_1 != VAR_0->internal->buffer_pkt) { av_packet_unref(VAR_0->internal->buffer_pkt); if ((VAR_3 = av_packet_ref(VAR_0->internal->buffer_pkt, VAR_1)) < 0) return VAR_3; } VAR_0->internal->buffer_pkt->data += VAR_4; VAR_0->internal->buffer_pkt->size -= VAR_4; VAR_0->internal->buffer_pkt->pts = AV_NOPTS_VALUE; VAR_0->internal->buffer_pkt->dts = AV_NOPTS_VALUE; } if (VAR_2) av_assert0(VAR_0->internal->buffer_frame->buf[0]); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1)\n{", "int VAR_2;", "int VAR_3;", "av_assert0(!VAR_0->internal->buffer_frame->buf[0]);", "if (!VAR_1)\nVAR_1 = VAR_0->internal->buffer_pkt;", "VAR_0->refcounted_frames = 1;", "if (VAR_0->internal->draining_done)\nreturn AVERROR_EOF;", "if (VAR_0->codec_type == AVMEDIA_TYPE_VIDEO) {", "VAR_3 = avcodec_decode_video2(VAR_0, VAR_0->internal->buffer_frame,\n&VAR_2, VAR_1);", "if (VAR_3 >= 0 && !(VAR_0->flags & AV_CODEC_FLAG_TRUNCATED))\nVAR_3 = VAR_1->size;", "} else if (VAR_0->codec_type == AVMEDIA_TYPE_AUDIO) {", "VAR_3 = avcodec_decode_audio4(VAR_0, VAR_0->internal->buffer_frame,\n&VAR_2, VAR_1);", "} else {", "VAR_3 = AVERROR(EINVAL);", "}", "if (VAR_3 == AVERROR(EAGAIN))\nVAR_3 = VAR_1->size;", "if (VAR_0->internal->draining && !VAR_2)\nVAR_0->internal->draining_done = 1;", "if (VAR_3 < 0)\nreturn VAR_3;", "if (VAR_3 >= VAR_1->size) {", "av_packet_unref(VAR_0->internal->buffer_pkt);", "} else {", "int VAR_4 = VAR_3;", "if (VAR_1 != VAR_0->internal->buffer_pkt) {", "av_packet_unref(VAR_0->internal->buffer_pkt);", "if ((VAR_3 = av_packet_ref(VAR_0->internal->buffer_pkt, VAR_1)) < 0)\nreturn VAR_3;", "}", "VAR_0->internal->buffer_pkt->data += VAR_4;", "VAR_0->internal->buffer_pkt->size -= VAR_4;", "VAR_0->internal->buffer_pkt->pts = AV_NOPTS_VALUE;", "VAR_0->internal->buffer_pkt->dts = AV_NOPTS_VALUE;", "}", "if (VAR_2)\nav_assert0(VAR_0->internal->buffer_frame->buf[0]);", "return 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15, 17 ], [ 27 ], [ 35, 37 ], [ 41 ], [ 43, 45 ], [ 47, 49 ], [ 51 ], [ 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65, 67 ], [ 71, 73 ], [ 77, 79 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 117, 119 ], [ 123 ], [ 125 ] ]
15,150
void ff_h264_free_tables(H264Context *h, int free_rbsp) { int i; av_freep(&h->intra4x4_pred_mode); av_freep(&h->chroma_pred_mode_table); av_freep(&h->cbp_table); av_freep(&h->mvd_table[0]); av_freep(&h->mvd_table[1]); av_freep(&h->direct_table); av_freep(&h->non_zero_count); av_freep(&h->slice_table_base); h->slice_table = NULL; av_freep(&h->list_counts); av_freep(&h->mb2b_xy); av_freep(&h->mb2br_xy); av_buffer_pool_uninit(&h->qscale_table_pool); av_buffer_pool_uninit(&h->mb_type_pool); av_buffer_pool_uninit(&h->motion_val_pool); av_buffer_pool_uninit(&h->ref_index_pool); if (free_rbsp && h->DPB) { for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) ff_h264_unref_picture(h, &h->DPB[i]); av_freep(&h->DPB); } h->cur_pic_ptr = NULL; for (i = 0; i < h->nb_slice_ctx; i++) { H264SliceContext *sl = &h->slice_ctx[i]; av_freep(&sl->dc_val_base); av_freep(&sl->er.mb_index2xy); av_freep(&sl->er.error_status_table); av_freep(&sl->er.er_temp_buffer); av_freep(&sl->bipred_scratchpad); av_freep(&sl->edge_emu_buffer); av_freep(&sl->top_borders[0]); av_freep(&sl->top_borders[1]); sl->bipred_scratchpad_allocated = 0; sl->edge_emu_buffer_allocated = 0; sl->top_borders_allocated[0] = 0; sl->top_borders_allocated[1] = 0; if (free_rbsp) { av_freep(&sl->rbsp_buffer); sl->rbsp_buffer_size = 0; } } }
true
FFmpeg
a6cd154463bea7eb56d28192db4c8c6d83f67fd7
void ff_h264_free_tables(H264Context *h, int free_rbsp) { int i; av_freep(&h->intra4x4_pred_mode); av_freep(&h->chroma_pred_mode_table); av_freep(&h->cbp_table); av_freep(&h->mvd_table[0]); av_freep(&h->mvd_table[1]); av_freep(&h->direct_table); av_freep(&h->non_zero_count); av_freep(&h->slice_table_base); h->slice_table = NULL; av_freep(&h->list_counts); av_freep(&h->mb2b_xy); av_freep(&h->mb2br_xy); av_buffer_pool_uninit(&h->qscale_table_pool); av_buffer_pool_uninit(&h->mb_type_pool); av_buffer_pool_uninit(&h->motion_val_pool); av_buffer_pool_uninit(&h->ref_index_pool); if (free_rbsp && h->DPB) { for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) ff_h264_unref_picture(h, &h->DPB[i]); av_freep(&h->DPB); } h->cur_pic_ptr = NULL; for (i = 0; i < h->nb_slice_ctx; i++) { H264SliceContext *sl = &h->slice_ctx[i]; av_freep(&sl->dc_val_base); av_freep(&sl->er.mb_index2xy); av_freep(&sl->er.error_status_table); av_freep(&sl->er.er_temp_buffer); av_freep(&sl->bipred_scratchpad); av_freep(&sl->edge_emu_buffer); av_freep(&sl->top_borders[0]); av_freep(&sl->top_borders[1]); sl->bipred_scratchpad_allocated = 0; sl->edge_emu_buffer_allocated = 0; sl->top_borders_allocated[0] = 0; sl->top_borders_allocated[1] = 0; if (free_rbsp) { av_freep(&sl->rbsp_buffer); sl->rbsp_buffer_size = 0; } } }
{ "code": [ " if (free_rbsp && h->DPB) {", " for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)", " ff_h264_unref_picture(h, &h->DPB[i]);", " av_freep(&h->DPB);", " h->cur_pic_ptr = NULL;", " for (i = 0; i < H264_MAX_PICTURE_COUNT; i++)" ], "line_no": [ 47, 49, 51, 53, 59, 49 ] }
void FUNC_0(H264Context *VAR_0, int VAR_1) { int VAR_2; av_freep(&VAR_0->intra4x4_pred_mode); av_freep(&VAR_0->chroma_pred_mode_table); av_freep(&VAR_0->cbp_table); av_freep(&VAR_0->mvd_table[0]); av_freep(&VAR_0->mvd_table[1]); av_freep(&VAR_0->direct_table); av_freep(&VAR_0->non_zero_count); av_freep(&VAR_0->slice_table_base); VAR_0->slice_table = NULL; av_freep(&VAR_0->list_counts); av_freep(&VAR_0->mb2b_xy); av_freep(&VAR_0->mb2br_xy); av_buffer_pool_uninit(&VAR_0->qscale_table_pool); av_buffer_pool_uninit(&VAR_0->mb_type_pool); av_buffer_pool_uninit(&VAR_0->motion_val_pool); av_buffer_pool_uninit(&VAR_0->ref_index_pool); if (VAR_1 && VAR_0->DPB) { for (VAR_2 = 0; VAR_2 < H264_MAX_PICTURE_COUNT; VAR_2++) ff_h264_unref_picture(VAR_0, &VAR_0->DPB[VAR_2]); av_freep(&VAR_0->DPB); } VAR_0->cur_pic_ptr = NULL; for (VAR_2 = 0; VAR_2 < VAR_0->nb_slice_ctx; VAR_2++) { H264SliceContext *sl = &VAR_0->slice_ctx[VAR_2]; av_freep(&sl->dc_val_base); av_freep(&sl->er.mb_index2xy); av_freep(&sl->er.error_status_table); av_freep(&sl->er.er_temp_buffer); av_freep(&sl->bipred_scratchpad); av_freep(&sl->edge_emu_buffer); av_freep(&sl->top_borders[0]); av_freep(&sl->top_borders[1]); sl->bipred_scratchpad_allocated = 0; sl->edge_emu_buffer_allocated = 0; sl->top_borders_allocated[0] = 0; sl->top_borders_allocated[1] = 0; if (VAR_1) { av_freep(&sl->rbsp_buffer); sl->rbsp_buffer_size = 0; } } }
[ "void FUNC_0(H264Context *VAR_0, int VAR_1)\n{", "int VAR_2;", "av_freep(&VAR_0->intra4x4_pred_mode);", "av_freep(&VAR_0->chroma_pred_mode_table);", "av_freep(&VAR_0->cbp_table);", "av_freep(&VAR_0->mvd_table[0]);", "av_freep(&VAR_0->mvd_table[1]);", "av_freep(&VAR_0->direct_table);", "av_freep(&VAR_0->non_zero_count);", "av_freep(&VAR_0->slice_table_base);", "VAR_0->slice_table = NULL;", "av_freep(&VAR_0->list_counts);", "av_freep(&VAR_0->mb2b_xy);", "av_freep(&VAR_0->mb2br_xy);", "av_buffer_pool_uninit(&VAR_0->qscale_table_pool);", "av_buffer_pool_uninit(&VAR_0->mb_type_pool);", "av_buffer_pool_uninit(&VAR_0->motion_val_pool);", "av_buffer_pool_uninit(&VAR_0->ref_index_pool);", "if (VAR_1 && VAR_0->DPB) {", "for (VAR_2 = 0; VAR_2 < H264_MAX_PICTURE_COUNT; VAR_2++)", "ff_h264_unref_picture(VAR_0, &VAR_0->DPB[VAR_2]);", "av_freep(&VAR_0->DPB);", "}", "VAR_0->cur_pic_ptr = NULL;", "for (VAR_2 = 0; VAR_2 < VAR_0->nb_slice_ctx; VAR_2++) {", "H264SliceContext *sl = &VAR_0->slice_ctx[VAR_2];", "av_freep(&sl->dc_val_base);", "av_freep(&sl->er.mb_index2xy);", "av_freep(&sl->er.error_status_table);", "av_freep(&sl->er.er_temp_buffer);", "av_freep(&sl->bipred_scratchpad);", "av_freep(&sl->edge_emu_buffer);", "av_freep(&sl->top_borders[0]);", "av_freep(&sl->top_borders[1]);", "sl->bipred_scratchpad_allocated = 0;", "sl->edge_emu_buffer_allocated = 0;", "sl->top_borders_allocated[0] = 0;", "sl->top_borders_allocated[1] = 0;", "if (VAR_1) {", "av_freep(&sl->rbsp_buffer);", "sl->rbsp_buffer_size = 0;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ] ]
15,151
static bool s390_gen_initial_iplb(S390IPLState *ipl) { DeviceState *dev_st; dev_st = get_boot_device(0); if (dev_st) { VirtioCcwDevice *virtio_ccw_dev = (VirtioCcwDevice *) object_dynamic_cast(OBJECT(qdev_get_parent_bus(dev_st)->parent), TYPE_VIRTIO_CCW_DEVICE); SCSIDevice *sd = (SCSIDevice *) object_dynamic_cast(OBJECT(dev_st), TYPE_SCSI_DEVICE); if (virtio_ccw_dev) { CcwDevice *ccw_dev = CCW_DEVICE(virtio_ccw_dev); ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); ipl->iplb.blk0_len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN - S390_IPLB_HEADER_LEN); ipl->iplb.pbt = S390_IPL_TYPE_CCW; ipl->iplb.ccw.devno = cpu_to_be16(ccw_dev->sch->devno); ipl->iplb.ccw.ssid = ccw_dev->sch->ssid & 3; return true; } else if (sd) { SCSIBus *bus = scsi_bus_from_device(sd); VirtIOSCSI *vdev = container_of(bus, VirtIOSCSI, bus); VirtIOSCSICcw *scsi_ccw = container_of(vdev, VirtIOSCSICcw, vdev); CcwDevice *ccw_dev = CCW_DEVICE(scsi_ccw); ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); ipl->iplb.blk0_len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN - S390_IPLB_HEADER_LEN); ipl->iplb.pbt = S390_IPL_TYPE_QEMU_SCSI; ipl->iplb.scsi.lun = cpu_to_be32(sd->lun); ipl->iplb.scsi.target = cpu_to_be16(sd->id); ipl->iplb.scsi.channel = cpu_to_be16(sd->channel); ipl->iplb.scsi.devno = cpu_to_be16(ccw_dev->sch->devno); ipl->iplb.scsi.ssid = ccw_dev->sch->ssid & 3; return true; return false;
true
qemu
f38b5b7fc4e27724afc72b91efa2bc82f84bb25e
static bool s390_gen_initial_iplb(S390IPLState *ipl) { DeviceState *dev_st; dev_st = get_boot_device(0); if (dev_st) { VirtioCcwDevice *virtio_ccw_dev = (VirtioCcwDevice *) object_dynamic_cast(OBJECT(qdev_get_parent_bus(dev_st)->parent), TYPE_VIRTIO_CCW_DEVICE); SCSIDevice *sd = (SCSIDevice *) object_dynamic_cast(OBJECT(dev_st), TYPE_SCSI_DEVICE); if (virtio_ccw_dev) { CcwDevice *ccw_dev = CCW_DEVICE(virtio_ccw_dev); ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); ipl->iplb.blk0_len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN - S390_IPLB_HEADER_LEN); ipl->iplb.pbt = S390_IPL_TYPE_CCW; ipl->iplb.ccw.devno = cpu_to_be16(ccw_dev->sch->devno); ipl->iplb.ccw.ssid = ccw_dev->sch->ssid & 3; return true; } else if (sd) { SCSIBus *bus = scsi_bus_from_device(sd); VirtIOSCSI *vdev = container_of(bus, VirtIOSCSI, bus); VirtIOSCSICcw *scsi_ccw = container_of(vdev, VirtIOSCSICcw, vdev); CcwDevice *ccw_dev = CCW_DEVICE(scsi_ccw); ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); ipl->iplb.blk0_len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN - S390_IPLB_HEADER_LEN); ipl->iplb.pbt = S390_IPL_TYPE_QEMU_SCSI; ipl->iplb.scsi.lun = cpu_to_be32(sd->lun); ipl->iplb.scsi.target = cpu_to_be16(sd->id); ipl->iplb.scsi.channel = cpu_to_be16(sd->channel); ipl->iplb.scsi.devno = cpu_to_be16(ccw_dev->sch->devno); ipl->iplb.scsi.ssid = ccw_dev->sch->ssid & 3; return true; return false;
{ "code": [], "line_no": [] }
static bool FUNC_0(S390IPLState *ipl) { DeviceState *dev_st; dev_st = get_boot_device(0); if (dev_st) { VirtioCcwDevice *virtio_ccw_dev = (VirtioCcwDevice *) object_dynamic_cast(OBJECT(qdev_get_parent_bus(dev_st)->parent), TYPE_VIRTIO_CCW_DEVICE); SCSIDevice *sd = (SCSIDevice *) object_dynamic_cast(OBJECT(dev_st), TYPE_SCSI_DEVICE); if (virtio_ccw_dev) { CcwDevice *ccw_dev = CCW_DEVICE(virtio_ccw_dev); ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN); ipl->iplb.blk0_len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN - S390_IPLB_HEADER_LEN); ipl->iplb.pbt = S390_IPL_TYPE_CCW; ipl->iplb.ccw.devno = cpu_to_be16(ccw_dev->sch->devno); ipl->iplb.ccw.ssid = ccw_dev->sch->ssid & 3; return true; } else if (sd) { SCSIBus *bus = scsi_bus_from_device(sd); VirtIOSCSI *vdev = container_of(bus, VirtIOSCSI, bus); VirtIOSCSICcw *scsi_ccw = container_of(vdev, VirtIOSCSICcw, vdev); CcwDevice *ccw_dev = CCW_DEVICE(scsi_ccw); ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN); ipl->iplb.blk0_len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN - S390_IPLB_HEADER_LEN); ipl->iplb.pbt = S390_IPL_TYPE_QEMU_SCSI; ipl->iplb.scsi.lun = cpu_to_be32(sd->lun); ipl->iplb.scsi.target = cpu_to_be16(sd->id); ipl->iplb.scsi.channel = cpu_to_be16(sd->channel); ipl->iplb.scsi.devno = cpu_to_be16(ccw_dev->sch->devno); ipl->iplb.scsi.ssid = ccw_dev->sch->ssid & 3; return true; return false;
[ "static bool FUNC_0(S390IPLState *ipl)\n{", "DeviceState *dev_st;", "dev_st = get_boot_device(0);", "if (dev_st) {", "VirtioCcwDevice *virtio_ccw_dev = (VirtioCcwDevice *)\nobject_dynamic_cast(OBJECT(qdev_get_parent_bus(dev_st)->parent),\nTYPE_VIRTIO_CCW_DEVICE);", "SCSIDevice *sd = (SCSIDevice *) object_dynamic_cast(OBJECT(dev_st),\nTYPE_SCSI_DEVICE);", "if (virtio_ccw_dev) {", "CcwDevice *ccw_dev = CCW_DEVICE(virtio_ccw_dev);", "ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_CCW_LEN);", "ipl->iplb.blk0_len =\ncpu_to_be32(S390_IPLB_MIN_CCW_LEN - S390_IPLB_HEADER_LEN);", "ipl->iplb.pbt = S390_IPL_TYPE_CCW;", "ipl->iplb.ccw.devno = cpu_to_be16(ccw_dev->sch->devno);", "ipl->iplb.ccw.ssid = ccw_dev->sch->ssid & 3;", "return true;", "} else if (sd) {", "SCSIBus *bus = scsi_bus_from_device(sd);", "VirtIOSCSI *vdev = container_of(bus, VirtIOSCSI, bus);", "VirtIOSCSICcw *scsi_ccw = container_of(vdev, VirtIOSCSICcw, vdev);", "CcwDevice *ccw_dev = CCW_DEVICE(scsi_ccw);", "ipl->iplb.len = cpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN);", "ipl->iplb.blk0_len =\ncpu_to_be32(S390_IPLB_MIN_QEMU_SCSI_LEN - S390_IPLB_HEADER_LEN);", "ipl->iplb.pbt = S390_IPL_TYPE_QEMU_SCSI;", "ipl->iplb.scsi.lun = cpu_to_be32(sd->lun);", "ipl->iplb.scsi.target = cpu_to_be16(sd->id);", "ipl->iplb.scsi.channel = cpu_to_be16(sd->channel);", "ipl->iplb.scsi.devno = cpu_to_be16(ccw_dev->sch->devno);", "ipl->iplb.scsi.ssid = ccw_dev->sch->ssid & 3;", "return true;", "return false;" ]
[ 0, 0, 0, 0, 0, 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 ] ]
15,152
static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch) { int bin, blk, gs; int end_bap, gaq_mode; GetBitContext *gbc = &s->gbc; int gaq_gain[AC3_MAX_COEFS]; gaq_mode = get_bits(gbc, 2); end_bap = (gaq_mode < 2) ? 12 : 17; /* if GAQ gain is used, decode gain codes for bins with hebap between 8 and end_bap */ gs = 0; if (gaq_mode == EAC3_GAQ_12 || gaq_mode == EAC3_GAQ_14) { /* read 1-bit GAQ gain codes */ for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap) gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1); } } else if (gaq_mode == EAC3_GAQ_124) { /* read 1.67-bit GAQ gain codes (3 codes in 5 bits) */ int gc = 2; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) { if (gc++ == 2) { int group_code = get_bits(gbc, 5); if (group_code > 26) { av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n"); group_code = 26; } gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2]; gc = 0; } } } } gs=0; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { int hebap = s->bap[ch][bin]; int bits = ff_eac3_bits_vs_hebap[hebap]; if (!hebap) { /* zero-mantissa dithering */ for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000; } } else if (hebap < 8) { /* Vector Quantization */ int v = get_bits(gbc, bits); for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] << 8; } } else { /* Gain Adaptive Quantization */ int gbits, log_gain; if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) { log_gain = gaq_gain[gs++]; } else { log_gain = 0; } gbits = bits - log_gain; for (blk = 0; blk < 6; blk++) { int mant = get_sbits(gbc, gbits); if (log_gain && mant == -(1 << (gbits-1))) { /* large mantissa */ int b; int mbits = bits - (2 - log_gain); mant = get_sbits(gbc, mbits); mant <<= (23 - (mbits - 1)); /* remap mantissa value to correct for asymmetric quantization */ if (mant >= 0) b = 1 << (23 - log_gain); else b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8; mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b; } else { /* small mantissa, no GAQ, or Gk=1 */ mant <<= 24 - bits; if (!log_gain) { /* remap mantissa value for no GAQ or Gk=1 */ mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15; } } s->pre_mantissa[ch][bin][blk] = mant; } } idct6(s->pre_mantissa[ch][bin]); } }
true
FFmpeg
067485b673f6ac4b1207d6fc975d1fd968edc68e
static void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch) { int bin, blk, gs; int end_bap, gaq_mode; GetBitContext *gbc = &s->gbc; int gaq_gain[AC3_MAX_COEFS]; gaq_mode = get_bits(gbc, 2); end_bap = (gaq_mode < 2) ? 12 : 17; gs = 0; if (gaq_mode == EAC3_GAQ_12 || gaq_mode == EAC3_GAQ_14) { for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap) gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1); } } else if (gaq_mode == EAC3_GAQ_124) { int gc = 2; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) { if (gc++ == 2) { int group_code = get_bits(gbc, 5); if (group_code > 26) { av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n"); group_code = 26; } gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1]; gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2]; gc = 0; } } } } gs=0; for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { int hebap = s->bap[ch][bin]; int bits = ff_eac3_bits_vs_hebap[hebap]; if (!hebap) { for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000; } } else if (hebap < 8) { int v = get_bits(gbc, bits); for (blk = 0; blk < 6; blk++) { s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] << 8; } } else { int gbits, log_gain; if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) { log_gain = gaq_gain[gs++]; } else { log_gain = 0; } gbits = bits - log_gain; for (blk = 0; blk < 6; blk++) { int mant = get_sbits(gbc, gbits); if (log_gain && mant == -(1 << (gbits-1))) { int b; int mbits = bits - (2 - log_gain); mant = get_sbits(gbc, mbits); mant <<= (23 - (mbits - 1)); if (mant >= 0) b = 1 << (23 - log_gain); else b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8; mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b; } else { mant <<= 24 - bits; if (!log_gain) { mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15; } } s->pre_mantissa[ch][bin][blk] = mant; } } idct6(s->pre_mantissa[ch][bin]); } }
{ "code": [ " s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] << 8;", " mant <<= (23 - (mbits - 1));", " b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8;" ], "line_no": [ 105, 143, 153 ] }
static void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1) { int VAR_2, VAR_3, VAR_4; int VAR_5, VAR_6; GetBitContext *gbc = &VAR_0->gbc; int VAR_7[AC3_MAX_COEFS]; VAR_6 = get_bits(gbc, 2); VAR_5 = (VAR_6 < 2) ? 12 : 17; VAR_4 = 0; if (VAR_6 == EAC3_GAQ_12 || VAR_6 == EAC3_GAQ_14) { for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) { if (VAR_0->bap[VAR_1][VAR_2] > 7 && VAR_0->bap[VAR_1][VAR_2] < VAR_5) VAR_7[VAR_4++] = get_bits1(gbc) << (VAR_6-1); } } else if (VAR_6 == EAC3_GAQ_124) { int VAR_8 = 2; for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) { if (VAR_0->bap[VAR_1][VAR_2] > 7 && VAR_0->bap[VAR_1][VAR_2] < 17) { if (VAR_8++ == 2) { int group_code = get_bits(gbc, 5); if (group_code > 26) { av_log(VAR_0->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n"); group_code = 26; } VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0]; VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1]; VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2]; VAR_8 = 0; } } } } VAR_4=0; for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) { int hebap = VAR_0->bap[VAR_1][VAR_2]; int bits = ff_eac3_bits_vs_hebap[hebap]; if (!hebap) { for (VAR_3 = 0; VAR_3 < 6; VAR_3++) { VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = (av_lfg_get(&VAR_0->dith_state) & 0x7FFFFF) - 0x400000; } } else if (hebap < 8) { int v = get_bits(gbc, bits); for (VAR_3 = 0; VAR_3 < 6; VAR_3++) { VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = ff_eac3_mantissa_vq[hebap][v][VAR_3] << 8; } } else { int gbits, log_gain; if (VAR_6 != EAC3_GAQ_NO && hebap < VAR_5) { log_gain = VAR_7[VAR_4++]; } else { log_gain = 0; } gbits = bits - log_gain; for (VAR_3 = 0; VAR_3 < 6; VAR_3++) { int mant = get_sbits(gbc, gbits); if (log_gain && mant == -(1 << (gbits-1))) { int b; int mbits = bits - (2 - log_gain); mant = get_sbits(gbc, mbits); mant <<= (23 - (mbits - 1)); if (mant >= 0) b = 1 << (23 - log_gain); else b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8; mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b; } else { mant <<= 24 - bits; if (!log_gain) { mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15; } } VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = mant; } } idct6(VAR_0->pre_mantissa[VAR_1][VAR_2]); } }
[ "static void FUNC_0(AC3DecodeContext *VAR_0, int VAR_1)\n{", "int VAR_2, VAR_3, VAR_4;", "int VAR_5, VAR_6;", "GetBitContext *gbc = &VAR_0->gbc;", "int VAR_7[AC3_MAX_COEFS];", "VAR_6 = get_bits(gbc, 2);", "VAR_5 = (VAR_6 < 2) ? 12 : 17;", "VAR_4 = 0;", "if (VAR_6 == EAC3_GAQ_12 || VAR_6 == EAC3_GAQ_14) {", "for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) {", "if (VAR_0->bap[VAR_1][VAR_2] > 7 && VAR_0->bap[VAR_1][VAR_2] < VAR_5)\nVAR_7[VAR_4++] = get_bits1(gbc) << (VAR_6-1);", "}", "} else if (VAR_6 == EAC3_GAQ_124) {", "int VAR_8 = 2;", "for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) {", "if (VAR_0->bap[VAR_1][VAR_2] > 7 && VAR_0->bap[VAR_1][VAR_2] < 17) {", "if (VAR_8++ == 2) {", "int group_code = get_bits(gbc, 5);", "if (group_code > 26) {", "av_log(VAR_0->avctx, AV_LOG_WARNING, \"GAQ gain group code out-of-range\\n\");", "group_code = 26;", "}", "VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0];", "VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1];", "VAR_7[VAR_4++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2];", "VAR_8 = 0;", "}", "}", "}", "}", "VAR_4=0;", "for (VAR_2 = VAR_0->start_freq[VAR_1]; VAR_2 < VAR_0->end_freq[VAR_1]; VAR_2++) {", "int hebap = VAR_0->bap[VAR_1][VAR_2];", "int bits = ff_eac3_bits_vs_hebap[hebap];", "if (!hebap) {", "for (VAR_3 = 0; VAR_3 < 6; VAR_3++) {", "VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = (av_lfg_get(&VAR_0->dith_state) & 0x7FFFFF) - 0x400000;", "}", "} else if (hebap < 8) {", "int v = get_bits(gbc, bits);", "for (VAR_3 = 0; VAR_3 < 6; VAR_3++) {", "VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = ff_eac3_mantissa_vq[hebap][v][VAR_3] << 8;", "}", "} else {", "int gbits, log_gain;", "if (VAR_6 != EAC3_GAQ_NO && hebap < VAR_5) {", "log_gain = VAR_7[VAR_4++];", "} else {", "log_gain = 0;", "}", "gbits = bits - log_gain;", "for (VAR_3 = 0; VAR_3 < 6; VAR_3++) {", "int mant = get_sbits(gbc, gbits);", "if (log_gain && mant == -(1 << (gbits-1))) {", "int b;", "int mbits = bits - (2 - log_gain);", "mant = get_sbits(gbc, mbits);", "mant <<= (23 - (mbits - 1));", "if (mant >= 0)\nb = 1 << (23 - log_gain);", "else\nb = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8;", "mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b;", "} else {", "mant <<= 24 - bits;", "if (!log_gain) {", "mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15;", "}", "}", "VAR_0->pre_mantissa[VAR_1][VAR_2][VAR_3] = mant;", "}", "}", "idct6(VAR_0->pre_mantissa[VAR_1][VAR_2]);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 25 ], [ 27 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 147, 149 ], [ 151, 153 ], [ 155 ], [ 157 ], [ 161 ], [ 163 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ] ]
15,153
int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int count) { Coroutine *co; DiscardCo rwco = { .bs = bs, .offset = offset, .count = count, .ret = NOT_DONE, }; if (qemu_in_coroutine()) { /* Fast-path if already in coroutine context */ bdrv_pdiscard_co_entry(&rwco); } else { co = qemu_coroutine_create(bdrv_pdiscard_co_entry, &rwco); qemu_coroutine_enter(co); BDRV_POLL_WHILE(bs, rwco.ret == NOT_DONE); } return rwco.ret; }
true
qemu
e92f0e1910f0655a0edd8d87c5a7262d36517a89
int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int count) { Coroutine *co; DiscardCo rwco = { .bs = bs, .offset = offset, .count = count, .ret = NOT_DONE, }; if (qemu_in_coroutine()) { bdrv_pdiscard_co_entry(&rwco); } else { co = qemu_coroutine_create(bdrv_pdiscard_co_entry, &rwco); qemu_coroutine_enter(co); BDRV_POLL_WHILE(bs, rwco.ret == NOT_DONE); } return rwco.ret; }
{ "code": [ " qemu_coroutine_enter(co);", " qemu_coroutine_enter(co);", " qemu_coroutine_enter(co);", " qemu_coroutine_enter(co);", " qemu_coroutine_enter(co);", " qemu_coroutine_enter(co);" ], "line_no": [ 31, 31, 31, 31, 31, 31 ] }
int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, int VAR_2) { Coroutine *co; DiscardCo rwco = { .VAR_0 = VAR_0, .VAR_1 = VAR_1, .VAR_2 = VAR_2, .ret = NOT_DONE, }; if (qemu_in_coroutine()) { bdrv_pdiscard_co_entry(&rwco); } else { co = qemu_coroutine_create(bdrv_pdiscard_co_entry, &rwco); qemu_coroutine_enter(co); BDRV_POLL_WHILE(VAR_0, rwco.ret == NOT_DONE); } return rwco.ret; }
[ "int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1, int VAR_2)\n{", "Coroutine *co;", "DiscardCo rwco = {", ".VAR_0 = VAR_0,\n.VAR_1 = VAR_1,\n.VAR_2 = VAR_2,\n.ret = NOT_DONE,\n};", "if (qemu_in_coroutine()) {", "bdrv_pdiscard_co_entry(&rwco);", "} else {", "co = qemu_coroutine_create(bdrv_pdiscard_co_entry, &rwco);", "qemu_coroutine_enter(co);", "BDRV_POLL_WHILE(VAR_0, rwco.ret == NOT_DONE);", "}", "return rwco.ret;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11, 13, 15, 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ] ]
15,154
static void alpha_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); AlphaCPU *cpu = ALPHA_CPU(obj); CPUAlphaState *env = &cpu->env; cs->env_ptr = env; cpu_exec_init(cs, &error_abort); tlb_flush(cs, 1); alpha_translate_init(); #if defined(CONFIG_USER_ONLY) env->ps = PS_USER_MODE; cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD | FPCR_UNFD | FPCR_INED | FPCR_DNOD | FPCR_DYN_NORMAL)); #endif env->lock_addr = -1; env->fen = 1; }
true
qemu
ce5b1bbf624b977a55ff7f85bb3871682d03baff
static void alpha_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); AlphaCPU *cpu = ALPHA_CPU(obj); CPUAlphaState *env = &cpu->env; cs->env_ptr = env; cpu_exec_init(cs, &error_abort); tlb_flush(cs, 1); alpha_translate_init(); #if defined(CONFIG_USER_ONLY) env->ps = PS_USER_MODE; cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD | FPCR_UNFD | FPCR_INED | FPCR_DNOD | FPCR_DYN_NORMAL)); #endif env->lock_addr = -1; env->fen = 1; }
{ "code": [ " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);", " cpu_exec_init(cs, &error_abort);" ], "line_no": [ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 ] }
static void FUNC_0(Object *VAR_0) { CPUState *cs = CPU(VAR_0); AlphaCPU *cpu = ALPHA_CPU(VAR_0); CPUAlphaState *env = &cpu->env; cs->env_ptr = env; cpu_exec_init(cs, &error_abort); tlb_flush(cs, 1); alpha_translate_init(); #if defined(CONFIG_USER_ONLY) env->ps = PS_USER_MODE; cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD | FPCR_UNFD | FPCR_INED | FPCR_DNOD | FPCR_DYN_NORMAL)); #endif env->lock_addr = -1; env->fen = 1; }
[ "static void FUNC_0(Object *VAR_0)\n{", "CPUState *cs = CPU(VAR_0);", "AlphaCPU *cpu = ALPHA_CPU(VAR_0);", "CPUAlphaState *env = &cpu->env;", "cs->env_ptr = env;", "cpu_exec_init(cs, &error_abort);", "tlb_flush(cs, 1);", "alpha_translate_init();", "#if defined(CONFIG_USER_ONLY)\nenv->ps = PS_USER_MODE;", "cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD\n| FPCR_UNFD | FPCR_INED | FPCR_DNOD\n| FPCR_DYN_NORMAL));", "#endif\nenv->lock_addr = -1;", "env->fen = 1;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25, 27 ], [ 29, 31, 33 ], [ 35, 37 ], [ 39 ], [ 41 ] ]
15,155
static void render_line(int x0, int y0, int x1, int y1, float *buf) { int dy = y1 - y0; int adx = x1 - x0; int ady = FFABS(dy); int sy = dy < 0 ? -1 : 1; buf[x0] = ff_vorbis_floor1_inverse_db_table[y0]; if (ady*2 <= adx) { // optimized common case render_line_unrolled(x0, y0, x1, sy, ady, adx, buf); } else { int base = dy / adx; int x = x0; int y = y0; int err = -adx; ady -= FFABS(base) * adx; while (++x < x1) { y += base; err += ady; if (err >= 0) { err -= adx; y += sy; } buf[x] = ff_vorbis_floor1_inverse_db_table[y]; } } }
true
FFmpeg
7149fce2cac0474a5fbc5b47add1158cd8bb283e
static void render_line(int x0, int y0, int x1, int y1, float *buf) { int dy = y1 - y0; int adx = x1 - x0; int ady = FFABS(dy); int sy = dy < 0 ? -1 : 1; buf[x0] = ff_vorbis_floor1_inverse_db_table[y0]; if (ady*2 <= adx) { render_line_unrolled(x0, y0, x1, sy, ady, adx, buf); } else { int base = dy / adx; int x = x0; int y = y0; int err = -adx; ady -= FFABS(base) * adx; while (++x < x1) { y += base; err += ady; if (err >= 0) { err -= adx; y += sy; } buf[x] = ff_vorbis_floor1_inverse_db_table[y]; } } }
{ "code": [ " int y = y0;" ], "line_no": [ 25 ] }
static void FUNC_0(int VAR_0, int VAR_1, int VAR_2, int VAR_3, float *VAR_4) { int VAR_5 = VAR_3 - VAR_1; int VAR_6 = VAR_2 - VAR_0; int VAR_7 = FFABS(VAR_5); int VAR_8 = VAR_5 < 0 ? -1 : 1; VAR_4[VAR_0] = ff_vorbis_floor1_inverse_db_table[VAR_1]; if (VAR_7*2 <= VAR_6) { render_line_unrolled(VAR_0, VAR_1, VAR_2, VAR_8, VAR_7, VAR_6, VAR_4); } else { int VAR_9 = VAR_5 / VAR_6; int VAR_10 = VAR_0; int VAR_11 = VAR_1; int VAR_12 = -VAR_6; VAR_7 -= FFABS(VAR_9) * VAR_6; while (++VAR_10 < VAR_2) { VAR_11 += VAR_9; VAR_12 += VAR_7; if (VAR_12 >= 0) { VAR_12 -= VAR_6; VAR_11 += VAR_8; } VAR_4[VAR_10] = ff_vorbis_floor1_inverse_db_table[VAR_11]; } } }
[ "static void FUNC_0(int VAR_0, int VAR_1, int VAR_2, int VAR_3, float *VAR_4)\n{", "int VAR_5 = VAR_3 - VAR_1;", "int VAR_6 = VAR_2 - VAR_0;", "int VAR_7 = FFABS(VAR_5);", "int VAR_8 = VAR_5 < 0 ? -1 : 1;", "VAR_4[VAR_0] = ff_vorbis_floor1_inverse_db_table[VAR_1];", "if (VAR_7*2 <= VAR_6) {", "render_line_unrolled(VAR_0, VAR_1, VAR_2, VAR_8, VAR_7, VAR_6, VAR_4);", "} else {", "int VAR_9 = VAR_5 / VAR_6;", "int VAR_10 = VAR_0;", "int VAR_11 = VAR_1;", "int VAR_12 = -VAR_6;", "VAR_7 -= FFABS(VAR_9) * VAR_6;", "while (++VAR_10 < VAR_2) {", "VAR_11 += VAR_9;", "VAR_12 += VAR_7;", "if (VAR_12 >= 0) {", "VAR_12 -= VAR_6;", "VAR_11 += VAR_8;", "}", "VAR_4[VAR_10] = ff_vorbis_floor1_inverse_db_table[VAR_11];", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ] ]
15,156
void ram_control_after_iterate(QEMUFile *f, uint64_t flags) { int ret = 0; if (f->ops->after_ram_iterate) { ret = f->ops->after_ram_iterate(f, f->opaque, flags); if (ret < 0) { qemu_file_set_error(f, ret); } } }
true
qemu
60fe637bf0e4d7989e21e50f52526444765c63b4
void ram_control_after_iterate(QEMUFile *f, uint64_t flags) { int ret = 0; if (f->ops->after_ram_iterate) { ret = f->ops->after_ram_iterate(f, f->opaque, flags); if (ret < 0) { qemu_file_set_error(f, ret); } } }
{ "code": [], "line_no": [] }
void FUNC_0(QEMUFile *VAR_0, uint64_t VAR_1) { int VAR_2 = 0; if (VAR_0->ops->after_ram_iterate) { VAR_2 = VAR_0->ops->after_ram_iterate(VAR_0, VAR_0->opaque, VAR_1); if (VAR_2 < 0) { qemu_file_set_error(VAR_0, VAR_2); } } }
[ "void FUNC_0(QEMUFile *VAR_0, uint64_t VAR_1)\n{", "int VAR_2 = 0;", "if (VAR_0->ops->after_ram_iterate) {", "VAR_2 = VAR_0->ops->after_ram_iterate(VAR_0, VAR_0->opaque, VAR_1);", "if (VAR_2 < 0) {", "qemu_file_set_error(VAR_0, VAR_2);", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ] ]
15,157
void ff_rtsp_close_streams(AVFormatContext *s) { RTSPState *rt = s->priv_data; int i; RTSPStream *rtsp_st; ff_rtsp_undo_setup(s); for (i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st) { if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context) rtsp_st->dynamic_handler->close( rtsp_st->dynamic_protocol_context); } } av_free(rt->rtsp_streams); if (rt->asf_ctx) { av_close_input_stream (rt->asf_ctx); rt->asf_ctx = NULL; } av_free(rt->p); av_free(rt->recvbuf); }
true
FFmpeg
ea7f080749d68a431226ce196014da38761a0d82
void ff_rtsp_close_streams(AVFormatContext *s) { RTSPState *rt = s->priv_data; int i; RTSPStream *rtsp_st; ff_rtsp_undo_setup(s); for (i = 0; i < rt->nb_rtsp_streams; i++) { rtsp_st = rt->rtsp_streams[i]; if (rtsp_st) { if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context) rtsp_st->dynamic_handler->close( rtsp_st->dynamic_protocol_context); } } av_free(rt->rtsp_streams); if (rt->asf_ctx) { av_close_input_stream (rt->asf_ctx); rt->asf_ctx = NULL; } av_free(rt->p); av_free(rt->recvbuf); }
{ "code": [], "line_no": [] }
void FUNC_0(AVFormatContext *VAR_0) { RTSPState *rt = VAR_0->priv_data; int VAR_1; RTSPStream *rtsp_st; ff_rtsp_undo_setup(VAR_0); for (VAR_1 = 0; VAR_1 < rt->nb_rtsp_streams; VAR_1++) { rtsp_st = rt->rtsp_streams[VAR_1]; if (rtsp_st) { if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context) rtsp_st->dynamic_handler->close( rtsp_st->dynamic_protocol_context); } } av_free(rt->rtsp_streams); if (rt->asf_ctx) { av_close_input_stream (rt->asf_ctx); rt->asf_ctx = NULL; } av_free(rt->p); av_free(rt->recvbuf); }
[ "void FUNC_0(AVFormatContext *VAR_0)\n{", "RTSPState *rt = VAR_0->priv_data;", "int VAR_1;", "RTSPStream *rtsp_st;", "ff_rtsp_undo_setup(VAR_0);", "for (VAR_1 = 0; VAR_1 < rt->nb_rtsp_streams; VAR_1++) {", "rtsp_st = rt->rtsp_streams[VAR_1];", "if (rtsp_st) {", "if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context)\nrtsp_st->dynamic_handler->close(\nrtsp_st->dynamic_protocol_context);", "}", "}", "av_free(rt->rtsp_streams);", "if (rt->asf_ctx) {", "av_close_input_stream (rt->asf_ctx);", "rt->asf_ctx = NULL;", "}", "av_free(rt->p);", "av_free(rt->recvbuf);", "}" ]
[ 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 ], [ 28 ], [ 30 ], [ 32 ], [ 34 ], [ 36 ], [ 38 ], [ 40 ], [ 42 ], [ 44 ], [ 46 ] ]
15,158
static void aarch64_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) { DisasContext *dc = container_of(dcbase, DisasContext, base); dc->insn_start_idx = tcg_op_buf_count(); tcg_gen_insn_start(dc->pc, 0, 0); }
true
qemu
15fa08f8451babc88d733bd411d4c94976f9d0f8
static void aarch64_tr_insn_start(DisasContextBase *dcbase, CPUState *cpu) { DisasContext *dc = container_of(dcbase, DisasContext, base); dc->insn_start_idx = tcg_op_buf_count(); tcg_gen_insn_start(dc->pc, 0, 0); }
{ "code": [ " dc->insn_start_idx = tcg_op_buf_count();", " dc->insn_start_idx = tcg_op_buf_count();" ], "line_no": [ 9, 9 ] }
static void FUNC_0(DisasContextBase *VAR_0, CPUState *VAR_1) { DisasContext *dc = container_of(VAR_0, DisasContext, base); dc->insn_start_idx = tcg_op_buf_count(); tcg_gen_insn_start(dc->pc, 0, 0); }
[ "static void FUNC_0(DisasContextBase *VAR_0, CPUState *VAR_1)\n{", "DisasContext *dc = container_of(VAR_0, DisasContext, base);", "dc->insn_start_idx = tcg_op_buf_count();", "tcg_gen_insn_start(dc->pc, 0, 0);", "}" ]
[ 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ] ]
15,160
int ff_xvid_rate_control_init(MpegEncContext *s){ char *tmp_name; int fd, i; xvid_plg_create_t xvid_plg_create = { 0 }; xvid_plugin_2pass2_t xvid_2pass2 = { 0 }; fd=av_tempfile("xvidrc.", &tmp_name, 0, s->avctx); if (fd == -1) { av_log(NULL, AV_LOG_ERROR, "Can't create temporary pass2 file.\n"); return -1; } for(i=0; i<s->rc_context.num_entries; i++){ static const char frame_types[] = " ipbs"; char tmp[256]; RateControlEntry *rce; rce= &s->rc_context.entry[i]; snprintf(tmp, sizeof(tmp), "%c %d %d %d %d %d %d\n", frame_types[rce->pict_type], (int)lrintf(rce->qscale / FF_QP2LAMBDA), rce->i_count, s->mb_num - rce->i_count - rce->skip_count, rce->skip_count, (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits+7)/8, (rce->header_bits+rce->mv_bits+7)/8); if (write(fd, tmp, strlen(tmp)) < 0) { av_log(NULL, AV_LOG_ERROR, "Error %s writing 2pass logfile\n", strerror(errno)); return AVERROR(errno); } } xvid_2pass2.version= XVID_MAKE_VERSION(1,1,0); xvid_2pass2.filename= tmp_name; xvid_2pass2.bitrate= s->avctx->bit_rate; xvid_2pass2.vbv_size= s->avctx->rc_buffer_size; xvid_2pass2.vbv_maxrate= s->avctx->rc_max_rate; xvid_2pass2.vbv_initial= s->avctx->rc_initial_buffer_occupancy; xvid_plg_create.version= XVID_MAKE_VERSION(1,1,0); xvid_plg_create.fbase= s->avctx->time_base.den; xvid_plg_create.fincr= s->avctx->time_base.num; xvid_plg_create.param= &xvid_2pass2; if(xvid_plugin_2pass2(NULL, XVID_PLG_CREATE, &xvid_plg_create, &s->rc_context.non_lavc_opaque)<0){ av_log(NULL, AV_LOG_ERROR, "xvid_plugin_2pass2 failed\n"); return -1; } return 0; }
true
FFmpeg
229ccce6cca7748f53cb4b6a8d035ddce5ac6b72
int ff_xvid_rate_control_init(MpegEncContext *s){ char *tmp_name; int fd, i; xvid_plg_create_t xvid_plg_create = { 0 }; xvid_plugin_2pass2_t xvid_2pass2 = { 0 }; fd=av_tempfile("xvidrc.", &tmp_name, 0, s->avctx); if (fd == -1) { av_log(NULL, AV_LOG_ERROR, "Can't create temporary pass2 file.\n"); return -1; } for(i=0; i<s->rc_context.num_entries; i++){ static const char frame_types[] = " ipbs"; char tmp[256]; RateControlEntry *rce; rce= &s->rc_context.entry[i]; snprintf(tmp, sizeof(tmp), "%c %d %d %d %d %d %d\n", frame_types[rce->pict_type], (int)lrintf(rce->qscale / FF_QP2LAMBDA), rce->i_count, s->mb_num - rce->i_count - rce->skip_count, rce->skip_count, (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits+7)/8, (rce->header_bits+rce->mv_bits+7)/8); if (write(fd, tmp, strlen(tmp)) < 0) { av_log(NULL, AV_LOG_ERROR, "Error %s writing 2pass logfile\n", strerror(errno)); return AVERROR(errno); } } xvid_2pass2.version= XVID_MAKE_VERSION(1,1,0); xvid_2pass2.filename= tmp_name; xvid_2pass2.bitrate= s->avctx->bit_rate; xvid_2pass2.vbv_size= s->avctx->rc_buffer_size; xvid_2pass2.vbv_maxrate= s->avctx->rc_max_rate; xvid_2pass2.vbv_initial= s->avctx->rc_initial_buffer_occupancy; xvid_plg_create.version= XVID_MAKE_VERSION(1,1,0); xvid_plg_create.fbase= s->avctx->time_base.den; xvid_plg_create.fincr= s->avctx->time_base.num; xvid_plg_create.param= &xvid_2pass2; if(xvid_plugin_2pass2(NULL, XVID_PLG_CREATE, &xvid_plg_create, &s->rc_context.non_lavc_opaque)<0){ av_log(NULL, AV_LOG_ERROR, "xvid_plugin_2pass2 failed\n"); return -1; } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(MpegEncContext *VAR_0){ char *VAR_1; int VAR_2, VAR_3; xvid_plg_create_t xvid_plg_create = { 0 }; xvid_plugin_2pass2_t xvid_2pass2 = { 0 }; VAR_2=av_tempfile("xvidrc.", &VAR_1, 0, VAR_0->avctx); if (VAR_2 == -1) { av_log(NULL, AV_LOG_ERROR, "Can't create temporary pass2 file.\n"); return -1; } for(VAR_3=0; VAR_3<VAR_0->rc_context.num_entries; VAR_3++){ static const char frame_types[] = " ipbs"; char tmp[256]; RateControlEntry *rce; rce= &VAR_0->rc_context.entry[VAR_3]; snprintf(tmp, sizeof(tmp), "%c %d %d %d %d %d %d\n", frame_types[rce->pict_type], (int)lrintf(rce->qscale / FF_QP2LAMBDA), rce->i_count, VAR_0->mb_num - rce->i_count - rce->skip_count, rce->skip_count, (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits+7)/8, (rce->header_bits+rce->mv_bits+7)/8); if (write(VAR_2, tmp, strlen(tmp)) < 0) { av_log(NULL, AV_LOG_ERROR, "Error %VAR_0 writing 2pass logfile\n", strerror(errno)); return AVERROR(errno); } } xvid_2pass2.version= XVID_MAKE_VERSION(1,1,0); xvid_2pass2.filename= VAR_1; xvid_2pass2.bitrate= VAR_0->avctx->bit_rate; xvid_2pass2.vbv_size= VAR_0->avctx->rc_buffer_size; xvid_2pass2.vbv_maxrate= VAR_0->avctx->rc_max_rate; xvid_2pass2.vbv_initial= VAR_0->avctx->rc_initial_buffer_occupancy; xvid_plg_create.version= XVID_MAKE_VERSION(1,1,0); xvid_plg_create.fbase= VAR_0->avctx->time_base.den; xvid_plg_create.fincr= VAR_0->avctx->time_base.num; xvid_plg_create.param= &xvid_2pass2; if(xvid_plugin_2pass2(NULL, XVID_PLG_CREATE, &xvid_plg_create, &VAR_0->rc_context.non_lavc_opaque)<0){ av_log(NULL, AV_LOG_ERROR, "xvid_plugin_2pass2 failed\n"); return -1; } return 0; }
[ "int FUNC_0(MpegEncContext *VAR_0){", "char *VAR_1;", "int VAR_2, VAR_3;", "xvid_plg_create_t xvid_plg_create = { 0 };", "xvid_plugin_2pass2_t xvid_2pass2 = { 0 };", "VAR_2=av_tempfile(\"xvidrc.\", &VAR_1, 0, VAR_0->avctx);", "if (VAR_2 == -1) {", "av_log(NULL, AV_LOG_ERROR, \"Can't create temporary pass2 file.\\n\");", "return -1;", "}", "for(VAR_3=0; VAR_3<VAR_0->rc_context.num_entries; VAR_3++){", "static const char frame_types[] = \" ipbs\";", "char tmp[256];", "RateControlEntry *rce;", "rce= &VAR_0->rc_context.entry[VAR_3];", "snprintf(tmp, sizeof(tmp), \"%c %d %d %d %d %d %d\\n\",\nframe_types[rce->pict_type], (int)lrintf(rce->qscale / FF_QP2LAMBDA), rce->i_count, VAR_0->mb_num - rce->i_count - rce->skip_count,\nrce->skip_count, (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits+7)/8, (rce->header_bits+rce->mv_bits+7)/8);", "if (write(VAR_2, tmp, strlen(tmp)) < 0) {", "av_log(NULL, AV_LOG_ERROR, \"Error %VAR_0 writing 2pass logfile\\n\", strerror(errno));", "return AVERROR(errno);", "}", "}", "xvid_2pass2.version= XVID_MAKE_VERSION(1,1,0);", "xvid_2pass2.filename= VAR_1;", "xvid_2pass2.bitrate= VAR_0->avctx->bit_rate;", "xvid_2pass2.vbv_size= VAR_0->avctx->rc_buffer_size;", "xvid_2pass2.vbv_maxrate= VAR_0->avctx->rc_max_rate;", "xvid_2pass2.vbv_initial= VAR_0->avctx->rc_initial_buffer_occupancy;", "xvid_plg_create.version= XVID_MAKE_VERSION(1,1,0);", "xvid_plg_create.fbase= VAR_0->avctx->time_base.den;", "xvid_plg_create.fincr= VAR_0->avctx->time_base.num;", "xvid_plg_create.param= &xvid_2pass2;", "if(xvid_plugin_2pass2(NULL, XVID_PLG_CREATE, &xvid_plg_create, &VAR_0->rc_context.non_lavc_opaque)<0){", "av_log(NULL, AV_LOG_ERROR, \"xvid_plugin_2pass2 failed\\n\");", "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, 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, 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 64 ], [ 66 ], [ 68 ], [ 70 ], [ 72 ], [ 74 ], [ 78 ], [ 80 ], [ 82 ], [ 84 ], [ 88 ], [ 90 ], [ 92 ], [ 94 ], [ 96 ], [ 98 ] ]
15,161
void *fw_cfg_modify_file(FWCfgState *s, const char *filename, void *data, size_t len) { int i, index; void *ptr = NULL; assert(s->files); index = be32_to_cpu(s->files->count); assert(index < fw_cfg_file_slots(s)); for (i = 0; i < index; i++) { if (strcmp(filename, s->files->f[i].name) == 0) { ptr = fw_cfg_modify_bytes_read(s, FW_CFG_FILE_FIRST + i, data, len); s->files->f[i].size = cpu_to_be32(len); return ptr; } } /* add new one */ fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true); return NULL; }
true
qemu
d6b6abc51dda79a97f2c7bd6652c1940c068f1ec
void *fw_cfg_modify_file(FWCfgState *s, const char *filename, void *data, size_t len) { int i, index; void *ptr = NULL; assert(s->files); index = be32_to_cpu(s->files->count); assert(index < fw_cfg_file_slots(s)); for (i = 0; i < index; i++) { if (strcmp(filename, s->files->f[i].name) == 0) { ptr = fw_cfg_modify_bytes_read(s, FW_CFG_FILE_FIRST + i, data, len); s->files->f[i].size = cpu_to_be32(len); return ptr; } } fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true); return NULL; }
{ "code": [ " assert(index < fw_cfg_file_slots(s));" ], "line_no": [ 19 ] }
void *FUNC_0(FWCfgState *VAR_0, const char *VAR_1, void *VAR_2, size_t VAR_3) { int VAR_4, VAR_5; void *VAR_6 = NULL; assert(VAR_0->files); VAR_5 = be32_to_cpu(VAR_0->files->count); assert(VAR_5 < fw_cfg_file_slots(VAR_0)); for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) { if (strcmp(VAR_1, VAR_0->files->f[VAR_4].name) == 0) { VAR_6 = fw_cfg_modify_bytes_read(VAR_0, FW_CFG_FILE_FIRST + VAR_4, VAR_2, VAR_3); VAR_0->files->f[VAR_4].size = cpu_to_be32(VAR_3); return VAR_6; } } fw_cfg_add_file_callback(VAR_0, VAR_1, NULL, NULL, NULL, VAR_2, VAR_3, true); return NULL; }
[ "void *FUNC_0(FWCfgState *VAR_0, const char *VAR_1,\nvoid *VAR_2, size_t VAR_3)\n{", "int VAR_4, VAR_5;", "void *VAR_6 = NULL;", "assert(VAR_0->files);", "VAR_5 = be32_to_cpu(VAR_0->files->count);", "assert(VAR_5 < fw_cfg_file_slots(VAR_0));", "for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) {", "if (strcmp(VAR_1, VAR_0->files->f[VAR_4].name) == 0) {", "VAR_6 = fw_cfg_modify_bytes_read(VAR_0, FW_CFG_FILE_FIRST + VAR_4,\nVAR_2, VAR_3);", "VAR_0->files->f[VAR_4].size = cpu_to_be32(VAR_3);", "return VAR_6;", "}", "}", "fw_cfg_add_file_callback(VAR_0, VAR_1, NULL, NULL, NULL, VAR_2, VAR_3, true);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ] ]
15,162
int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data) { const char *id = qdict_get_str(qdict, "id"); BlockDriverState *bs; bs = bdrv_find(id); if (!bs) { qerror_report(QERR_DEVICE_NOT_FOUND, id); return -1; } if (bdrv_in_use(bs)) { qerror_report(QERR_DEVICE_IN_USE, id); return -1; } /* quiesce block driver; prevent further io */ qemu_aio_flush(); bdrv_flush(bs); bdrv_close(bs); /* if we have a device attached to this BlockDriverState * then we need to make the drive anonymous until the device * can be removed. If this is a drive with no device backing * then we can just get rid of the block driver state right here. */ if (bdrv_get_attached_dev(bs)) { bdrv_make_anon(bs); } else { drive_uninit(drive_get_by_blockdev(bs)); } return 0; }
false
qemu
922453bca6a927bb527068ae8679d587cfa45dbc
int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data) { const char *id = qdict_get_str(qdict, "id"); BlockDriverState *bs; bs = bdrv_find(id); if (!bs) { qerror_report(QERR_DEVICE_NOT_FOUND, id); return -1; } if (bdrv_in_use(bs)) { qerror_report(QERR_DEVICE_IN_USE, id); return -1; } qemu_aio_flush(); bdrv_flush(bs); bdrv_close(bs); if (bdrv_get_attached_dev(bs)) { bdrv_make_anon(bs); } else { drive_uninit(drive_get_by_blockdev(bs)); } return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2) { const char *VAR_3 = qdict_get_str(VAR_1, "VAR_3"); BlockDriverState *bs; bs = bdrv_find(VAR_3); if (!bs) { qerror_report(QERR_DEVICE_NOT_FOUND, VAR_3); return -1; } if (bdrv_in_use(bs)) { qerror_report(QERR_DEVICE_IN_USE, VAR_3); return -1; } qemu_aio_flush(); bdrv_flush(bs); bdrv_close(bs); if (bdrv_get_attached_dev(bs)) { bdrv_make_anon(bs); } else { drive_uninit(drive_get_by_blockdev(bs)); } return 0; }
[ "int FUNC_0(Monitor *VAR_0, const QDict *VAR_1, QObject **VAR_2)\n{", "const char *VAR_3 = qdict_get_str(VAR_1, \"VAR_3\");", "BlockDriverState *bs;", "bs = bdrv_find(VAR_3);", "if (!bs) {", "qerror_report(QERR_DEVICE_NOT_FOUND, VAR_3);", "return -1;", "}", "if (bdrv_in_use(bs)) {", "qerror_report(QERR_DEVICE_IN_USE, VAR_3);", "return -1;", "}", "qemu_aio_flush();", "bdrv_flush(bs);", "bdrv_close(bs);", "if (bdrv_get_attached_dev(bs)) {", "bdrv_make_anon(bs);", "} else {", "drive_uninit(drive_get_by_blockdev(bs));", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 33 ], [ 35 ], [ 37 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
15,164
static void init_proc_970FX (CPUPPCState *env) { gen_spr_ne_601(env); gen_spr_7xx(env); /* Time base */ gen_tbl(env); /* Hardware implementation registers */ /* XXX : not implemented */ spr_register(env, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_clear, 0x60000000); /* XXX : not implemented */ spr_register(env, SPR_HID1, "HID1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); /* XXX : not implemented */ spr_register(env, SPR_970_HID5, "HID5", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, POWERPC970_HID5_INIT); /* Memory management */ /* XXX: not correct */ gen_low_BATs(env); spr_register(env, SPR_HIOR, "SPR_HIOR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_hior, &spr_write_hior, 0x00000000); spr_register(env, SPR_CTRL, "SPR_CTRL", SPR_NOACCESS, SPR_NOACCESS, SPR_NOACCESS, &spr_write_generic, 0x00000000); spr_register(env, SPR_UCTRL, "SPR_UCTRL", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, 0x00000000); spr_register(env, SPR_VRSAVE, "SPR_VRSAVE", &spr_read_generic, &spr_write_generic, &spr_read_generic, &spr_write_generic, 0x00000000); #if !defined(CONFIG_USER_ONLY) env->slb_nr = 64; #endif init_excp_970(env); env->dcache_line_size = 128; env->icache_line_size = 128; /* Allocate hardware IRQ controller */ ppc970_irq_init(env); /* Can't find information on what this should be on reset. This * value is the one used by 74xx processors. */ vscr_init(env, 0x00010000); }
false
qemu
bbc01ca7f265f2c5be8aee7c9ce1d10aa26063f5
static void init_proc_970FX (CPUPPCState *env) { gen_spr_ne_601(env); gen_spr_7xx(env); gen_tbl(env); spr_register(env, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_clear, 0x60000000); spr_register(env, SPR_HID1, "HID1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_970_HID5, "HID5", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, POWERPC970_HID5_INIT); gen_low_BATs(env); spr_register(env, SPR_HIOR, "SPR_HIOR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_hior, &spr_write_hior, 0x00000000); spr_register(env, SPR_CTRL, "SPR_CTRL", SPR_NOACCESS, SPR_NOACCESS, SPR_NOACCESS, &spr_write_generic, 0x00000000); spr_register(env, SPR_UCTRL, "SPR_UCTRL", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, 0x00000000); spr_register(env, SPR_VRSAVE, "SPR_VRSAVE", &spr_read_generic, &spr_write_generic, &spr_read_generic, &spr_write_generic, 0x00000000); #if !defined(CONFIG_USER_ONLY) env->slb_nr = 64; #endif init_excp_970(env); env->dcache_line_size = 128; env->icache_line_size = 128; ppc970_irq_init(env); vscr_init(env, 0x00010000); }
{ "code": [], "line_no": [] }
static void FUNC_0 (CPUPPCState *VAR_0) { gen_spr_ne_601(VAR_0); gen_spr_7xx(VAR_0); gen_tbl(VAR_0); spr_register(VAR_0, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_clear, 0x60000000); spr_register(VAR_0, SPR_HID1, "HID1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(VAR_0, SPR_970_HID5, "HID5", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, POWERPC970_HID5_INIT); gen_low_BATs(VAR_0); spr_register(VAR_0, SPR_HIOR, "SPR_HIOR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_hior, &spr_write_hior, 0x00000000); spr_register(VAR_0, SPR_CTRL, "SPR_CTRL", SPR_NOACCESS, SPR_NOACCESS, SPR_NOACCESS, &spr_write_generic, 0x00000000); spr_register(VAR_0, SPR_UCTRL, "SPR_UCTRL", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, SPR_NOACCESS, 0x00000000); spr_register(VAR_0, SPR_VRSAVE, "SPR_VRSAVE", &spr_read_generic, &spr_write_generic, &spr_read_generic, &spr_write_generic, 0x00000000); #if !defined(CONFIG_USER_ONLY) VAR_0->slb_nr = 64; #endif init_excp_970(VAR_0); VAR_0->dcache_line_size = 128; VAR_0->icache_line_size = 128; ppc970_irq_init(VAR_0); vscr_init(VAR_0, 0x00010000); }
[ "static void FUNC_0 (CPUPPCState *VAR_0)\n{", "gen_spr_ne_601(VAR_0);", "gen_spr_7xx(VAR_0);", "gen_tbl(VAR_0);", "spr_register(VAR_0, SPR_HID0, \"HID0\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_clear,\n0x60000000);", "spr_register(VAR_0, SPR_HID1, \"HID1\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\n0x00000000);", "spr_register(VAR_0, SPR_970_HID5, \"HID5\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, &spr_write_generic,\nPOWERPC970_HID5_INIT);", "gen_low_BATs(VAR_0);", "spr_register(VAR_0, SPR_HIOR, \"SPR_HIOR\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_hior, &spr_write_hior,\n0x00000000);", "spr_register(VAR_0, SPR_CTRL, \"SPR_CTRL\",\nSPR_NOACCESS, SPR_NOACCESS,\nSPR_NOACCESS, &spr_write_generic,\n0x00000000);", "spr_register(VAR_0, SPR_UCTRL, \"SPR_UCTRL\",\nSPR_NOACCESS, SPR_NOACCESS,\n&spr_read_generic, SPR_NOACCESS,\n0x00000000);", "spr_register(VAR_0, SPR_VRSAVE, \"SPR_VRSAVE\",\n&spr_read_generic, &spr_write_generic,\n&spr_read_generic, &spr_write_generic,\n0x00000000);", "#if !defined(CONFIG_USER_ONLY)\nVAR_0->slb_nr = 64;", "#endif\ninit_excp_970(VAR_0);", "VAR_0->dcache_line_size = 128;", "VAR_0->icache_line_size = 128;", "ppc970_irq_init(VAR_0);", "vscr_init(VAR_0, 0x00010000);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 17, 19, 21, 23 ], [ 27, 29, 31, 33 ], [ 37, 39, 41, 43 ], [ 49 ], [ 51, 53, 55, 57 ], [ 59, 61, 63, 65 ], [ 67, 69, 71, 73 ], [ 75, 77, 79, 81 ], [ 83, 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 97 ], [ 103 ], [ 105 ] ]
15,165
static QPCIBus *pci_test_start(int socket) { char *cmdline; cmdline = g_strdup_printf("-netdev socket,fd=%d,id=hs0 -device " "virtio-net-pci,netdev=hs0", socket); qtest_start(cmdline); g_free(cmdline); return qpci_init_pc(NULL); }
false
qemu
a980f7f2c2f4d7e9a1eba4f804cd66dbd458b6d4
static QPCIBus *pci_test_start(int socket) { char *cmdline; cmdline = g_strdup_printf("-netdev socket,fd=%d,id=hs0 -device " "virtio-net-pci,netdev=hs0", socket); qtest_start(cmdline); g_free(cmdline); return qpci_init_pc(NULL); }
{ "code": [], "line_no": [] }
static QPCIBus *FUNC_0(int socket) { char *VAR_0; VAR_0 = g_strdup_printf("-netdev socket,fd=%d,id=hs0 -device " "virtio-net-pci,netdev=hs0", socket); qtest_start(VAR_0); g_free(VAR_0); return qpci_init_pc(NULL); }
[ "static QPCIBus *FUNC_0(int socket)\n{", "char *VAR_0;", "VAR_0 = g_strdup_printf(\"-netdev socket,fd=%d,id=hs0 -device \"\n\"virtio-net-pci,netdev=hs0\", socket);", "qtest_start(VAR_0);", "g_free(VAR_0);", "return qpci_init_pc(NULL);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ] ]
15,166
static void ppc_prep_init(QEMUMachineInitArgs *args) { ram_addr_t ram_size = args->ram_size; const char *cpu_model = args->cpu_model; const char *kernel_filename = args->kernel_filename; const char *kernel_cmdline = args->kernel_cmdline; const char *initrd_filename = args->initrd_filename; const char *boot_device = args->boot_device; MemoryRegion *sysmem = get_system_memory(); PowerPCCPU *cpu = NULL; CPUPPCState *env = NULL; char *filename; nvram_t nvram; M48t59State *m48t59; MemoryRegion *PPC_io_memory = g_new(MemoryRegion, 1); PortioList *port_list = g_new(PortioList, 1); #if 0 MemoryRegion *xcsr = g_new(MemoryRegion, 1); #endif int linux_boot, i, nb_nics1, bios_size; MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios = g_new(MemoryRegion, 1); uint32_t kernel_base, initrd_base; long kernel_size, initrd_size; DeviceState *dev; PCIHostState *pcihost; PCIBus *pci_bus; PCIDevice *pci; ISABus *isa_bus; ISADevice *isa; qemu_irq *cpu_exit_irq; int ppc_boot_device; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; sysctrl = g_malloc0(sizeof(sysctrl_t)); linux_boot = (kernel_filename != NULL); /* init CPUs */ if (cpu_model == NULL) cpu_model = "602"; for (i = 0; i < smp_cpus; i++) { cpu = cpu_ppc_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } env = &cpu->env; if (env->flags & POWERPC_FLAG_RTC_CLK) { /* POWER / PowerPC 601 RTC clock frequency is 7.8125 MHz */ cpu_ppc_tb_init(env, 7812500UL); } else { /* Set time-base frequency to 100 Mhz */ cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); } qemu_register_reset(ppc_prep_reset, cpu); } /* allocate RAM */ memory_region_init_ram(ram, NULL, "ppc_prep.ram", ram_size); vmstate_register_ram_global(ram); memory_region_add_subregion(sysmem, 0, ram); /* allocate and load BIOS */ memory_region_init_ram(bios, NULL, "ppc_prep.bios", BIOS_SIZE); memory_region_set_readonly(bios, true); memory_region_add_subregion(sysmem, (uint32_t)(-BIOS_SIZE), bios); vmstate_register_ram_global(bios); if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_elf(filename, NULL, NULL, NULL, NULL, NULL, 1, ELF_MACHINE, 0); if (bios_size < 0) { bios_size = get_image_size(filename); if (bios_size > 0 && bios_size <= BIOS_SIZE) { hwaddr bios_addr; bios_size = (bios_size + 0xfff) & ~0xfff; bios_addr = (uint32_t)(-bios_size); bios_size = load_image_targphys(filename, bios_addr, bios_size); } if (bios_size > BIOS_SIZE) { fprintf(stderr, "qemu: PReP bios '%s' is too large (0x%x)\n", bios_name, bios_size); exit(1); } } } else { bios_size = -1; } if (bios_size < 0 && !qtest_enabled()) { fprintf(stderr, "qemu: could not load PPC PReP bios '%s'\n", bios_name); exit(1); } if (filename) { g_free(filename); } if (linux_boot) { kernel_base = KERNEL_LOAD_ADDR; /* now we can load the kernel */ kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { hw_error("qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } /* load initrd */ if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { hw_error("qemu: could not load initial ram disk '%s'\n", initrd_filename); } } else { initrd_base = 0; initrd_size = 0; } ppc_boot_device = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; ppc_boot_device = '\0'; /* For now, OHW cannot boot from the network. */ for (i = 0; boot_device[i] != '\0'; i++) { if (boot_device[i] >= 'a' && boot_device[i] <= 'f') { ppc_boot_device = boot_device[i]; break; } } if (ppc_boot_device == '\0') { fprintf(stderr, "No valid boot device for Mac99 machine\n"); exit(1); } } if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) { hw_error("Only 6xx bus is supported on PREP machine\n"); } dev = qdev_create(NULL, "raven-pcihost"); pcihost = PCI_HOST_BRIDGE(dev); object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev), NULL); qdev_init_nofail(dev); pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0"); if (pci_bus == NULL) { fprintf(stderr, "Couldn't create PCI host controller.\n"); exit(1); } /* PCI -> ISA bridge */ pci = pci_create_simple(pci_bus, PCI_DEVFN(1, 0), "i82378"); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); cpu = POWERPC_CPU(first_cpu); qdev_connect_gpio_out(&pci->qdev, 0, cpu->env.irq_inputs[PPC6xx_INPUT_INT]); qdev_connect_gpio_out(&pci->qdev, 1, *cpu_exit_irq); sysbus_connect_irq(&pcihost->busdev, 0, qdev_get_gpio_in(&pci->qdev, 9)); sysbus_connect_irq(&pcihost->busdev, 1, qdev_get_gpio_in(&pci->qdev, 11)); sysbus_connect_irq(&pcihost->busdev, 2, qdev_get_gpio_in(&pci->qdev, 9)); sysbus_connect_irq(&pcihost->busdev, 3, qdev_get_gpio_in(&pci->qdev, 11)); isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci), "isa.0")); /* Super I/O (parallel + serial ports) */ isa = isa_create(isa_bus, TYPE_PC87312); dev = DEVICE(isa); qdev_prop_set_uint8(dev, "config", 13); /* fdc, ser0, ser1, par0 */ qdev_init_nofail(dev); /* Register 8 MB of ISA IO space (needed for non-contiguous map) */ memory_region_init_io(PPC_io_memory, NULL, &PPC_prep_io_ops, sysctrl, "ppc-io", 0x00800000); memory_region_add_subregion(sysmem, 0x80000000, PPC_io_memory); /* init basic PC hardware */ pci_vga_init(pci_bus); nb_nics1 = nb_nics; if (nb_nics1 > NE2000_NB_MAX) nb_nics1 = NE2000_NB_MAX; for(i = 0; i < nb_nics1; i++) { if (nd_table[i].model == NULL) { nd_table[i].model = g_strdup("ne2k_isa"); } if (strcmp(nd_table[i].model, "ne2k_isa") == 0) { isa_ne2000_init(isa_bus, ne2000_io[i], ne2000_irq[i], &nd_table[i]); } else { pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL); } } ide_drive_get(hd, MAX_IDE_BUS); for(i = 0; i < MAX_IDE_BUS; i++) { isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[2 * i], hd[2 * i + 1]); } isa_create_simple(isa_bus, "i8042"); cpu = POWERPC_CPU(first_cpu); sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET]; portio_list_init(port_list, NULL, prep_portio_list, sysctrl, "prep"); portio_list_add(port_list, get_system_io(), 0x0); /* PowerPC control and status register group */ #if 0 memory_region_init_io(xcsr, NULL, &PPC_XCSR_ops, NULL, "ppc-xcsr", 0x1000); memory_region_add_subregion(sysmem, 0xFEFF0000, xcsr); #endif if (usb_enabled(false)) { pci_create_simple(pci_bus, -1, "pci-ohci"); } m48t59 = m48t59_init_isa(isa_bus, 0x0074, NVRAM_SIZE, 59); if (m48t59 == NULL) return; sysctrl->nvram = m48t59; /* Initialise NVRAM */ nvram.opaque = m48t59; nvram.read_fn = &m48t59_read; nvram.write_fn = &m48t59_write; PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", ram_size, ppc_boot_device, kernel_base, kernel_size, kernel_cmdline, initrd_base, initrd_size, /* XXX: need an option to load a NVRAM image */ 0, graphic_width, graphic_height, graphic_depth); }
false
qemu
c16547326988cc321c9bff43ed91cbe753e52892
static void ppc_prep_init(QEMUMachineInitArgs *args) { ram_addr_t ram_size = args->ram_size; const char *cpu_model = args->cpu_model; const char *kernel_filename = args->kernel_filename; const char *kernel_cmdline = args->kernel_cmdline; const char *initrd_filename = args->initrd_filename; const char *boot_device = args->boot_device; MemoryRegion *sysmem = get_system_memory(); PowerPCCPU *cpu = NULL; CPUPPCState *env = NULL; char *filename; nvram_t nvram; M48t59State *m48t59; MemoryRegion *PPC_io_memory = g_new(MemoryRegion, 1); PortioList *port_list = g_new(PortioList, 1); #if 0 MemoryRegion *xcsr = g_new(MemoryRegion, 1); #endif int linux_boot, i, nb_nics1, bios_size; MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios = g_new(MemoryRegion, 1); uint32_t kernel_base, initrd_base; long kernel_size, initrd_size; DeviceState *dev; PCIHostState *pcihost; PCIBus *pci_bus; PCIDevice *pci; ISABus *isa_bus; ISADevice *isa; qemu_irq *cpu_exit_irq; int ppc_boot_device; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; sysctrl = g_malloc0(sizeof(sysctrl_t)); linux_boot = (kernel_filename != NULL); if (cpu_model == NULL) cpu_model = "602"; for (i = 0; i < smp_cpus; i++) { cpu = cpu_ppc_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } env = &cpu->env; if (env->flags & POWERPC_FLAG_RTC_CLK) { cpu_ppc_tb_init(env, 7812500UL); } else { cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); } qemu_register_reset(ppc_prep_reset, cpu); } memory_region_init_ram(ram, NULL, "ppc_prep.ram", ram_size); vmstate_register_ram_global(ram); memory_region_add_subregion(sysmem, 0, ram); memory_region_init_ram(bios, NULL, "ppc_prep.bios", BIOS_SIZE); memory_region_set_readonly(bios, true); memory_region_add_subregion(sysmem, (uint32_t)(-BIOS_SIZE), bios); vmstate_register_ram_global(bios); if (bios_name == NULL) bios_name = BIOS_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = load_elf(filename, NULL, NULL, NULL, NULL, NULL, 1, ELF_MACHINE, 0); if (bios_size < 0) { bios_size = get_image_size(filename); if (bios_size > 0 && bios_size <= BIOS_SIZE) { hwaddr bios_addr; bios_size = (bios_size + 0xfff) & ~0xfff; bios_addr = (uint32_t)(-bios_size); bios_size = load_image_targphys(filename, bios_addr, bios_size); } if (bios_size > BIOS_SIZE) { fprintf(stderr, "qemu: PReP bios '%s' is too large (0x%x)\n", bios_name, bios_size); exit(1); } } } else { bios_size = -1; } if (bios_size < 0 && !qtest_enabled()) { fprintf(stderr, "qemu: could not load PPC PReP bios '%s'\n", bios_name); exit(1); } if (filename) { g_free(filename); } if (linux_boot) { kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { hw_error("qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } if (initrd_filename) { initrd_base = INITRD_LOAD_ADDR; initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { hw_error("qemu: could not load initial ram disk '%s'\n", initrd_filename); } } else { initrd_base = 0; initrd_size = 0; } ppc_boot_device = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; ppc_boot_device = '\0'; for (i = 0; boot_device[i] != '\0'; i++) { if (boot_device[i] >= 'a' && boot_device[i] <= 'f') { ppc_boot_device = boot_device[i]; break; } } if (ppc_boot_device == '\0') { fprintf(stderr, "No valid boot device for Mac99 machine\n"); exit(1); } } if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) { hw_error("Only 6xx bus is supported on PREP machine\n"); } dev = qdev_create(NULL, "raven-pcihost"); pcihost = PCI_HOST_BRIDGE(dev); object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev), NULL); qdev_init_nofail(dev); pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0"); if (pci_bus == NULL) { fprintf(stderr, "Couldn't create PCI host controller.\n"); exit(1); } pci = pci_create_simple(pci_bus, PCI_DEVFN(1, 0), "i82378"); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); cpu = POWERPC_CPU(first_cpu); qdev_connect_gpio_out(&pci->qdev, 0, cpu->env.irq_inputs[PPC6xx_INPUT_INT]); qdev_connect_gpio_out(&pci->qdev, 1, *cpu_exit_irq); sysbus_connect_irq(&pcihost->busdev, 0, qdev_get_gpio_in(&pci->qdev, 9)); sysbus_connect_irq(&pcihost->busdev, 1, qdev_get_gpio_in(&pci->qdev, 11)); sysbus_connect_irq(&pcihost->busdev, 2, qdev_get_gpio_in(&pci->qdev, 9)); sysbus_connect_irq(&pcihost->busdev, 3, qdev_get_gpio_in(&pci->qdev, 11)); isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci), "isa.0")); isa = isa_create(isa_bus, TYPE_PC87312); dev = DEVICE(isa); qdev_prop_set_uint8(dev, "config", 13); qdev_init_nofail(dev); memory_region_init_io(PPC_io_memory, NULL, &PPC_prep_io_ops, sysctrl, "ppc-io", 0x00800000); memory_region_add_subregion(sysmem, 0x80000000, PPC_io_memory); pci_vga_init(pci_bus); nb_nics1 = nb_nics; if (nb_nics1 > NE2000_NB_MAX) nb_nics1 = NE2000_NB_MAX; for(i = 0; i < nb_nics1; i++) { if (nd_table[i].model == NULL) { nd_table[i].model = g_strdup("ne2k_isa"); } if (strcmp(nd_table[i].model, "ne2k_isa") == 0) { isa_ne2000_init(isa_bus, ne2000_io[i], ne2000_irq[i], &nd_table[i]); } else { pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL); } } ide_drive_get(hd, MAX_IDE_BUS); for(i = 0; i < MAX_IDE_BUS; i++) { isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[2 * i], hd[2 * i + 1]); } isa_create_simple(isa_bus, "i8042"); cpu = POWERPC_CPU(first_cpu); sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET]; portio_list_init(port_list, NULL, prep_portio_list, sysctrl, "prep"); portio_list_add(port_list, get_system_io(), 0x0); #if 0 memory_region_init_io(xcsr, NULL, &PPC_XCSR_ops, NULL, "ppc-xcsr", 0x1000); memory_region_add_subregion(sysmem, 0xFEFF0000, xcsr); #endif if (usb_enabled(false)) { pci_create_simple(pci_bus, -1, "pci-ohci"); } m48t59 = m48t59_init_isa(isa_bus, 0x0074, NVRAM_SIZE, 59); if (m48t59 == NULL) return; sysctrl->nvram = m48t59; nvram.opaque = m48t59; nvram.read_fn = &m48t59_read; nvram.write_fn = &m48t59_write; PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", ram_size, ppc_boot_device, kernel_base, kernel_size, kernel_cmdline, initrd_base, initrd_size, 0, graphic_width, graphic_height, graphic_depth); }
{ "code": [], "line_no": [] }
static void FUNC_0(QEMUMachineInitArgs *VAR_0) { ram_addr_t ram_size = VAR_0->ram_size; const char *VAR_1 = VAR_0->VAR_1; const char *VAR_2 = VAR_0->VAR_2; const char *VAR_3 = VAR_0->VAR_3; const char *VAR_4 = VAR_0->VAR_4; const char *VAR_5 = VAR_0->VAR_5; MemoryRegion *sysmem = get_system_memory(); PowerPCCPU *cpu = NULL; CPUPPCState *env = NULL; char *VAR_6; nvram_t nvram; M48t59State *m48t59; MemoryRegion *PPC_io_memory = g_new(MemoryRegion, 1); PortioList *port_list = g_new(PortioList, 1); #if 0 MemoryRegion *xcsr = g_new(MemoryRegion, 1); #endif int VAR_7, VAR_8, VAR_9, VAR_10; MemoryRegion *ram = g_new(MemoryRegion, 1); MemoryRegion *bios = g_new(MemoryRegion, 1); uint32_t kernel_base, initrd_base; long VAR_11, VAR_12; DeviceState *dev; PCIHostState *pcihost; PCIBus *pci_bus; PCIDevice *pci; ISABus *isa_bus; ISADevice *isa; qemu_irq *cpu_exit_irq; int VAR_13; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; sysctrl = g_malloc0(sizeof(sysctrl_t)); VAR_7 = (VAR_2 != NULL); if (VAR_1 == NULL) VAR_1 = "602"; for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) { cpu = cpu_ppc_init(VAR_1); if (cpu == NULL) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } env = &cpu->env; if (env->flags & POWERPC_FLAG_RTC_CLK) { cpu_ppc_tb_init(env, 7812500UL); } else { cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL); } qemu_register_reset(ppc_prep_reset, cpu); } memory_region_init_ram(ram, NULL, "ppc_prep.ram", ram_size); vmstate_register_ram_global(ram); memory_region_add_subregion(sysmem, 0, ram); memory_region_init_ram(bios, NULL, "ppc_prep.bios", BIOS_SIZE); memory_region_set_readonly(bios, true); memory_region_add_subregion(sysmem, (uint32_t)(-BIOS_SIZE), bios); vmstate_register_ram_global(bios); if (bios_name == NULL) bios_name = BIOS_FILENAME; VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (VAR_6) { VAR_10 = load_elf(VAR_6, NULL, NULL, NULL, NULL, NULL, 1, ELF_MACHINE, 0); if (VAR_10 < 0) { VAR_10 = get_image_size(VAR_6); if (VAR_10 > 0 && VAR_10 <= BIOS_SIZE) { hwaddr bios_addr; VAR_10 = (VAR_10 + 0xfff) & ~0xfff; bios_addr = (uint32_t)(-VAR_10); VAR_10 = load_image_targphys(VAR_6, bios_addr, VAR_10); } if (VAR_10 > BIOS_SIZE) { fprintf(stderr, "qemu: PReP bios '%s' is too large (0x%x)\n", bios_name, VAR_10); exit(1); } } } else { VAR_10 = -1; } if (VAR_10 < 0 && !qtest_enabled()) { fprintf(stderr, "qemu: could not load PPC PReP bios '%s'\n", bios_name); exit(1); } if (VAR_6) { g_free(VAR_6); } if (VAR_7) { kernel_base = KERNEL_LOAD_ADDR; VAR_11 = load_image_targphys(VAR_2, kernel_base, ram_size - kernel_base); if (VAR_11 < 0) { hw_error("qemu: could not load kernel '%s'\n", VAR_2); exit(1); } if (VAR_4) { initrd_base = INITRD_LOAD_ADDR; VAR_12 = load_image_targphys(VAR_4, initrd_base, ram_size - initrd_base); if (VAR_12 < 0) { hw_error("qemu: could not load initial ram disk '%s'\n", VAR_4); } } else { initrd_base = 0; VAR_12 = 0; } VAR_13 = 'm'; } else { kernel_base = 0; VAR_11 = 0; initrd_base = 0; VAR_12 = 0; VAR_13 = '\0'; for (VAR_8 = 0; VAR_5[VAR_8] != '\0'; VAR_8++) { if (VAR_5[VAR_8] >= 'a' && VAR_5[VAR_8] <= 'f') { VAR_13 = VAR_5[VAR_8]; break; } } if (VAR_13 == '\0') { fprintf(stderr, "No valid boot device for Mac99 machine\n"); exit(1); } } if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) { hw_error("Only 6xx bus is supported on PREP machine\n"); } dev = qdev_create(NULL, "raven-pcihost"); pcihost = PCI_HOST_BRIDGE(dev); object_property_add_child(qdev_get_machine(), "raven", OBJECT(dev), NULL); qdev_init_nofail(dev); pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0"); if (pci_bus == NULL) { fprintf(stderr, "Couldn't create PCI host controller.\n"); exit(1); } pci = pci_create_simple(pci_bus, PCI_DEVFN(1, 0), "i82378"); cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1); cpu = POWERPC_CPU(first_cpu); qdev_connect_gpio_out(&pci->qdev, 0, cpu->env.irq_inputs[PPC6xx_INPUT_INT]); qdev_connect_gpio_out(&pci->qdev, 1, *cpu_exit_irq); sysbus_connect_irq(&pcihost->busdev, 0, qdev_get_gpio_in(&pci->qdev, 9)); sysbus_connect_irq(&pcihost->busdev, 1, qdev_get_gpio_in(&pci->qdev, 11)); sysbus_connect_irq(&pcihost->busdev, 2, qdev_get_gpio_in(&pci->qdev, 9)); sysbus_connect_irq(&pcihost->busdev, 3, qdev_get_gpio_in(&pci->qdev, 11)); isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci), "isa.0")); isa = isa_create(isa_bus, TYPE_PC87312); dev = DEVICE(isa); qdev_prop_set_uint8(dev, "config", 13); qdev_init_nofail(dev); memory_region_init_io(PPC_io_memory, NULL, &PPC_prep_io_ops, sysctrl, "ppc-io", 0x00800000); memory_region_add_subregion(sysmem, 0x80000000, PPC_io_memory); pci_vga_init(pci_bus); VAR_9 = nb_nics; if (VAR_9 > NE2000_NB_MAX) VAR_9 = NE2000_NB_MAX; for(VAR_8 = 0; VAR_8 < VAR_9; VAR_8++) { if (nd_table[VAR_8].model == NULL) { nd_table[VAR_8].model = g_strdup("ne2k_isa"); } if (strcmp(nd_table[VAR_8].model, "ne2k_isa") == 0) { isa_ne2000_init(isa_bus, ne2000_io[VAR_8], ne2000_irq[VAR_8], &nd_table[VAR_8]); } else { pci_nic_init_nofail(&nd_table[VAR_8], pci_bus, "ne2k_pci", NULL); } } ide_drive_get(hd, MAX_IDE_BUS); for(VAR_8 = 0; VAR_8 < MAX_IDE_BUS; VAR_8++) { isa_ide_init(isa_bus, ide_iobase[VAR_8], ide_iobase2[VAR_8], ide_irq[VAR_8], hd[2 * VAR_8], hd[2 * VAR_8 + 1]); } isa_create_simple(isa_bus, "i8042"); cpu = POWERPC_CPU(first_cpu); sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET]; portio_list_init(port_list, NULL, prep_portio_list, sysctrl, "prep"); portio_list_add(port_list, get_system_io(), 0x0); #if 0 memory_region_init_io(xcsr, NULL, &PPC_XCSR_ops, NULL, "ppc-xcsr", 0x1000); memory_region_add_subregion(sysmem, 0xFEFF0000, xcsr); #endif if (usb_enabled(false)) { pci_create_simple(pci_bus, -1, "pci-ohci"); } m48t59 = m48t59_init_isa(isa_bus, 0x0074, NVRAM_SIZE, 59); if (m48t59 == NULL) return; sysctrl->nvram = m48t59; nvram.opaque = m48t59; nvram.read_fn = &m48t59_read; nvram.write_fn = &m48t59_write; PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, "PREP", ram_size, VAR_13, kernel_base, VAR_11, VAR_3, initrd_base, VAR_12, 0, graphic_width, graphic_height, graphic_depth); }
[ "static void FUNC_0(QEMUMachineInitArgs *VAR_0)\n{", "ram_addr_t ram_size = VAR_0->ram_size;", "const char *VAR_1 = VAR_0->VAR_1;", "const char *VAR_2 = VAR_0->VAR_2;", "const char *VAR_3 = VAR_0->VAR_3;", "const char *VAR_4 = VAR_0->VAR_4;", "const char *VAR_5 = VAR_0->VAR_5;", "MemoryRegion *sysmem = get_system_memory();", "PowerPCCPU *cpu = NULL;", "CPUPPCState *env = NULL;", "char *VAR_6;", "nvram_t nvram;", "M48t59State *m48t59;", "MemoryRegion *PPC_io_memory = g_new(MemoryRegion, 1);", "PortioList *port_list = g_new(PortioList, 1);", "#if 0\nMemoryRegion *xcsr = g_new(MemoryRegion, 1);", "#endif\nint VAR_7, VAR_8, VAR_9, VAR_10;", "MemoryRegion *ram = g_new(MemoryRegion, 1);", "MemoryRegion *bios = g_new(MemoryRegion, 1);", "uint32_t kernel_base, initrd_base;", "long VAR_11, VAR_12;", "DeviceState *dev;", "PCIHostState *pcihost;", "PCIBus *pci_bus;", "PCIDevice *pci;", "ISABus *isa_bus;", "ISADevice *isa;", "qemu_irq *cpu_exit_irq;", "int VAR_13;", "DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];", "sysctrl = g_malloc0(sizeof(sysctrl_t));", "VAR_7 = (VAR_2 != NULL);", "if (VAR_1 == NULL)\nVAR_1 = \"602\";", "for (VAR_8 = 0; VAR_8 < smp_cpus; VAR_8++) {", "cpu = cpu_ppc_init(VAR_1);", "if (cpu == NULL) {", "fprintf(stderr, \"Unable to find PowerPC CPU definition\\n\");", "exit(1);", "}", "env = &cpu->env;", "if (env->flags & POWERPC_FLAG_RTC_CLK) {", "cpu_ppc_tb_init(env, 7812500UL);", "} else {", "cpu_ppc_tb_init(env, 100UL * 1000UL * 1000UL);", "}", "qemu_register_reset(ppc_prep_reset, cpu);", "}", "memory_region_init_ram(ram, NULL, \"ppc_prep.ram\", ram_size);", "vmstate_register_ram_global(ram);", "memory_region_add_subregion(sysmem, 0, ram);", "memory_region_init_ram(bios, NULL, \"ppc_prep.bios\", BIOS_SIZE);", "memory_region_set_readonly(bios, true);", "memory_region_add_subregion(sysmem, (uint32_t)(-BIOS_SIZE), bios);", "vmstate_register_ram_global(bios);", "if (bios_name == NULL)\nbios_name = BIOS_FILENAME;", "VAR_6 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (VAR_6) {", "VAR_10 = load_elf(VAR_6, NULL, NULL, NULL,\nNULL, NULL, 1, ELF_MACHINE, 0);", "if (VAR_10 < 0) {", "VAR_10 = get_image_size(VAR_6);", "if (VAR_10 > 0 && VAR_10 <= BIOS_SIZE) {", "hwaddr bios_addr;", "VAR_10 = (VAR_10 + 0xfff) & ~0xfff;", "bios_addr = (uint32_t)(-VAR_10);", "VAR_10 = load_image_targphys(VAR_6, bios_addr, VAR_10);", "}", "if (VAR_10 > BIOS_SIZE) {", "fprintf(stderr, \"qemu: PReP bios '%s' is too large (0x%x)\\n\",\nbios_name, VAR_10);", "exit(1);", "}", "}", "} else {", "VAR_10 = -1;", "}", "if (VAR_10 < 0 && !qtest_enabled()) {", "fprintf(stderr, \"qemu: could not load PPC PReP bios '%s'\\n\",\nbios_name);", "exit(1);", "}", "if (VAR_6) {", "g_free(VAR_6);", "}", "if (VAR_7) {", "kernel_base = KERNEL_LOAD_ADDR;", "VAR_11 = load_image_targphys(VAR_2, kernel_base,\nram_size - kernel_base);", "if (VAR_11 < 0) {", "hw_error(\"qemu: could not load kernel '%s'\\n\", VAR_2);", "exit(1);", "}", "if (VAR_4) {", "initrd_base = INITRD_LOAD_ADDR;", "VAR_12 = load_image_targphys(VAR_4, initrd_base,\nram_size - initrd_base);", "if (VAR_12 < 0) {", "hw_error(\"qemu: could not load initial ram disk '%s'\\n\",\nVAR_4);", "}", "} else {", "initrd_base = 0;", "VAR_12 = 0;", "}", "VAR_13 = 'm';", "} else {", "kernel_base = 0;", "VAR_11 = 0;", "initrd_base = 0;", "VAR_12 = 0;", "VAR_13 = '\\0';", "for (VAR_8 = 0; VAR_5[VAR_8] != '\\0'; VAR_8++) {", "if (VAR_5[VAR_8] >= 'a' && VAR_5[VAR_8] <= 'f') {", "VAR_13 = VAR_5[VAR_8];", "break;", "}", "}", "if (VAR_13 == '\\0') {", "fprintf(stderr, \"No valid boot device for Mac99 machine\\n\");", "exit(1);", "}", "}", "if (PPC_INPUT(env) != PPC_FLAGS_INPUT_6xx) {", "hw_error(\"Only 6xx bus is supported on PREP machine\\n\");", "}", "dev = qdev_create(NULL, \"raven-pcihost\");", "pcihost = PCI_HOST_BRIDGE(dev);", "object_property_add_child(qdev_get_machine(), \"raven\", OBJECT(dev), NULL);", "qdev_init_nofail(dev);", "pci_bus = (PCIBus *)qdev_get_child_bus(dev, \"pci.0\");", "if (pci_bus == NULL) {", "fprintf(stderr, \"Couldn't create PCI host controller.\\n\");", "exit(1);", "}", "pci = pci_create_simple(pci_bus, PCI_DEVFN(1, 0), \"i82378\");", "cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);", "cpu = POWERPC_CPU(first_cpu);", "qdev_connect_gpio_out(&pci->qdev, 0,\ncpu->env.irq_inputs[PPC6xx_INPUT_INT]);", "qdev_connect_gpio_out(&pci->qdev, 1, *cpu_exit_irq);", "sysbus_connect_irq(&pcihost->busdev, 0, qdev_get_gpio_in(&pci->qdev, 9));", "sysbus_connect_irq(&pcihost->busdev, 1, qdev_get_gpio_in(&pci->qdev, 11));", "sysbus_connect_irq(&pcihost->busdev, 2, qdev_get_gpio_in(&pci->qdev, 9));", "sysbus_connect_irq(&pcihost->busdev, 3, qdev_get_gpio_in(&pci->qdev, 11));", "isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(pci), \"isa.0\"));", "isa = isa_create(isa_bus, TYPE_PC87312);", "dev = DEVICE(isa);", "qdev_prop_set_uint8(dev, \"config\", 13);", "qdev_init_nofail(dev);", "memory_region_init_io(PPC_io_memory, NULL, &PPC_prep_io_ops, sysctrl,\n\"ppc-io\", 0x00800000);", "memory_region_add_subregion(sysmem, 0x80000000, PPC_io_memory);", "pci_vga_init(pci_bus);", "VAR_9 = nb_nics;", "if (VAR_9 > NE2000_NB_MAX)\nVAR_9 = NE2000_NB_MAX;", "for(VAR_8 = 0; VAR_8 < VAR_9; VAR_8++) {", "if (nd_table[VAR_8].model == NULL) {", "nd_table[VAR_8].model = g_strdup(\"ne2k_isa\");", "}", "if (strcmp(nd_table[VAR_8].model, \"ne2k_isa\") == 0) {", "isa_ne2000_init(isa_bus, ne2000_io[VAR_8], ne2000_irq[VAR_8],\n&nd_table[VAR_8]);", "} else {", "pci_nic_init_nofail(&nd_table[VAR_8], pci_bus, \"ne2k_pci\", NULL);", "}", "}", "ide_drive_get(hd, MAX_IDE_BUS);", "for(VAR_8 = 0; VAR_8 < MAX_IDE_BUS; VAR_8++) {", "isa_ide_init(isa_bus, ide_iobase[VAR_8], ide_iobase2[VAR_8], ide_irq[VAR_8],\nhd[2 * VAR_8],\nhd[2 * VAR_8 + 1]);", "}", "isa_create_simple(isa_bus, \"i8042\");", "cpu = POWERPC_CPU(first_cpu);", "sysctrl->reset_irq = cpu->env.irq_inputs[PPC6xx_INPUT_HRESET];", "portio_list_init(port_list, NULL, prep_portio_list, sysctrl, \"prep\");", "portio_list_add(port_list, get_system_io(), 0x0);", "#if 0\nmemory_region_init_io(xcsr, NULL, &PPC_XCSR_ops, NULL, \"ppc-xcsr\", 0x1000);", "memory_region_add_subregion(sysmem, 0xFEFF0000, xcsr);", "#endif\nif (usb_enabled(false)) {", "pci_create_simple(pci_bus, -1, \"pci-ohci\");", "}", "m48t59 = m48t59_init_isa(isa_bus, 0x0074, NVRAM_SIZE, 59);", "if (m48t59 == NULL)\nreturn;", "sysctrl->nvram = m48t59;", "nvram.opaque = m48t59;", "nvram.read_fn = &m48t59_read;", "nvram.write_fn = &m48t59_write;", "PPC_NVRAM_set_params(&nvram, NVRAM_SIZE, \"PREP\", ram_size, VAR_13,\nkernel_base, VAR_11,\nVAR_3,\ninitrd_base, VAR_12,\n0,\ngraphic_width, graphic_height, graphic_depth);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 69 ], [ 73 ], [ 79, 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 121 ], [ 123 ], [ 125 ], [ 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 ], [ 203 ], [ 205 ], [ 209, 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 223 ], [ 225 ], [ 227, 229 ], [ 231 ], [ 233, 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 287 ], [ 289 ], [ 291 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 317 ], [ 319 ], [ 321 ], [ 323, 325 ], [ 327 ], [ 329 ], [ 331 ], [ 333 ], [ 335 ], [ 337 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ], [ 355, 357 ], [ 359 ], [ 365 ], [ 369 ], [ 371, 373 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385, 387 ], [ 389 ], [ 391 ], [ 393 ], [ 395 ], [ 399 ], [ 401 ], [ 403, 405, 407 ], [ 409 ], [ 411 ], [ 415 ], [ 417 ], [ 421 ], [ 423 ], [ 429, 431 ], [ 433 ], [ 435, 439 ], [ 441 ], [ 443 ], [ 447 ], [ 449, 451 ], [ 453 ], [ 459 ], [ 461 ], [ 463 ], [ 465, 467, 469, 471, 475, 477 ], [ 479 ] ]
15,167
static void smc91c111_cleanup(NetClientState *nc) { smc91c111_state *s = qemu_get_nic_opaque(nc); s->nic = NULL; }
false
qemu
57407ea44cc0a3d630b9b89a2be011f1955ce5c1
static void smc91c111_cleanup(NetClientState *nc) { smc91c111_state *s = qemu_get_nic_opaque(nc); s->nic = NULL; }
{ "code": [], "line_no": [] }
static void FUNC_0(NetClientState *VAR_0) { smc91c111_state *s = qemu_get_nic_opaque(VAR_0); s->nic = NULL; }
[ "static void FUNC_0(NetClientState *VAR_0)\n{", "smc91c111_state *s = qemu_get_nic_opaque(VAR_0);", "s->nic = NULL;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ] ]
15,168
e1000e_setup_tx_offloads(E1000ECore *core, struct e1000e_tx *tx) { if (tx->props.tse && tx->props.cptse) { net_tx_pkt_build_vheader(tx->tx_pkt, true, true, tx->props.mss); net_tx_pkt_update_ip_checksums(tx->tx_pkt); e1000x_inc_reg_if_not_full(core->mac, TSCTC); return; } if (tx->props.sum_needed & E1000_TXD_POPTS_TXSM) { net_tx_pkt_build_vheader(tx->tx_pkt, false, true, 0); } if (tx->props.sum_needed & E1000_TXD_POPTS_IXSM) { net_tx_pkt_update_ip_hdr_checksum(tx->tx_pkt); } }
false
qemu
7d08c73e7bdc39b10e5f2f5acdce700f17ffe962
e1000e_setup_tx_offloads(E1000ECore *core, struct e1000e_tx *tx) { if (tx->props.tse && tx->props.cptse) { net_tx_pkt_build_vheader(tx->tx_pkt, true, true, tx->props.mss); net_tx_pkt_update_ip_checksums(tx->tx_pkt); e1000x_inc_reg_if_not_full(core->mac, TSCTC); return; } if (tx->props.sum_needed & E1000_TXD_POPTS_TXSM) { net_tx_pkt_build_vheader(tx->tx_pkt, false, true, 0); } if (tx->props.sum_needed & E1000_TXD_POPTS_IXSM) { net_tx_pkt_update_ip_hdr_checksum(tx->tx_pkt); } }
{ "code": [], "line_no": [] }
FUNC_0(E1000ECore *VAR_0, struct e1000e_tx *VAR_1) { if (VAR_1->props.tse && VAR_1->props.cptse) { net_tx_pkt_build_vheader(VAR_1->tx_pkt, true, true, VAR_1->props.mss); net_tx_pkt_update_ip_checksums(VAR_1->tx_pkt); e1000x_inc_reg_if_not_full(VAR_0->mac, TSCTC); return; } if (VAR_1->props.sum_needed & E1000_TXD_POPTS_TXSM) { net_tx_pkt_build_vheader(VAR_1->tx_pkt, false, true, 0); } if (VAR_1->props.sum_needed & E1000_TXD_POPTS_IXSM) { net_tx_pkt_update_ip_hdr_checksum(VAR_1->tx_pkt); } }
[ "FUNC_0(E1000ECore *VAR_0, struct e1000e_tx *VAR_1)\n{", "if (VAR_1->props.tse && VAR_1->props.cptse) {", "net_tx_pkt_build_vheader(VAR_1->tx_pkt, true, true, VAR_1->props.mss);", "net_tx_pkt_update_ip_checksums(VAR_1->tx_pkt);", "e1000x_inc_reg_if_not_full(VAR_0->mac, TSCTC);", "return;", "}", "if (VAR_1->props.sum_needed & E1000_TXD_POPTS_TXSM) {", "net_tx_pkt_build_vheader(VAR_1->tx_pkt, false, true, 0);", "}", "if (VAR_1->props.sum_needed & E1000_TXD_POPTS_IXSM) {", "net_tx_pkt_update_ip_hdr_checksum(VAR_1->tx_pkt);", "}", "}" ]
[ 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 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ] ]
15,169
static ssize_t proxy_pwritev(FsContext *ctx, V9fsFidOpenState *fs, const struct iovec *iov, int iovcnt, off_t offset) { ssize_t ret; #ifdef CONFIG_PREADV ret = pwritev(fs->fd, iov, iovcnt, offset); #else ret = lseek(fs->fd, offset, SEEK_SET); if (ret >= 0) { ret = writev(fs->fd, iov, iovcnt); } #endif #ifdef CONFIG_SYNC_FILE_RANGE if (ret > 0 && ctx->export_flags & V9FS_IMMEDIATE_WRITEOUT) { /* * Initiate a writeback. This is not a data integrity sync. * We want to ensure that we don't leave dirty pages in the cache * after write when writeout=immediate is sepcified. */ sync_file_range(fs->fd, offset, ret, SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE); } #endif return ret; }
false
qemu
494a8ebe713055d3946183f4b395f85a18b43e9e
static ssize_t proxy_pwritev(FsContext *ctx, V9fsFidOpenState *fs, const struct iovec *iov, int iovcnt, off_t offset) { ssize_t ret; #ifdef CONFIG_PREADV ret = pwritev(fs->fd, iov, iovcnt, offset); #else ret = lseek(fs->fd, offset, SEEK_SET); if (ret >= 0) { ret = writev(fs->fd, iov, iovcnt); } #endif #ifdef CONFIG_SYNC_FILE_RANGE if (ret > 0 && ctx->export_flags & V9FS_IMMEDIATE_WRITEOUT) { sync_file_range(fs->fd, offset, ret, SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE); } #endif return ret; }
{ "code": [], "line_no": [] }
static ssize_t FUNC_0(FsContext *ctx, V9fsFidOpenState *fs, const struct iovec *iov, int iovcnt, off_t offset) { ssize_t ret; #ifdef CONFIG_PREADV ret = pwritev(fs->fd, iov, iovcnt, offset); #else ret = lseek(fs->fd, offset, SEEK_SET); if (ret >= 0) { ret = writev(fs->fd, iov, iovcnt); } #endif #ifdef CONFIG_SYNC_FILE_RANGE if (ret > 0 && ctx->export_flags & V9FS_IMMEDIATE_WRITEOUT) { sync_file_range(fs->fd, offset, ret, SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE); } #endif return ret; }
[ "static ssize_t FUNC_0(FsContext *ctx, V9fsFidOpenState *fs,\nconst struct iovec *iov,\nint iovcnt, off_t offset)\n{", "ssize_t ret;", "#ifdef CONFIG_PREADV\nret = pwritev(fs->fd, iov, iovcnt, offset);", "#else\nret = lseek(fs->fd, offset, SEEK_SET);", "if (ret >= 0) {", "ret = writev(fs->fd, iov, iovcnt);", "}", "#endif\n#ifdef CONFIG_SYNC_FILE_RANGE\nif (ret > 0 && ctx->export_flags & V9FS_IMMEDIATE_WRITEOUT) {", "sync_file_range(fs->fd, offset, ret,\nSYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE);", "}", "#endif\nreturn ret;", "}" ]
[ 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 ], [ 43, 45 ], [ 47 ], [ 49, 51 ], [ 53 ] ]
15,170
static int ppc6xx_tlb_check (CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int access_type) { ppc6xx_tlb_t *tlb; int nr, best, way; int ret; best = -1; ret = -1; /* No TLB found */ for (way = 0; way < env->nb_ways; way++) { nr = ppc6xx_tlb_getnum(env, eaddr, way, access_type == ACCESS_CODE ? 1 : 0); tlb = &env->tlb[nr].tlb6; /* This test "emulates" the PTE index match for hardware TLBs */ if ((eaddr & TARGET_PAGE_MASK) != tlb->EPN) { #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "TLB %d/%d %s [" ADDRX " " ADDRX "] <> " ADDRX "\n", nr, env->nb_tlb, pte_is_valid(tlb->pte0) ? "valid" : "inval", tlb->EPN, tlb->EPN + TARGET_PAGE_SIZE, eaddr); } #endif continue; } #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "TLB %d/%d %s " ADDRX " <> " ADDRX " " ADDRX " %c %c\n", nr, env->nb_tlb, pte_is_valid(tlb->pte0) ? "valid" : "inval", tlb->EPN, eaddr, tlb->pte1, rw ? 'S' : 'L', access_type == ACCESS_CODE ? 'I' : 'D'); } #endif switch (pte32_check(ctx, tlb->pte0, tlb->pte1, 0, rw)) { case -3: /* TLB inconsistency */ return -1; case -2: /* Access violation */ ret = -2; best = nr; break; case -1: default: /* No match */ break; case 0: /* access granted */ /* XXX: we should go on looping to check all TLBs consistency * but we can speed-up the whole thing as the * result would be undefined if TLBs are not consistent. */ ret = 0; best = nr; goto done; } } if (best != -1) { done: #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "found TLB at addr 0x%08lx prot=0x%01x ret=%d\n", ctx->raddr & TARGET_PAGE_MASK, ctx->prot, ret); } #endif /* Update page flags */ pte_update_flags(ctx, &env->tlb[best].tlb6.pte1, ret, rw); } return ret; }
false
qemu
b227a8e9aa5f27d29f77ba90d5eb9d0662a1175e
static int ppc6xx_tlb_check (CPUState *env, mmu_ctx_t *ctx, target_ulong eaddr, int rw, int access_type) { ppc6xx_tlb_t *tlb; int nr, best, way; int ret; best = -1; ret = -1; for (way = 0; way < env->nb_ways; way++) { nr = ppc6xx_tlb_getnum(env, eaddr, way, access_type == ACCESS_CODE ? 1 : 0); tlb = &env->tlb[nr].tlb6; if ((eaddr & TARGET_PAGE_MASK) != tlb->EPN) { #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "TLB %d/%d %s [" ADDRX " " ADDRX "] <> " ADDRX "\n", nr, env->nb_tlb, pte_is_valid(tlb->pte0) ? "valid" : "inval", tlb->EPN, tlb->EPN + TARGET_PAGE_SIZE, eaddr); } #endif continue; } #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "TLB %d/%d %s " ADDRX " <> " ADDRX " " ADDRX " %c %c\n", nr, env->nb_tlb, pte_is_valid(tlb->pte0) ? "valid" : "inval", tlb->EPN, eaddr, tlb->pte1, rw ? 'S' : 'L', access_type == ACCESS_CODE ? 'I' : 'D'); } #endif switch (pte32_check(ctx, tlb->pte0, tlb->pte1, 0, rw)) { case -3: return -1; case -2: ret = -2; best = nr; break; case -1: default: break; case 0: ret = 0; best = nr; goto done; } } if (best != -1) { done: #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "found TLB at addr 0x%08lx prot=0x%01x ret=%d\n", ctx->raddr & TARGET_PAGE_MASK, ctx->prot, ret); } #endif pte_update_flags(ctx, &env->tlb[best].tlb6.pte1, ret, rw); } return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0 (CPUState *VAR_0, mmu_ctx_t *VAR_1, target_ulong VAR_2, int VAR_3, int VAR_4) { ppc6xx_tlb_t *tlb; int VAR_5, VAR_6, VAR_7; int VAR_8; VAR_6 = -1; VAR_8 = -1; for (VAR_7 = 0; VAR_7 < VAR_0->nb_ways; VAR_7++) { VAR_5 = ppc6xx_tlb_getnum(VAR_0, VAR_2, VAR_7, VAR_4 == ACCESS_CODE ? 1 : 0); tlb = &VAR_0->tlb[VAR_5].tlb6; if ((VAR_2 & TARGET_PAGE_MASK) != tlb->EPN) { #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "TLB %d/%d %s [" ADDRX " " ADDRX "] <> " ADDRX "\n", VAR_5, VAR_0->nb_tlb, pte_is_valid(tlb->pte0) ? "valid" : "inval", tlb->EPN, tlb->EPN + TARGET_PAGE_SIZE, VAR_2); } #endif continue; } #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "TLB %d/%d %s " ADDRX " <> " ADDRX " " ADDRX " %c %c\n", VAR_5, VAR_0->nb_tlb, pte_is_valid(tlb->pte0) ? "valid" : "inval", tlb->EPN, VAR_2, tlb->pte1, VAR_3 ? 'S' : 'L', VAR_4 == ACCESS_CODE ? 'I' : 'D'); } #endif switch (pte32_check(VAR_1, tlb->pte0, tlb->pte1, 0, VAR_3)) { case -3: return -1; case -2: VAR_8 = -2; VAR_6 = VAR_5; break; case -1: default: break; case 0: VAR_8 = 0; VAR_6 = VAR_5; goto done; } } if (VAR_6 != -1) { done: #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { fprintf(logfile, "found TLB at addr 0x%08lx prot=0x%01x VAR_8=%d\n", VAR_1->raddr & TARGET_PAGE_MASK, VAR_1->prot, VAR_8); } #endif pte_update_flags(VAR_1, &VAR_0->tlb[VAR_6].tlb6.pte1, VAR_8, VAR_3); } return VAR_8; }
[ "static int FUNC_0 (CPUState *VAR_0, mmu_ctx_t *VAR_1,\ntarget_ulong VAR_2, int VAR_3, int VAR_4)\n{", "ppc6xx_tlb_t *tlb;", "int VAR_5, VAR_6, VAR_7;", "int VAR_8;", "VAR_6 = -1;", "VAR_8 = -1;", "for (VAR_7 = 0; VAR_7 < VAR_0->nb_ways; VAR_7++) {", "VAR_5 = ppc6xx_tlb_getnum(VAR_0, VAR_2, VAR_7,\nVAR_4 == ACCESS_CODE ? 1 : 0);", "tlb = &VAR_0->tlb[VAR_5].tlb6;", "if ((VAR_2 & TARGET_PAGE_MASK) != tlb->EPN) {", "#if defined (DEBUG_SOFTWARE_TLB)\nif (loglevel != 0) {", "fprintf(logfile, \"TLB %d/%d %s [\" ADDRX \" \" ADDRX\n\"] <> \" ADDRX \"\\n\",\nVAR_5, VAR_0->nb_tlb,\npte_is_valid(tlb->pte0) ? \"valid\" : \"inval\",\ntlb->EPN, tlb->EPN + TARGET_PAGE_SIZE, VAR_2);", "}", "#endif\ncontinue;", "}", "#if defined (DEBUG_SOFTWARE_TLB)\nif (loglevel != 0) {", "fprintf(logfile, \"TLB %d/%d %s \" ADDRX \" <> \" ADDRX \" \" ADDRX\n\" %c %c\\n\",\nVAR_5, VAR_0->nb_tlb,\npte_is_valid(tlb->pte0) ? \"valid\" : \"inval\",\ntlb->EPN, VAR_2, tlb->pte1,\nVAR_3 ? 'S' : 'L', VAR_4 == ACCESS_CODE ? 'I' : 'D');", "}", "#endif\nswitch (pte32_check(VAR_1, tlb->pte0, tlb->pte1, 0, VAR_3)) {", "case -3:\nreturn -1;", "case -2:\nVAR_8 = -2;", "VAR_6 = VAR_5;", "break;", "case -1:\ndefault:\nbreak;", "case 0:\nVAR_8 = 0;", "VAR_6 = VAR_5;", "goto done;", "}", "}", "if (VAR_6 != -1) {", "done:\n#if defined (DEBUG_SOFTWARE_TLB)\nif (loglevel != 0) {", "fprintf(logfile, \"found TLB at addr 0x%08lx prot=0x%01x VAR_8=%d\\n\",\nVAR_1->raddr & TARGET_PAGE_MASK, VAR_1->prot, VAR_8);", "}", "#endif\npte_update_flags(VAR_1, &VAR_0->tlb[VAR_6].tlb6.pte1, VAR_8, VAR_3);", "}", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 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 ], [ 75, 79 ], [ 81, 85 ], [ 87 ], [ 89 ], [ 91, 93, 97 ], [ 99, 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125, 127 ], [ 129, 131 ], [ 133 ], [ 135, 139 ], [ 141 ], [ 145 ], [ 147 ] ]
15,171
static inline bool media_is_dvd(SCSIDiskState *s) { uint64_t nb_sectors; if (s->qdev.type != TYPE_ROM) { return false; } if (!bdrv_is_inserted(s->qdev.conf.bs)) { return false; } bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors); return nb_sectors > CD_MAX_SECTORS; }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static inline bool media_is_dvd(SCSIDiskState *s) { uint64_t nb_sectors; if (s->qdev.type != TYPE_ROM) { return false; } if (!bdrv_is_inserted(s->qdev.conf.bs)) { return false; } bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors); return nb_sectors > CD_MAX_SECTORS; }
{ "code": [], "line_no": [] }
static inline bool FUNC_0(SCSIDiskState *s) { uint64_t nb_sectors; if (s->qdev.type != TYPE_ROM) { return false; } if (!bdrv_is_inserted(s->qdev.conf.bs)) { return false; } bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors); return nb_sectors > CD_MAX_SECTORS; }
[ "static inline bool FUNC_0(SCSIDiskState *s)\n{", "uint64_t nb_sectors;", "if (s->qdev.type != TYPE_ROM) {", "return false;", "}", "if (!bdrv_is_inserted(s->qdev.conf.bs)) {", "return false;", "}", "bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors);", "return nb_sectors > CD_MAX_SECTORS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
15,174
int avpriv_exif_decode_ifd(AVCodecContext *avctx, GetByteContext *gbytes, int le, int depth, AVDictionary **metadata) { int i, ret; int entries; entries = ff_tget_short(gbytes, le); if (bytestream2_get_bytes_left(gbytes) < entries * 12) { return AVERROR_INVALIDDATA; } for (i = 0; i < entries; i++) { if ((ret = exif_decode_tag(avctx, gbytes, le, depth, metadata)) < 0) { return ret; } } // return next IDF offset or 0x000000000 or a value < 0 for failure return ff_tget_long(gbytes, le); }
false
FFmpeg
ce87711df563a9d2d0537a062b86bb91b15ea1a0
int avpriv_exif_decode_ifd(AVCodecContext *avctx, GetByteContext *gbytes, int le, int depth, AVDictionary **metadata) { int i, ret; int entries; entries = ff_tget_short(gbytes, le); if (bytestream2_get_bytes_left(gbytes) < entries * 12) { return AVERROR_INVALIDDATA; } for (i = 0; i < entries; i++) { if ((ret = exif_decode_tag(avctx, gbytes, le, depth, metadata)) < 0) { return ret; } } return ff_tget_long(gbytes, le); }
{ "code": [], "line_no": [] }
int FUNC_0(AVCodecContext *VAR_0, GetByteContext *VAR_1, int VAR_2, int VAR_3, AVDictionary **VAR_4) { int VAR_5, VAR_6; int VAR_7; VAR_7 = ff_tget_short(VAR_1, VAR_2); if (bytestream2_get_bytes_left(VAR_1) < VAR_7 * 12) { return AVERROR_INVALIDDATA; } for (VAR_5 = 0; VAR_5 < VAR_7; VAR_5++) { if ((VAR_6 = exif_decode_tag(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4)) < 0) { return VAR_6; } } return ff_tget_long(VAR_1, VAR_2); }
[ "int FUNC_0(AVCodecContext *VAR_0, GetByteContext *VAR_1, int VAR_2,\nint VAR_3, AVDictionary **VAR_4)\n{", "int VAR_5, VAR_6;", "int VAR_7;", "VAR_7 = ff_tget_short(VAR_1, VAR_2);", "if (bytestream2_get_bytes_left(VAR_1) < VAR_7 * 12) {", "return AVERROR_INVALIDDATA;", "}", "for (VAR_5 = 0; VAR_5 < VAR_7; VAR_5++) {", "if ((VAR_6 = exif_decode_tag(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4)) < 0) {", "return VAR_6;", "}", "}", "return ff_tget_long(VAR_1, VAR_2);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 39 ], [ 41 ] ]
15,175
DeviceState *qdev_create(BusState *bus, const char *name) { DeviceType *t; DeviceState *dev; for (t = device_type_list; t; t = t->next) { if (strcmp(t->info->name, name) == 0) { break; } } if (!t) { hw_error("Unknown device '%s'\n", name); } dev = qemu_mallocz(t->info->size); dev->type = t; if (!bus) { /* ???: This assumes system busses have no additional state. */ if (!main_system_bus) { main_system_bus = qbus_create(BUS_TYPE_SYSTEM, sizeof(BusState), NULL, "main-system-bus"); } bus = main_system_bus; } if (t->info->bus_type != bus->type) { /* TODO: Print bus type names. */ hw_error("Device '%s' on wrong bus type (%d/%d)", name, t->info->bus_type, bus->type); } dev->parent_bus = bus; LIST_INSERT_HEAD(&bus->children, dev, sibling); return dev; }
false
qemu
10c4c98ab7dc18169b37b76f6ea5e60ebe65222b
DeviceState *qdev_create(BusState *bus, const char *name) { DeviceType *t; DeviceState *dev; for (t = device_type_list; t; t = t->next) { if (strcmp(t->info->name, name) == 0) { break; } } if (!t) { hw_error("Unknown device '%s'\n", name); } dev = qemu_mallocz(t->info->size); dev->type = t; if (!bus) { if (!main_system_bus) { main_system_bus = qbus_create(BUS_TYPE_SYSTEM, sizeof(BusState), NULL, "main-system-bus"); } bus = main_system_bus; } if (t->info->bus_type != bus->type) { hw_error("Device '%s' on wrong bus type (%d/%d)", name, t->info->bus_type, bus->type); } dev->parent_bus = bus; LIST_INSERT_HEAD(&bus->children, dev, sibling); return dev; }
{ "code": [], "line_no": [] }
DeviceState *FUNC_0(BusState *bus, const char *name) { DeviceType *t; DeviceState *dev; for (t = device_type_list; t; t = t->next) { if (strcmp(t->info->name, name) == 0) { break; } } if (!t) { hw_error("Unknown device '%s'\n", name); } dev = qemu_mallocz(t->info->size); dev->type = t; if (!bus) { if (!main_system_bus) { main_system_bus = qbus_create(BUS_TYPE_SYSTEM, sizeof(BusState), NULL, "main-system-bus"); } bus = main_system_bus; } if (t->info->bus_type != bus->type) { hw_error("Device '%s' on wrong bus type (%d/%d)", name, t->info->bus_type, bus->type); } dev->parent_bus = bus; LIST_INSERT_HEAD(&bus->children, dev, sibling); return dev; }
[ "DeviceState *FUNC_0(BusState *bus, const char *name)\n{", "DeviceType *t;", "DeviceState *dev;", "for (t = device_type_list; t; t = t->next) {", "if (strcmp(t->info->name, name) == 0) {", "break;", "}", "}", "if (!t) {", "hw_error(\"Unknown device '%s'\\n\", name);", "}", "dev = qemu_mallocz(t->info->size);", "dev->type = t;", "if (!bus) {", "if (!main_system_bus) {", "main_system_bus = qbus_create(BUS_TYPE_SYSTEM, sizeof(BusState),\nNULL, \"main-system-bus\");", "}", "bus = main_system_bus;", "}", "if (t->info->bus_type != bus->type) {", "hw_error(\"Device '%s' on wrong bus type (%d/%d)\", name,\nt->info->bus_type, bus->type);", "}", "dev->parent_bus = bus;", "LIST_INSERT_HEAD(&bus->children, dev, sibling);", "return dev;", "}" ]
[ 0, 0, 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 ], [ 29 ], [ 31 ], [ 35 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ] ]
15,177
static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri) { if (ri->opc2 & 4) { /* Other states are only available with TrustZone; in * a non-TZ implementation these registers don't exist * at all, which is an Uncategorized trap. This underdecoding * is safe because the reginfo is NO_MIGRATE. */ return CP_ACCESS_TRAP_UNCATEGORIZED; } return CP_ACCESS_OK; }
false
qemu
7a0e58fa648736a75f2a6943afd2ab08ea15b8e0
static CPAccessResult ats_access(CPUARMState *env, const ARMCPRegInfo *ri) { if (ri->opc2 & 4) { return CP_ACCESS_TRAP_UNCATEGORIZED; } return CP_ACCESS_OK; }
{ "code": [], "line_no": [] }
static CPAccessResult FUNC_0(CPUARMState *env, const ARMCPRegInfo *ri) { if (ri->opc2 & 4) { return CP_ACCESS_TRAP_UNCATEGORIZED; } return CP_ACCESS_OK; }
[ "static CPAccessResult FUNC_0(CPUARMState *env, const ARMCPRegInfo *ri)\n{", "if (ri->opc2 & 4) {", "return CP_ACCESS_TRAP_UNCATEGORIZED;", "}", "return CP_ACCESS_OK;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
15,178
on_host_init(VSCMsgHeader *mhHeader, VSCMsgInit *incoming) { uint32_t *capabilities = (incoming->capabilities); int num_capabilities = 1 + ((mhHeader->length - sizeof(VSCMsgInit)) / sizeof(uint32_t)); int i; QemuThread thread_id; incoming->version = ntohl(incoming->version); if (incoming->version != VSCARD_VERSION) { if (verbose > 0) { printf("warning: host has version %d, we have %d\n", verbose, VSCARD_VERSION); } } if (incoming->magic != VSCARD_MAGIC) { printf("unexpected magic: got %d, expected %d\n", incoming->magic, VSCARD_MAGIC); return -1; } for (i = 0 ; i < num_capabilities; ++i) { capabilities[i] = ntohl(capabilities[i]); } /* Future: check capabilities */ /* remove whatever reader might be left in qemu, * in case of an unclean previous exit. */ send_msg(VSC_ReaderRemove, VSCARD_MINIMAL_READER_ID, NULL, 0); /* launch the event_thread. This will trigger reader adds for all the * existing readers */ qemu_thread_create(&thread_id, "vsc/event", event_thread, NULL, 0); return 0; }
false
qemu
2a0c46da967e5dc8cfe73b1b6fe7a1600c04f461
on_host_init(VSCMsgHeader *mhHeader, VSCMsgInit *incoming) { uint32_t *capabilities = (incoming->capabilities); int num_capabilities = 1 + ((mhHeader->length - sizeof(VSCMsgInit)) / sizeof(uint32_t)); int i; QemuThread thread_id; incoming->version = ntohl(incoming->version); if (incoming->version != VSCARD_VERSION) { if (verbose > 0) { printf("warning: host has version %d, we have %d\n", verbose, VSCARD_VERSION); } } if (incoming->magic != VSCARD_MAGIC) { printf("unexpected magic: got %d, expected %d\n", incoming->magic, VSCARD_MAGIC); return -1; } for (i = 0 ; i < num_capabilities; ++i) { capabilities[i] = ntohl(capabilities[i]); } send_msg(VSC_ReaderRemove, VSCARD_MINIMAL_READER_ID, NULL, 0); qemu_thread_create(&thread_id, "vsc/event", event_thread, NULL, 0); return 0; }
{ "code": [], "line_no": [] }
FUNC_0(VSCMsgHeader *VAR_0, VSCMsgInit *VAR_1) { uint32_t *capabilities = (VAR_1->capabilities); int VAR_2 = 1 + ((VAR_0->length - sizeof(VSCMsgInit)) / sizeof(uint32_t)); int VAR_3; QemuThread thread_id; VAR_1->version = ntohl(VAR_1->version); if (VAR_1->version != VSCARD_VERSION) { if (verbose > 0) { printf("warning: host has version %d, we have %d\n", verbose, VSCARD_VERSION); } } if (VAR_1->magic != VSCARD_MAGIC) { printf("unexpected magic: got %d, expected %d\n", VAR_1->magic, VSCARD_MAGIC); return -1; } for (VAR_3 = 0 ; VAR_3 < VAR_2; ++VAR_3) { capabilities[VAR_3] = ntohl(capabilities[VAR_3]); } send_msg(VSC_ReaderRemove, VSCARD_MINIMAL_READER_ID, NULL, 0); qemu_thread_create(&thread_id, "vsc/event", event_thread, NULL, 0); return 0; }
[ "FUNC_0(VSCMsgHeader *VAR_0, VSCMsgInit *VAR_1)\n{", "uint32_t *capabilities = (VAR_1->capabilities);", "int VAR_2 =\n1 + ((VAR_0->length - sizeof(VSCMsgInit)) / sizeof(uint32_t));", "int VAR_3;", "QemuThread thread_id;", "VAR_1->version = ntohl(VAR_1->version);", "if (VAR_1->version != VSCARD_VERSION) {", "if (verbose > 0) {", "printf(\"warning: host has version %d, we have %d\\n\",\nverbose, VSCARD_VERSION);", "}", "}", "if (VAR_1->magic != VSCARD_MAGIC) {", "printf(\"unexpected magic: got %d, expected %d\\n\",\nVAR_1->magic, VSCARD_MAGIC);", "return -1;", "}", "for (VAR_3 = 0 ; VAR_3 < VAR_2; ++VAR_3) {", "capabilities[VAR_3] = ntohl(capabilities[VAR_3]);", "}", "send_msg(VSC_ReaderRemove, VSCARD_MINIMAL_READER_ID, NULL, 0);", "qemu_thread_create(&thread_id, \"vsc/event\", event_thread, NULL, 0);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33, 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 53 ], [ 59 ], [ 61 ], [ 63 ] ]
15,180
static GenericList *qmp_input_next_list(Visitor *v, GenericList *tail, size_t size) { QmpInputVisitor *qiv = to_qiv(v); StackObject *so = &qiv->stack[qiv->nb_stack - 1]; if (!so->entry) { return NULL; } tail->next = g_malloc0(size); return tail->next; }
false
qemu
3d344c2aabb7bc9b414321e3c52872901edebdda
static GenericList *qmp_input_next_list(Visitor *v, GenericList *tail, size_t size) { QmpInputVisitor *qiv = to_qiv(v); StackObject *so = &qiv->stack[qiv->nb_stack - 1]; if (!so->entry) { return NULL; } tail->next = g_malloc0(size); return tail->next; }
{ "code": [], "line_no": [] }
static GenericList *FUNC_0(Visitor *v, GenericList *tail, size_t size) { QmpInputVisitor *qiv = to_qiv(v); StackObject *so = &qiv->stack[qiv->nb_stack - 1]; if (!so->entry) { return NULL; } tail->next = g_malloc0(size); return tail->next; }
[ "static GenericList *FUNC_0(Visitor *v, GenericList *tail,\nsize_t size)\n{", "QmpInputVisitor *qiv = to_qiv(v);", "StackObject *so = &qiv->stack[qiv->nb_stack - 1];", "if (!so->entry) {", "return NULL;", "}", "tail->next = g_malloc0(size);", "return tail->next;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
15,181
static size_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb) { int ret; ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf); if (ret == -1) return -errno; /* * This looks weird, but the aio code only consideres a request * successfull if it has written the number full number of bytes. * * Now we overload aio_nbytes as aio_ioctl_cmd for the ioctl command, * so in fact we return the ioctl command here to make posix_aio_read() * happy.. */ return aiocb->aio_nbytes; }
false
qemu
6769da29c7a3caa9de4020db87f495de692cf8e2
static size_t handle_aiocb_ioctl(struct qemu_paiocb *aiocb) { int ret; ret = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf); if (ret == -1) return -errno; return aiocb->aio_nbytes; }
{ "code": [], "line_no": [] }
static size_t FUNC_0(struct qemu_paiocb *aiocb) { int VAR_0; VAR_0 = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf); if (VAR_0 == -1) return -errno; return aiocb->aio_nbytes; }
[ "static size_t FUNC_0(struct qemu_paiocb *aiocb)\n{", "int VAR_0;", "VAR_0 = ioctl(aiocb->aio_fildes, aiocb->aio_ioctl_cmd, aiocb->aio_ioctl_buf);", "if (VAR_0 == -1)\nreturn -errno;", "return aiocb->aio_nbytes;", "}" ]
[ 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 33 ], [ 35 ] ]
15,182
static always_inline void gen_load_mem (DisasContext *ctx, void (*tcg_gen_qemu_load)(TCGv t0, TCGv t1, int flags), int ra, int rb, int32_t disp16, int fp, int clear) { TCGv addr; if (unlikely(ra == 31)) return; addr = tcg_temp_new(TCG_TYPE_I64); if (rb != 31) { tcg_gen_addi_i64(addr, cpu_ir[rb], disp16); if (clear) tcg_gen_andi_i64(addr, addr, ~0x7); } else { if (clear) disp16 &= ~0x7; tcg_gen_movi_i64(addr, disp16); } if (fp) tcg_gen_qemu_load(cpu_fir[ra], addr, ctx->mem_idx); else tcg_gen_qemu_load(cpu_ir[ra], addr, ctx->mem_idx); tcg_temp_free(addr); }
false
qemu
a7812ae412311d7d47f8aa85656faadac9d64b56
static always_inline void gen_load_mem (DisasContext *ctx, void (*tcg_gen_qemu_load)(TCGv t0, TCGv t1, int flags), int ra, int rb, int32_t disp16, int fp, int clear) { TCGv addr; if (unlikely(ra == 31)) return; addr = tcg_temp_new(TCG_TYPE_I64); if (rb != 31) { tcg_gen_addi_i64(addr, cpu_ir[rb], disp16); if (clear) tcg_gen_andi_i64(addr, addr, ~0x7); } else { if (clear) disp16 &= ~0x7; tcg_gen_movi_i64(addr, disp16); } if (fp) tcg_gen_qemu_load(cpu_fir[ra], addr, ctx->mem_idx); else tcg_gen_qemu_load(cpu_ir[ra], addr, ctx->mem_idx); tcg_temp_free(addr); }
{ "code": [], "line_no": [] }
static always_inline void FUNC_0 (DisasContext *ctx, void (*tcg_gen_qemu_load)(TCGv t0, TCGv t1, int flags), int ra, int rb, int32_t disp16, int fp, int clear) { TCGv addr; if (unlikely(ra == 31)) return; addr = tcg_temp_new(TCG_TYPE_I64); if (rb != 31) { tcg_gen_addi_i64(addr, cpu_ir[rb], disp16); if (clear) tcg_gen_andi_i64(addr, addr, ~0x7); } else { if (clear) disp16 &= ~0x7; tcg_gen_movi_i64(addr, disp16); } if (fp) tcg_gen_qemu_load(cpu_fir[ra], addr, ctx->mem_idx); else tcg_gen_qemu_load(cpu_ir[ra], addr, ctx->mem_idx); tcg_temp_free(addr); }
[ "static always_inline void FUNC_0 (DisasContext *ctx,\nvoid (*tcg_gen_qemu_load)(TCGv t0, TCGv t1, int flags),\nint ra, int rb, int32_t disp16,\nint fp, int clear)\n{", "TCGv addr;", "if (unlikely(ra == 31))\nreturn;", "addr = tcg_temp_new(TCG_TYPE_I64);", "if (rb != 31) {", "tcg_gen_addi_i64(addr, cpu_ir[rb], disp16);", "if (clear)\ntcg_gen_andi_i64(addr, addr, ~0x7);", "} else {", "if (clear)\ndisp16 &= ~0x7;", "tcg_gen_movi_i64(addr, disp16);", "}", "if (fp)\ntcg_gen_qemu_load(cpu_fir[ra], addr, ctx->mem_idx);", "else\ntcg_gen_qemu_load(cpu_ir[ra], addr, ctx->mem_idx);", "tcg_temp_free(addr);", "}" ]
[ 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 ] ]
15,184
int cpu_watchpoint_remove(CPUState *env, target_ulong addr, target_ulong len, int flags) { target_ulong len_mask = ~(len - 1); CPUWatchpoint *wp; TAILQ_FOREACH(wp, &env->watchpoints, entry) { if (addr == wp->vaddr && len_mask == wp->len_mask && flags == (wp->flags & ~BP_WATCHPOINT_HIT)) { cpu_watchpoint_remove_by_ref(env, wp); return 0; } } return -ENOENT; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
int cpu_watchpoint_remove(CPUState *env, target_ulong addr, target_ulong len, int flags) { target_ulong len_mask = ~(len - 1); CPUWatchpoint *wp; TAILQ_FOREACH(wp, &env->watchpoints, entry) { if (addr == wp->vaddr && len_mask == wp->len_mask && flags == (wp->flags & ~BP_WATCHPOINT_HIT)) { cpu_watchpoint_remove_by_ref(env, wp); return 0; } } return -ENOENT; }
{ "code": [], "line_no": [] }
int FUNC_0(CPUState *VAR_0, target_ulong VAR_1, target_ulong VAR_2, int VAR_3) { target_ulong len_mask = ~(VAR_2 - 1); CPUWatchpoint *wp; TAILQ_FOREACH(wp, &VAR_0->watchpoints, entry) { if (VAR_1 == wp->vaddr && len_mask == wp->len_mask && VAR_3 == (wp->VAR_3 & ~BP_WATCHPOINT_HIT)) { cpu_watchpoint_remove_by_ref(VAR_0, wp); return 0; } } return -ENOENT; }
[ "int FUNC_0(CPUState *VAR_0, target_ulong VAR_1, target_ulong VAR_2,\nint VAR_3)\n{", "target_ulong len_mask = ~(VAR_2 - 1);", "CPUWatchpoint *wp;", "TAILQ_FOREACH(wp, &VAR_0->watchpoints, entry) {", "if (VAR_1 == wp->vaddr && len_mask == wp->len_mask\n&& VAR_3 == (wp->VAR_3 & ~BP_WATCHPOINT_HIT)) {", "cpu_watchpoint_remove_by_ref(VAR_0, wp);", "return 0;", "}", "}", "return -ENOENT;", "}" ]
[ 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 ] ]
15,185
static int segment_start(AVFormatContext *s, int write_header) { SegmentContext *c = s->priv_data; AVFormatContext *oc = c->avf; int err = 0; if (write_header) { avformat_free_context(oc); c->avf = NULL; if ((err = segment_mux_init(s)) < 0) return err; oc = c->avf; } if (c->wrap) c->number %= c->wrap; if (av_get_frame_filename(oc->filename, sizeof(oc->filename), s->filename, c->number++) < 0) return AVERROR(EINVAL); if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) return err; if (oc->oformat->priv_class && oc->priv_data) av_opt_set(oc->priv_data, "resend_headers", "1", 0); /* mpegts specific */ if (write_header) { if ((err = avformat_write_header(oc, NULL)) < 0) return err; } return 0; }
false
FFmpeg
9f61abc8111c7c43f49ca012e957a108b9cc7610
static int segment_start(AVFormatContext *s, int write_header) { SegmentContext *c = s->priv_data; AVFormatContext *oc = c->avf; int err = 0; if (write_header) { avformat_free_context(oc); c->avf = NULL; if ((err = segment_mux_init(s)) < 0) return err; oc = c->avf; } if (c->wrap) c->number %= c->wrap; if (av_get_frame_filename(oc->filename, sizeof(oc->filename), s->filename, c->number++) < 0) return AVERROR(EINVAL); if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) return err; if (oc->oformat->priv_class && oc->priv_data) av_opt_set(oc->priv_data, "resend_headers", "1", 0); if (write_header) { if ((err = avformat_write_header(oc, NULL)) < 0) return err; } return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1) { SegmentContext *c = VAR_0->priv_data; AVFormatContext *oc = c->avf; int VAR_2 = 0; if (VAR_1) { avformat_free_context(oc); c->avf = NULL; if ((VAR_2 = segment_mux_init(VAR_0)) < 0) return VAR_2; oc = c->avf; } if (c->wrap) c->number %= c->wrap; if (av_get_frame_filename(oc->filename, sizeof(oc->filename), VAR_0->filename, c->number++) < 0) return AVERROR(EINVAL); if ((VAR_2 = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE, &VAR_0->interrupt_callback, NULL)) < 0) return VAR_2; if (oc->oformat->priv_class && oc->priv_data) av_opt_set(oc->priv_data, "resend_headers", "1", 0); if (VAR_1) { if ((VAR_2 = avformat_write_header(oc, NULL)) < 0) return VAR_2; } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{", "SegmentContext *c = VAR_0->priv_data;", "AVFormatContext *oc = c->avf;", "int VAR_2 = 0;", "if (VAR_1) {", "avformat_free_context(oc);", "c->avf = NULL;", "if ((VAR_2 = segment_mux_init(VAR_0)) < 0)\nreturn VAR_2;", "oc = c->avf;", "}", "if (c->wrap)\nc->number %= c->wrap;", "if (av_get_frame_filename(oc->filename, sizeof(oc->filename),\nVAR_0->filename, c->number++) < 0)\nreturn AVERROR(EINVAL);", "if ((VAR_2 = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE,\n&VAR_0->interrupt_callback, NULL)) < 0)\nreturn VAR_2;", "if (oc->oformat->priv_class && oc->priv_data)\nav_opt_set(oc->priv_data, \"resend_headers\", \"1\", 0);", "if (VAR_1) {", "if ((VAR_2 = avformat_write_header(oc, NULL)) < 0)\nreturn VAR_2;", "}", "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 ], [ 13 ], [ 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 29, 31 ], [ 35, 37, 39 ], [ 43, 45, 47 ], [ 51, 53 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 67 ], [ 69 ] ]
15,186
static void s390x_cpu_set_id(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { S390CPU *cpu = S390_CPU(obj); DeviceState *dev = DEVICE(obj); const int64_t min = 0; const int64_t max = UINT32_MAX; Error *err = NULL; int64_t value; if (dev->realized) { error_setg(errp, "Attempt to set property '%s' on '%s' after " "it was realized", name, object_get_typename(obj)); return; } visit_type_int(v, name, &value, &err); if (err) { error_propagate(errp, err); return; } if (value < min || value > max) { error_setg(errp, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")" , object_get_typename(obj), name, value, min, max); return; } cpu->id = value; }
false
qemu
ca5c1457d614fec718aaec7bdf3663dec37e1e50
static void s390x_cpu_set_id(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { S390CPU *cpu = S390_CPU(obj); DeviceState *dev = DEVICE(obj); const int64_t min = 0; const int64_t max = UINT32_MAX; Error *err = NULL; int64_t value; if (dev->realized) { error_setg(errp, "Attempt to set property '%s' on '%s' after " "it was realized", name, object_get_typename(obj)); return; } visit_type_int(v, name, &value, &err); if (err) { error_propagate(errp, err); return; } if (value < min || value > max) { error_setg(errp, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")" , object_get_typename(obj), name, value, min, max); return; } cpu->id = value; }
{ "code": [], "line_no": [] }
static void FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_2, void *VAR_3, Error **VAR_4) { S390CPU *cpu = S390_CPU(VAR_0); DeviceState *dev = DEVICE(VAR_0); const int64_t VAR_5 = 0; const int64_t VAR_6 = UINT32_MAX; Error *err = NULL; int64_t value; if (dev->realized) { error_setg(VAR_4, "Attempt to set property '%s' on '%s' after " "it was realized", VAR_2, object_get_typename(VAR_0)); return; } visit_type_int(VAR_1, VAR_2, &value, &err); if (err) { error_propagate(VAR_4, err); return; } if (value < VAR_5 || value > VAR_6) { error_setg(VAR_4, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")" , object_get_typename(VAR_0), VAR_2, value, VAR_5, VAR_6); return; } cpu->id = value; }
[ "static void FUNC_0(Object *VAR_0, Visitor *VAR_1, const char *VAR_2,\nvoid *VAR_3, Error **VAR_4)\n{", "S390CPU *cpu = S390_CPU(VAR_0);", "DeviceState *dev = DEVICE(VAR_0);", "const int64_t VAR_5 = 0;", "const int64_t VAR_6 = UINT32_MAX;", "Error *err = NULL;", "int64_t value;", "if (dev->realized) {", "error_setg(VAR_4, \"Attempt to set property '%s' on '%s' after \"\n\"it was realized\", VAR_2, object_get_typename(VAR_0));", "return;", "}", "visit_type_int(VAR_1, VAR_2, &value, &err);", "if (err) {", "error_propagate(VAR_4, err);", "return;", "}", "if (value < VAR_5 || value > VAR_6) {", "error_setg(VAR_4, \"Property %s.%s doesn't take value %\" PRId64\n\" (minimum: %\" PRId64 \", maximum: %\" PRId64 \")\" ,\nobject_get_typename(VAR_0), VAR_2, value, VAR_5, VAR_6);", "return;", "}", "cpu->id = value;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
15,188
static void sunmouse_event(void *opaque, int dx, int dy, int dz, int buttons_state) { ChannelState *s = opaque; int ch; MS_DPRINTF("dx=%d dy=%d buttons=%01x\n", dx, dy, buttons_state); ch = 0x80 | 0x7; /* protocol start byte, no buttons pressed */ if (buttons_state & MOUSE_EVENT_LBUTTON) ch ^= 0x4; if (buttons_state & MOUSE_EVENT_MBUTTON) ch ^= 0x2; if (buttons_state & MOUSE_EVENT_RBUTTON) ch ^= 0x1; put_queue(s, ch); ch = dx; if (ch > 127) ch=127; else if (ch < -127) ch=-127; put_queue(s, ch & 0xff); ch = -dy; if (ch > 127) ch=127; else if (ch < -127) ch=-127; put_queue(s, ch & 0xff); // MSC protocol specify two extra motion bytes put_queue(s, 0); put_queue(s, 0); }
false
qemu
a0d98a712fbb1f22e347299006e4004bb985eb34
static void sunmouse_event(void *opaque, int dx, int dy, int dz, int buttons_state) { ChannelState *s = opaque; int ch; MS_DPRINTF("dx=%d dy=%d buttons=%01x\n", dx, dy, buttons_state); ch = 0x80 | 0x7; if (buttons_state & MOUSE_EVENT_LBUTTON) ch ^= 0x4; if (buttons_state & MOUSE_EVENT_MBUTTON) ch ^= 0x2; if (buttons_state & MOUSE_EVENT_RBUTTON) ch ^= 0x1; put_queue(s, ch); ch = dx; if (ch > 127) ch=127; else if (ch < -127) ch=-127; put_queue(s, ch & 0xff); ch = -dy; if (ch > 127) ch=127; else if (ch < -127) ch=-127; put_queue(s, ch & 0xff); put_queue(s, 0); put_queue(s, 0); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4) { ChannelState *s = VAR_0; int VAR_5; MS_DPRINTF("VAR_1=%d VAR_2=%d buttons=%01x\n", VAR_1, VAR_2, VAR_4); VAR_5 = 0x80 | 0x7; if (VAR_4 & MOUSE_EVENT_LBUTTON) VAR_5 ^= 0x4; if (VAR_4 & MOUSE_EVENT_MBUTTON) VAR_5 ^= 0x2; if (VAR_4 & MOUSE_EVENT_RBUTTON) VAR_5 ^= 0x1; put_queue(s, VAR_5); VAR_5 = VAR_1; if (VAR_5 > 127) VAR_5=127; else if (VAR_5 < -127) VAR_5=-127; put_queue(s, VAR_5 & 0xff); VAR_5 = -VAR_2; if (VAR_5 > 127) VAR_5=127; else if (VAR_5 < -127) VAR_5=-127; put_queue(s, VAR_5 & 0xff); put_queue(s, 0); put_queue(s, 0); }
[ "static void FUNC_0(void *VAR_0,\nint VAR_1, int VAR_2, int VAR_3, int VAR_4)\n{", "ChannelState *s = VAR_0;", "int VAR_5;", "MS_DPRINTF(\"VAR_1=%d VAR_2=%d buttons=%01x\\n\", VAR_1, VAR_2, VAR_4);", "VAR_5 = 0x80 | 0x7;", "if (VAR_4 & MOUSE_EVENT_LBUTTON)\nVAR_5 ^= 0x4;", "if (VAR_4 & MOUSE_EVENT_MBUTTON)\nVAR_5 ^= 0x2;", "if (VAR_4 & MOUSE_EVENT_RBUTTON)\nVAR_5 ^= 0x1;", "put_queue(s, VAR_5);", "VAR_5 = VAR_1;", "if (VAR_5 > 127)\nVAR_5=127;", "else if (VAR_5 < -127)\nVAR_5=-127;", "put_queue(s, VAR_5 & 0xff);", "VAR_5 = -VAR_2;", "if (VAR_5 > 127)\nVAR_5=127;", "else if (VAR_5 < -127)\nVAR_5=-127;", "put_queue(s, VAR_5 & 0xff);", "put_queue(s, 0);", "put_queue(s, 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 21, 23 ], [ 25, 27 ], [ 29, 31 ], [ 35 ], [ 39 ], [ 43, 45 ], [ 47, 49 ], [ 53 ], [ 57 ], [ 61, 63 ], [ 65, 67 ], [ 71 ], [ 79 ], [ 81 ], [ 83 ] ]
15,189
void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap, uint8_t *buf, uint64_t start, uint64_t count) { hbitmap_serialize_part(bitmap->bitmap, buf, start, count); }
false
qemu
86f6ae67e157362f3b141649874213ce01dcc622
void bdrv_dirty_bitmap_serialize_part(const BdrvDirtyBitmap *bitmap, uint8_t *buf, uint64_t start, uint64_t count) { hbitmap_serialize_part(bitmap->bitmap, buf, start, count); }
{ "code": [], "line_no": [] }
void FUNC_0(const BdrvDirtyBitmap *VAR_0, uint8_t *VAR_1, uint64_t VAR_2, uint64_t VAR_3) { hbitmap_serialize_part(VAR_0->VAR_0, VAR_1, VAR_2, VAR_3); }
[ "void FUNC_0(const BdrvDirtyBitmap *VAR_0,\nuint8_t *VAR_1, uint64_t VAR_2,\nuint64_t VAR_3)\n{", "hbitmap_serialize_part(VAR_0->VAR_0, VAR_1, VAR_2, VAR_3);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ] ]
15,190
int nbd_init(int fd, QIOChannelSocket *sioc, NBDExportInfo *info, Error **errp) { unsigned long sectors = info->size / BDRV_SECTOR_SIZE; if (info->size / BDRV_SECTOR_SIZE != sectors) { error_setg(errp, "Export size %" PRIu64 " too large for 32-bit kernel", info->size); return -E2BIG; } trace_nbd_init_set_socket(); if (ioctl(fd, NBD_SET_SOCK, (unsigned long) sioc->fd) < 0) { int serrno = errno; error_setg(errp, "Failed to set NBD socket"); return -serrno; } trace_nbd_init_set_block_size(BDRV_SECTOR_SIZE); if (ioctl(fd, NBD_SET_BLKSIZE, (unsigned long)BDRV_SECTOR_SIZE) < 0) { int serrno = errno; error_setg(errp, "Failed setting NBD block size"); return -serrno; } trace_nbd_init_set_size(sectors); if (info->size % BDRV_SECTOR_SIZE) { trace_nbd_init_trailing_bytes(info->size % BDRV_SECTOR_SIZE); } if (ioctl(fd, NBD_SET_SIZE_BLOCKS, sectors) < 0) { int serrno = errno; error_setg(errp, "Failed setting size (in blocks)"); return -serrno; } if (ioctl(fd, NBD_SET_FLAGS, (unsigned long) info->flags) < 0) { if (errno == ENOTTY) { int read_only = (info->flags & NBD_FLAG_READ_ONLY) != 0; trace_nbd_init_set_readonly(); if (ioctl(fd, BLKROSET, (unsigned long) &read_only) < 0) { int serrno = errno; error_setg(errp, "Failed setting read-only attribute"); return -serrno; } } else { int serrno = errno; error_setg(errp, "Failed setting flags"); return -serrno; } } trace_nbd_init_finish(); return 0; }
false
qemu
081dd1fe36f0ccc04130d1edd136c787c5f8cc50
int nbd_init(int fd, QIOChannelSocket *sioc, NBDExportInfo *info, Error **errp) { unsigned long sectors = info->size / BDRV_SECTOR_SIZE; if (info->size / BDRV_SECTOR_SIZE != sectors) { error_setg(errp, "Export size %" PRIu64 " too large for 32-bit kernel", info->size); return -E2BIG; } trace_nbd_init_set_socket(); if (ioctl(fd, NBD_SET_SOCK, (unsigned long) sioc->fd) < 0) { int serrno = errno; error_setg(errp, "Failed to set NBD socket"); return -serrno; } trace_nbd_init_set_block_size(BDRV_SECTOR_SIZE); if (ioctl(fd, NBD_SET_BLKSIZE, (unsigned long)BDRV_SECTOR_SIZE) < 0) { int serrno = errno; error_setg(errp, "Failed setting NBD block size"); return -serrno; } trace_nbd_init_set_size(sectors); if (info->size % BDRV_SECTOR_SIZE) { trace_nbd_init_trailing_bytes(info->size % BDRV_SECTOR_SIZE); } if (ioctl(fd, NBD_SET_SIZE_BLOCKS, sectors) < 0) { int serrno = errno; error_setg(errp, "Failed setting size (in blocks)"); return -serrno; } if (ioctl(fd, NBD_SET_FLAGS, (unsigned long) info->flags) < 0) { if (errno == ENOTTY) { int read_only = (info->flags & NBD_FLAG_READ_ONLY) != 0; trace_nbd_init_set_readonly(); if (ioctl(fd, BLKROSET, (unsigned long) &read_only) < 0) { int serrno = errno; error_setg(errp, "Failed setting read-only attribute"); return -serrno; } } else { int serrno = errno; error_setg(errp, "Failed setting flags"); return -serrno; } } trace_nbd_init_finish(); return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(int VAR_0, QIOChannelSocket *VAR_1, NBDExportInfo *VAR_2, Error **VAR_3) { unsigned long VAR_4 = VAR_2->size / BDRV_SECTOR_SIZE; if (VAR_2->size / BDRV_SECTOR_SIZE != VAR_4) { error_setg(VAR_3, "Export size %" PRIu64 " too large for 32-bit kernel", VAR_2->size); return -E2BIG; } trace_nbd_init_set_socket(); if (ioctl(VAR_0, NBD_SET_SOCK, (unsigned long) VAR_1->VAR_0) < 0) { int VAR_7 = errno; error_setg(VAR_3, "Failed to set NBD socket"); return -VAR_7; } trace_nbd_init_set_block_size(BDRV_SECTOR_SIZE); if (ioctl(VAR_0, NBD_SET_BLKSIZE, (unsigned long)BDRV_SECTOR_SIZE) < 0) { int VAR_7 = errno; error_setg(VAR_3, "Failed setting NBD block size"); return -VAR_7; } trace_nbd_init_set_size(VAR_4); if (VAR_2->size % BDRV_SECTOR_SIZE) { trace_nbd_init_trailing_bytes(VAR_2->size % BDRV_SECTOR_SIZE); } if (ioctl(VAR_0, NBD_SET_SIZE_BLOCKS, VAR_4) < 0) { int VAR_7 = errno; error_setg(VAR_3, "Failed setting size (in blocks)"); return -VAR_7; } if (ioctl(VAR_0, NBD_SET_FLAGS, (unsigned long) VAR_2->flags) < 0) { if (errno == ENOTTY) { int VAR_6 = (VAR_2->flags & NBD_FLAG_READ_ONLY) != 0; trace_nbd_init_set_readonly(); if (ioctl(VAR_0, BLKROSET, (unsigned long) &VAR_6) < 0) { int VAR_7 = errno; error_setg(VAR_3, "Failed setting read-only attribute"); return -VAR_7; } } else { int VAR_7 = errno; error_setg(VAR_3, "Failed setting flags"); return -VAR_7; } } trace_nbd_init_finish(); return 0; }
[ "int FUNC_0(int VAR_0, QIOChannelSocket *VAR_1, NBDExportInfo *VAR_2,\nError **VAR_3)\n{", "unsigned long VAR_4 = VAR_2->size / BDRV_SECTOR_SIZE;", "if (VAR_2->size / BDRV_SECTOR_SIZE != VAR_4) {", "error_setg(VAR_3, \"Export size %\" PRIu64 \" too large for 32-bit kernel\",\nVAR_2->size);", "return -E2BIG;", "}", "trace_nbd_init_set_socket();", "if (ioctl(VAR_0, NBD_SET_SOCK, (unsigned long) VAR_1->VAR_0) < 0) {", "int VAR_7 = errno;", "error_setg(VAR_3, \"Failed to set NBD socket\");", "return -VAR_7;", "}", "trace_nbd_init_set_block_size(BDRV_SECTOR_SIZE);", "if (ioctl(VAR_0, NBD_SET_BLKSIZE, (unsigned long)BDRV_SECTOR_SIZE) < 0) {", "int VAR_7 = errno;", "error_setg(VAR_3, \"Failed setting NBD block size\");", "return -VAR_7;", "}", "trace_nbd_init_set_size(VAR_4);", "if (VAR_2->size % BDRV_SECTOR_SIZE) {", "trace_nbd_init_trailing_bytes(VAR_2->size % BDRV_SECTOR_SIZE);", "}", "if (ioctl(VAR_0, NBD_SET_SIZE_BLOCKS, VAR_4) < 0) {", "int VAR_7 = errno;", "error_setg(VAR_3, \"Failed setting size (in blocks)\");", "return -VAR_7;", "}", "if (ioctl(VAR_0, NBD_SET_FLAGS, (unsigned long) VAR_2->flags) < 0) {", "if (errno == ENOTTY) {", "int VAR_6 = (VAR_2->flags & NBD_FLAG_READ_ONLY) != 0;", "trace_nbd_init_set_readonly();", "if (ioctl(VAR_0, BLKROSET, (unsigned long) &VAR_6) < 0) {", "int VAR_7 = errno;", "error_setg(VAR_3, \"Failed setting read-only attribute\");", "return -VAR_7;", "}", "} else {", "int VAR_7 = errno;", "error_setg(VAR_3, \"Failed setting flags\");", "return -VAR_7;", "}", "}", "trace_nbd_init_finish();", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 113 ], [ 115 ] ]
15,192
void helper_dcbz(CPUPPCState *env, target_ulong addr, uint32_t is_dcbzl) { int dcbz_size = env->dcache_line_size; #if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) if (!is_dcbzl && (env->excp_model == POWERPC_EXCP_970) && ((env->spr[SPR_970_HID5] >> 7) & 0x3) == 1) { dcbz_size = 32; } #endif /* XXX add e500mc support */ do_dcbz(env, addr, dcbz_size); }
false
qemu
414f5d1448fef9aad6d37f1d40d1158396573447
void helper_dcbz(CPUPPCState *env, target_ulong addr, uint32_t is_dcbzl) { int dcbz_size = env->dcache_line_size; #if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) if (!is_dcbzl && (env->excp_model == POWERPC_EXCP_970) && ((env->spr[SPR_970_HID5] >> 7) & 0x3) == 1) { dcbz_size = 32; } #endif do_dcbz(env, addr, dcbz_size); }
{ "code": [], "line_no": [] }
void FUNC_0(CPUPPCState *VAR_0, target_ulong VAR_1, uint32_t VAR_2) { int VAR_3 = VAR_0->dcache_line_size; #if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64) if (!VAR_2 && (VAR_0->excp_model == POWERPC_EXCP_970) && ((VAR_0->spr[SPR_970_HID5] >> 7) & 0x3) == 1) { VAR_3 = 32; } #endif do_dcbz(VAR_0, VAR_1, VAR_3); }
[ "void FUNC_0(CPUPPCState *VAR_0, target_ulong VAR_1, uint32_t VAR_2)\n{", "int VAR_3 = VAR_0->dcache_line_size;", "#if !defined(CONFIG_USER_ONLY) && defined(TARGET_PPC64)\nif (!VAR_2 &&\n(VAR_0->excp_model == POWERPC_EXCP_970) &&\n((VAR_0->spr[SPR_970_HID5] >> 7) & 0x3) == 1) {", "VAR_3 = 32;", "}", "#endif\ndo_dcbz(VAR_0, VAR_1, VAR_3);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13, 15 ], [ 17 ], [ 19 ], [ 21, 29 ], [ 31 ] ]
15,193
static void nvme_rw_cb(void *opaque, int ret) { NvmeRequest *req = opaque; NvmeSQueue *sq = req->sq; NvmeCtrl *n = sq->ctrl; NvmeCQueue *cq = n->cq[sq->cqid]; block_acct_done(bdrv_get_stats(n->conf.bs), &req->acct); if (!ret) { req->status = NVME_SUCCESS; } else { req->status = NVME_INTERNAL_DEV_ERROR; } qemu_sglist_destroy(&req->qsg); nvme_enqueue_req_completion(cq, req); }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void nvme_rw_cb(void *opaque, int ret) { NvmeRequest *req = opaque; NvmeSQueue *sq = req->sq; NvmeCtrl *n = sq->ctrl; NvmeCQueue *cq = n->cq[sq->cqid]; block_acct_done(bdrv_get_stats(n->conf.bs), &req->acct); if (!ret) { req->status = NVME_SUCCESS; } else { req->status = NVME_INTERNAL_DEV_ERROR; } qemu_sglist_destroy(&req->qsg); nvme_enqueue_req_completion(cq, req); }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, int VAR_1) { NvmeRequest *req = VAR_0; NvmeSQueue *sq = req->sq; NvmeCtrl *n = sq->ctrl; NvmeCQueue *cq = n->cq[sq->cqid]; block_acct_done(bdrv_get_stats(n->conf.bs), &req->acct); if (!VAR_1) { req->status = NVME_SUCCESS; } else { req->status = NVME_INTERNAL_DEV_ERROR; } qemu_sglist_destroy(&req->qsg); nvme_enqueue_req_completion(cq, req); }
[ "static void FUNC_0(void *VAR_0, int VAR_1)\n{", "NvmeRequest *req = VAR_0;", "NvmeSQueue *sq = req->sq;", "NvmeCtrl *n = sq->ctrl;", "NvmeCQueue *cq = n->cq[sq->cqid];", "block_acct_done(bdrv_get_stats(n->conf.bs), &req->acct);", "if (!VAR_1) {", "req->status = NVME_SUCCESS;", "} else {", "req->status = NVME_INTERNAL_DEV_ERROR;", "}", "qemu_sglist_destroy(&req->qsg);", "nvme_enqueue_req_completion(cq, req);", "}" ]
[ 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 ], [ 29 ], [ 31 ], [ 33 ] ]