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
sequencelengths
1
2.8k
label
sequencelengths
1
2.8k
line_no
sequencelengths
1
2.8k
5,819
static void ioreq_release(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; LIST_REMOVE(ioreq, list); memset(ioreq, 0, sizeof(*ioreq)); ioreq->blkdev = blkdev; LIST_INSERT_HEAD(&blkdev->freelist, ioreq, list); blkdev->requests_finished--; }
false
qemu
72cf2d4f0e181d0d3a3122e04129c58a95da713e
static void ioreq_release(struct ioreq *ioreq) { struct XenBlkDev *blkdev = ioreq->blkdev; LIST_REMOVE(ioreq, list); memset(ioreq, 0, sizeof(*ioreq)); ioreq->blkdev = blkdev; LIST_INSERT_HEAD(&blkdev->freelist, ioreq, list); blkdev->requests_finished--; }
{ "code": [], "line_no": [] }
static void FUNC_0(struct VAR_0 *VAR_0) { struct XenBlkDev *VAR_1 = VAR_0->VAR_1; LIST_REMOVE(VAR_0, list); memset(VAR_0, 0, sizeof(*VAR_0)); VAR_0->VAR_1 = VAR_1; LIST_INSERT_HEAD(&VAR_1->freelist, VAR_0, list); VAR_1->requests_finished--; }
[ "static void FUNC_0(struct VAR_0 *VAR_0)\n{", "struct XenBlkDev *VAR_1 = VAR_0->VAR_1;", "LIST_REMOVE(VAR_0, list);", "memset(VAR_0, 0, sizeof(*VAR_0));", "VAR_0->VAR_1 = VAR_1;", "LIST_INSERT_HEAD(&VAR_1->freelist, VAR_0, list);", "VAR_1->requests_finished--;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
5,821
static void static_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { #ifdef SPY printf("%s: value %08lx written at " PA_FMT "\n", __FUNCTION__, value, offset); #endif }
false
qemu
a89f364ae8740dfc31b321eed9ee454e996dc3c1
static void static_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { #ifdef SPY printf("%s: value %08lx written at " PA_FMT "\n", __FUNCTION__, value, offset); #endif }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { #ifdef SPY printf("%s: VAR_2 %08lx written at " PA_FMT "\n", __FUNCTION__, VAR_2, VAR_1); #endif }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2,\nunsigned VAR_3)\n{", "#ifdef SPY\nprintf(\"%s: VAR_2 %08lx written at \" PA_FMT \"\\n\",\n__FUNCTION__, VAR_2, VAR_1);", "#endif\n}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7, 9, 11 ], [ 13, 15 ] ]
5,822
static inline void set_fsr(CPUSPARCState *env) { int rnd_mode; switch (env->fsr & FSR_RD_MASK) { case FSR_RD_NEAREST: rnd_mode = float_round_nearest_even; break; default: case FSR_RD_ZERO: rnd_mode = float_round_to_zero; break; case FSR_RD_POS: rnd_mode = float_round_up; break; case FSR_RD_NEG: rnd_mode = float_round_down; break; } set_float_rounding_mode(rnd_mode, &env->fp_status); }
false
qemu
7385aed20db5d83979f683b9d0048674411e963c
static inline void set_fsr(CPUSPARCState *env) { int rnd_mode; switch (env->fsr & FSR_RD_MASK) { case FSR_RD_NEAREST: rnd_mode = float_round_nearest_even; break; default: case FSR_RD_ZERO: rnd_mode = float_round_to_zero; break; case FSR_RD_POS: rnd_mode = float_round_up; break; case FSR_RD_NEG: rnd_mode = float_round_down; break; } set_float_rounding_mode(rnd_mode, &env->fp_status); }
{ "code": [], "line_no": [] }
static inline void FUNC_0(CPUSPARCState *VAR_0) { int VAR_1; switch (VAR_0->fsr & FSR_RD_MASK) { case FSR_RD_NEAREST: VAR_1 = float_round_nearest_even; break; default: case FSR_RD_ZERO: VAR_1 = float_round_to_zero; break; case FSR_RD_POS: VAR_1 = float_round_up; break; case FSR_RD_NEG: VAR_1 = float_round_down; break; } set_float_rounding_mode(VAR_1, &VAR_0->fp_status); }
[ "static inline void FUNC_0(CPUSPARCState *VAR_0)\n{", "int VAR_1;", "switch (VAR_0->fsr & FSR_RD_MASK) {", "case FSR_RD_NEAREST:\nVAR_1 = float_round_nearest_even;", "break;", "default:\ncase FSR_RD_ZERO:\nVAR_1 = float_round_to_zero;", "break;", "case FSR_RD_POS:\nVAR_1 = float_round_up;", "break;", "case FSR_RD_NEG:\nVAR_1 = float_round_down;", "break;", "}", "set_float_rounding_mode(VAR_1, &VAR_0->fp_status);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17, 19, 21 ], [ 23 ], [ 25, 27 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ] ]
5,823
static void *kvm_cpu_thread_fn(void *arg) { CPUState *env = arg; int r; qemu_mutex_lock(&qemu_global_mutex); qemu_thread_self(env->thread); r = kvm_init_vcpu(env); if (r < 0) { fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r)); exit(1); } qemu_kvm_init_cpu_signals(env); /* signal CPU creation */ env->created = 1; qemu_cond_signal(&qemu_cpu_cond); /* and wait for machine initialization */ while (!qemu_system_ready) qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100); while (1) { if (cpu_can_run(env)) qemu_cpu_exec(env); qemu_kvm_wait_io_event(env); } return NULL; }
false
qemu
7e97cd88148876bad36ee7c66d526dcaed328d0d
static void *kvm_cpu_thread_fn(void *arg) { CPUState *env = arg; int r; qemu_mutex_lock(&qemu_global_mutex); qemu_thread_self(env->thread); r = kvm_init_vcpu(env); if (r < 0) { fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-r)); exit(1); } qemu_kvm_init_cpu_signals(env); env->created = 1; qemu_cond_signal(&qemu_cpu_cond); while (!qemu_system_ready) qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100); while (1) { if (cpu_can_run(env)) qemu_cpu_exec(env); qemu_kvm_wait_io_event(env); } return NULL; }
{ "code": [], "line_no": [] }
static void *FUNC_0(void *VAR_0) { CPUState *env = VAR_0; int VAR_1; qemu_mutex_lock(&qemu_global_mutex); qemu_thread_self(env->thread); VAR_1 = kvm_init_vcpu(env); if (VAR_1 < 0) { fprintf(stderr, "kvm_init_vcpu failed: %s\n", strerror(-VAR_1)); exit(1); } qemu_kvm_init_cpu_signals(env); env->created = 1; qemu_cond_signal(&qemu_cpu_cond); while (!qemu_system_ready) qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100); while (1) { if (cpu_can_run(env)) qemu_cpu_exec(env); qemu_kvm_wait_io_event(env); } return NULL; }
[ "static void *FUNC_0(void *VAR_0)\n{", "CPUState *env = VAR_0;", "int VAR_1;", "qemu_mutex_lock(&qemu_global_mutex);", "qemu_thread_self(env->thread);", "VAR_1 = kvm_init_vcpu(env);", "if (VAR_1 < 0) {", "fprintf(stderr, \"kvm_init_vcpu failed: %s\\n\", strerror(-VAR_1));", "exit(1);", "}", "qemu_kvm_init_cpu_signals(env);", "env->created = 1;", "qemu_cond_signal(&qemu_cpu_cond);", "while (!qemu_system_ready)\nqemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100);", "while (1) {", "if (cpu_can_run(env))\nqemu_cpu_exec(env);", "qemu_kvm_wait_io_event(env);", "}", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 35 ], [ 37 ], [ 43, 45 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ] ]
5,824
void HELPER(stfl)(CPUS390XState *env) { uint64_t words[MAX_STFL_WORDS]; LowCore *lowcore; lowcore = cpu_map_lowcore(env); do_stfle(env, words); lowcore->stfl_fac_list = cpu_to_be32(words[0] >> 32); cpu_unmap_lowcore(lowcore); }
false
qemu
f74990a5d019751c545e9800a3376b6336e77d38
void HELPER(stfl)(CPUS390XState *env) { uint64_t words[MAX_STFL_WORDS]; LowCore *lowcore; lowcore = cpu_map_lowcore(env); do_stfle(env, words); lowcore->stfl_fac_list = cpu_to_be32(words[0] >> 32); cpu_unmap_lowcore(lowcore); }
{ "code": [], "line_no": [] }
void FUNC_0(stfl)(CPUS390XState *env) { uint64_t words[MAX_STFL_WORDS]; LowCore *lowcore; lowcore = cpu_map_lowcore(env); do_stfle(env, words); lowcore->stfl_fac_list = cpu_to_be32(words[0] >> 32); cpu_unmap_lowcore(lowcore); }
[ "void FUNC_0(stfl)(CPUS390XState *env)\n{", "uint64_t words[MAX_STFL_WORDS];", "LowCore *lowcore;", "lowcore = cpu_map_lowcore(env);", "do_stfle(env, words);", "lowcore->stfl_fac_list = cpu_to_be32(words[0] >> 32);", "cpu_unmap_lowcore(lowcore);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
5,828
static int nbd_can_accept(void *opaque) { return nb_fds < shared; }
false
qemu
e4afbf4fb4d026510700cb40bb72dea9aef14e3b
static int nbd_can_accept(void *opaque) { return nb_fds < shared; }
{ "code": [], "line_no": [] }
static int FUNC_0(void *VAR_0) { return nb_fds < shared; }
[ "static int FUNC_0(void *VAR_0)\n{", "return nb_fds < shared;", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
5,830
static void pci_update_mappings(PCIDevice *d) { PCIIORegion *r; int i; pcibus_t new_addr; for(i = 0; i < PCI_NUM_REGIONS; i++) { r = &d->io_regions[i]; /* this region isn't registered */ if (!r->size) continue; new_addr = pci_bar_address(d, i, r->type, r->size); /* This bar isn't changed */ if (new_addr == r->addr) continue; /* now do the real mapping */ if (r->addr != PCI_BAR_UNMAPPED) { trace_pci_update_mappings_del(d, pci_bus_num(d->bus), PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), i, r->addr, r->size); memory_region_del_subregion(r->address_space, r->memory); } r->addr = new_addr; if (r->addr != PCI_BAR_UNMAPPED) { trace_pci_update_mappings_add(d, pci_bus_num(d->bus), PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), i, r->addr, r->size); memory_region_add_subregion_overlap(r->address_space, r->addr, r->memory, 1); } } pci_update_vga(d); }
false
qemu
fd56e0612b6454a282fa6a953fdb09281a98c589
static void pci_update_mappings(PCIDevice *d) { PCIIORegion *r; int i; pcibus_t new_addr; for(i = 0; i < PCI_NUM_REGIONS; i++) { r = &d->io_regions[i]; if (!r->size) continue; new_addr = pci_bar_address(d, i, r->type, r->size); if (new_addr == r->addr) continue; if (r->addr != PCI_BAR_UNMAPPED) { trace_pci_update_mappings_del(d, pci_bus_num(d->bus), PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), i, r->addr, r->size); memory_region_del_subregion(r->address_space, r->memory); } r->addr = new_addr; if (r->addr != PCI_BAR_UNMAPPED) { trace_pci_update_mappings_add(d, pci_bus_num(d->bus), PCI_SLOT(d->devfn), PCI_FUNC(d->devfn), i, r->addr, r->size); memory_region_add_subregion_overlap(r->address_space, r->addr, r->memory, 1); } } pci_update_vga(d); }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIDevice *VAR_0) { PCIIORegion *r; int VAR_1; pcibus_t new_addr; for(VAR_1 = 0; VAR_1 < PCI_NUM_REGIONS; VAR_1++) { r = &VAR_0->io_regions[VAR_1]; if (!r->size) continue; new_addr = pci_bar_address(VAR_0, VAR_1, r->type, r->size); if (new_addr == r->addr) continue; if (r->addr != PCI_BAR_UNMAPPED) { trace_pci_update_mappings_del(VAR_0, pci_bus_num(VAR_0->bus), PCI_SLOT(VAR_0->devfn), PCI_FUNC(VAR_0->devfn), VAR_1, r->addr, r->size); memory_region_del_subregion(r->address_space, r->memory); } r->addr = new_addr; if (r->addr != PCI_BAR_UNMAPPED) { trace_pci_update_mappings_add(VAR_0, pci_bus_num(VAR_0->bus), PCI_SLOT(VAR_0->devfn), PCI_FUNC(VAR_0->devfn), VAR_1, r->addr, r->size); memory_region_add_subregion_overlap(r->address_space, r->addr, r->memory, 1); } } pci_update_vga(VAR_0); }
[ "static void FUNC_0(PCIDevice *VAR_0)\n{", "PCIIORegion *r;", "int VAR_1;", "pcibus_t new_addr;", "for(VAR_1 = 0; VAR_1 < PCI_NUM_REGIONS; VAR_1++) {", "r = &VAR_0->io_regions[VAR_1];", "if (!r->size)\ncontinue;", "new_addr = pci_bar_address(VAR_0, VAR_1, r->type, r->size);", "if (new_addr == r->addr)\ncontinue;", "if (r->addr != PCI_BAR_UNMAPPED) {", "trace_pci_update_mappings_del(VAR_0, pci_bus_num(VAR_0->bus),\nPCI_SLOT(VAR_0->devfn),\nPCI_FUNC(VAR_0->devfn),\nVAR_1, r->addr, r->size);", "memory_region_del_subregion(r->address_space, r->memory);", "}", "r->addr = new_addr;", "if (r->addr != PCI_BAR_UNMAPPED) {", "trace_pci_update_mappings_add(VAR_0, pci_bus_num(VAR_0->bus),\nPCI_SLOT(VAR_0->devfn),\nPCI_FUNC(VAR_0->devfn),\nVAR_1, r->addr, r->size);", "memory_region_add_subregion_overlap(r->address_space,\nr->addr, r->memory, 1);", "}", "}", "pci_update_vga(VAR_0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 21, 23 ], [ 27 ], [ 33, 35 ], [ 41 ], [ 43, 45, 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61, 63, 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 77 ], [ 79 ] ]
5,832
static QObject* bdrv_info_stats_bs(BlockDriverState *bs) { QObject *res; QDict *dict; res = qobject_from_jsonf("{ 'stats': {" "'rd_bytes': %" PRId64 "," "'wr_bytes': %" PRId64 "," "'rd_operations': %" PRId64 "," "'wr_operations': %" PRId64 "," "'wr_highest_offset': %" PRId64 "," "'flush_operations': %" PRId64 "} }", bs->nr_bytes[BDRV_ACCT_READ], bs->nr_bytes[BDRV_ACCT_WRITE], bs->nr_ops[BDRV_ACCT_READ], bs->nr_ops[BDRV_ACCT_WRITE], bs->wr_highest_sector * (uint64_t)BDRV_SECTOR_SIZE, bs->nr_ops[BDRV_ACCT_FLUSH]); dict = qobject_to_qdict(res); if (*bs->device_name) { qdict_put(dict, "device", qstring_from_str(bs->device_name)); } if (bs->file) { QObject *parent = bdrv_info_stats_bs(bs->file); qdict_put_obj(dict, "parent", parent); } return res; }
false
qemu
c488c7f649106d09df76f697adccbe6e72520b26
static QObject* bdrv_info_stats_bs(BlockDriverState *bs) { QObject *res; QDict *dict; res = qobject_from_jsonf("{ 'stats': {" "'rd_bytes': %" PRId64 "," "'wr_bytes': %" PRId64 "," "'rd_operations': %" PRId64 "," "'wr_operations': %" PRId64 "," "'wr_highest_offset': %" PRId64 "," "'flush_operations': %" PRId64 "} }", bs->nr_bytes[BDRV_ACCT_READ], bs->nr_bytes[BDRV_ACCT_WRITE], bs->nr_ops[BDRV_ACCT_READ], bs->nr_ops[BDRV_ACCT_WRITE], bs->wr_highest_sector * (uint64_t)BDRV_SECTOR_SIZE, bs->nr_ops[BDRV_ACCT_FLUSH]); dict = qobject_to_qdict(res); if (*bs->device_name) { qdict_put(dict, "device", qstring_from_str(bs->device_name)); } if (bs->file) { QObject *parent = bdrv_info_stats_bs(bs->file); qdict_put_obj(dict, "parent", parent); } return res; }
{ "code": [], "line_no": [] }
static QObject* FUNC_0(BlockDriverState *bs) { QObject *res; QDict *dict; res = qobject_from_jsonf("{ 'stats': {" "'rd_bytes': %" PRId64 "," "'wr_bytes': %" PRId64 "," "'rd_operations': %" PRId64 "," "'wr_operations': %" PRId64 "," "'wr_highest_offset': %" PRId64 "," "'flush_operations': %" PRId64 "} }", bs->nr_bytes[BDRV_ACCT_READ], bs->nr_bytes[BDRV_ACCT_WRITE], bs->nr_ops[BDRV_ACCT_READ], bs->nr_ops[BDRV_ACCT_WRITE], bs->wr_highest_sector * (uint64_t)BDRV_SECTOR_SIZE, bs->nr_ops[BDRV_ACCT_FLUSH]); dict = qobject_to_qdict(res); if (*bs->device_name) { qdict_put(dict, "device", qstring_from_str(bs->device_name)); } if (bs->file) { QObject *parent = FUNC_0(bs->file); qdict_put_obj(dict, "parent", parent); } return res; }
[ "static QObject* FUNC_0(BlockDriverState *bs)\n{", "QObject *res;", "QDict *dict;", "res = qobject_from_jsonf(\"{ 'stats': {\"", "\"'rd_bytes': %\" PRId64 \",\"\n\"'wr_bytes': %\" PRId64 \",\"\n\"'rd_operations': %\" PRId64 \",\"\n\"'wr_operations': %\" PRId64 \",\"\n\"'wr_highest_offset': %\" PRId64 \",\"\n\"'flush_operations': %\" PRId64\n\"} }\",", "bs->nr_bytes[BDRV_ACCT_READ],\nbs->nr_bytes[BDRV_ACCT_WRITE],\nbs->nr_ops[BDRV_ACCT_READ],\nbs->nr_ops[BDRV_ACCT_WRITE],\nbs->wr_highest_sector *\n(uint64_t)BDRV_SECTOR_SIZE,\nbs->nr_ops[BDRV_ACCT_FLUSH]);", "dict = qobject_to_qdict(res);", "if (*bs->device_name) {", "qdict_put(dict, \"device\", qstring_from_str(bs->device_name));", "}", "if (bs->file) {", "QObject *parent = FUNC_0(bs->file);", "qdict_put_obj(dict, \"parent\", parent);", "}", "return res;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15, 17, 19, 21, 23, 25 ], [ 27, 29, 31, 33, 35, 37, 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
5,833
static void sun4m_common_init(int ram_size, int boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model, unsigned int machine) { sun4m_hw_init(&hwdefs[machine], ram_size, ds, cpu_model); sun4m_load_kernel(hwdefs[machine].vram_size, ram_size, boot_device, kernel_filename, kernel_cmdline, initrd_filename, hwdefs[machine].machine_id); }
false
qemu
4edebb0e8e14a5b934114b5ff74cb86437bb2532
static void sun4m_common_init(int ram_size, int boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model, unsigned int machine) { sun4m_hw_init(&hwdefs[machine], ram_size, ds, cpu_model); sun4m_load_kernel(hwdefs[machine].vram_size, ram_size, boot_device, kernel_filename, kernel_cmdline, initrd_filename, hwdefs[machine].machine_id); }
{ "code": [], "line_no": [] }
static void FUNC_0(int VAR_0, int VAR_1, DisplayState *VAR_2, const char *VAR_3, const char *VAR_4, const char *VAR_5, const char *VAR_6, unsigned int VAR_7) { sun4m_hw_init(&hwdefs[VAR_7], VAR_0, VAR_2, VAR_6); sun4m_load_kernel(hwdefs[VAR_7].vram_size, VAR_0, VAR_1, VAR_3, VAR_4, VAR_5, hwdefs[VAR_7].machine_id); }
[ "static void FUNC_0(int VAR_0, int VAR_1, DisplayState *VAR_2,\nconst char *VAR_3, const char *VAR_4,\nconst char *VAR_5, const char *VAR_6,\nunsigned int VAR_7)\n{", "sun4m_hw_init(&hwdefs[VAR_7], VAR_0, VAR_2, VAR_6);", "sun4m_load_kernel(hwdefs[VAR_7].vram_size, VAR_0, VAR_1,\nVAR_3, VAR_4, VAR_5,\nhwdefs[VAR_7].machine_id);", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15, 17, 19 ], [ 21 ] ]
5,835
static int pmp_packet(AVFormatContext *s, AVPacket *pkt) { PMPContext *pmp = s->priv_data; AVIOContext *pb = s->pb; int ret = 0; int i; if (url_feof(pb)) return AVERROR_EOF; if (pmp->cur_stream == 0) { int num_packets; pmp->audio_packets = avio_r8(pb); num_packets = (pmp->num_streams - 1) * pmp->audio_packets + 1; avio_skip(pb, 8); pmp->current_packet = 0; av_fast_malloc(&pmp->packet_sizes, &pmp->packet_sizes_alloc, num_packets * sizeof(*pmp->packet_sizes)); if (!pmp->packet_sizes_alloc) { av_log(s, AV_LOG_ERROR, "Cannot (re)allocate packet buffer\n"); return AVERROR(ENOMEM); for (i = 0; i < num_packets; i++) pmp->packet_sizes[i] = avio_rl32(pb); ret = av_get_packet(pb, pkt, pmp->packet_sizes[pmp->current_packet]); if (ret >= 0) { ret = 0; // FIXME: this is a hack that should be removed once // compute_pkt_fields() can handle timestamps properly if (pmp->cur_stream == 0) pkt->dts = s->streams[0]->cur_dts++; pkt->stream_index = pmp->cur_stream; if (pmp->current_packet % pmp->audio_packets == 0) pmp->cur_stream = (pmp->cur_stream + 1) % pmp->num_streams; pmp->current_packet++; return ret;
true
FFmpeg
8b1cd25ca7e64e6128fa2902d78e48bfeeec9786
static int pmp_packet(AVFormatContext *s, AVPacket *pkt) { PMPContext *pmp = s->priv_data; AVIOContext *pb = s->pb; int ret = 0; int i; if (url_feof(pb)) return AVERROR_EOF; if (pmp->cur_stream == 0) { int num_packets; pmp->audio_packets = avio_r8(pb); num_packets = (pmp->num_streams - 1) * pmp->audio_packets + 1; avio_skip(pb, 8); pmp->current_packet = 0; av_fast_malloc(&pmp->packet_sizes, &pmp->packet_sizes_alloc, num_packets * sizeof(*pmp->packet_sizes)); if (!pmp->packet_sizes_alloc) { av_log(s, AV_LOG_ERROR, "Cannot (re)allocate packet buffer\n"); return AVERROR(ENOMEM); for (i = 0; i < num_packets; i++) pmp->packet_sizes[i] = avio_rl32(pb); ret = av_get_packet(pb, pkt, pmp->packet_sizes[pmp->current_packet]); if (ret >= 0) { ret = 0; if (pmp->cur_stream == 0) pkt->dts = s->streams[0]->cur_dts++; pkt->stream_index = pmp->cur_stream; if (pmp->current_packet % pmp->audio_packets == 0) pmp->cur_stream = (pmp->cur_stream + 1) % pmp->num_streams; pmp->current_packet++; return ret;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { PMPContext *pmp = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int VAR_2 = 0; int VAR_3; if (url_feof(pb)) return AVERROR_EOF; if (pmp->cur_stream == 0) { int VAR_4; pmp->audio_packets = avio_r8(pb); VAR_4 = (pmp->num_streams - 1) * pmp->audio_packets + 1; avio_skip(pb, 8); pmp->current_packet = 0; av_fast_malloc(&pmp->packet_sizes, &pmp->packet_sizes_alloc, VAR_4 * sizeof(*pmp->packet_sizes)); if (!pmp->packet_sizes_alloc) { av_log(VAR_0, AV_LOG_ERROR, "Cannot (re)allocate packet buffer\n"); return AVERROR(ENOMEM); for (VAR_3 = 0; VAR_3 < VAR_4; VAR_3++) pmp->packet_sizes[VAR_3] = avio_rl32(pb); VAR_2 = av_get_packet(pb, VAR_1, pmp->packet_sizes[pmp->current_packet]); if (VAR_2 >= 0) { VAR_2 = 0; if (pmp->cur_stream == 0) VAR_1->dts = VAR_0->streams[0]->cur_dts++; VAR_1->stream_index = pmp->cur_stream; if (pmp->current_packet % pmp->audio_packets == 0) pmp->cur_stream = (pmp->cur_stream + 1) % pmp->num_streams; pmp->current_packet++; return VAR_2;
[ "static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)\n{", "PMPContext *pmp = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int VAR_2 = 0;", "int VAR_3;", "if (url_feof(pb))\nreturn AVERROR_EOF;", "if (pmp->cur_stream == 0) {", "int VAR_4;", "pmp->audio_packets = avio_r8(pb);", "VAR_4 = (pmp->num_streams - 1) * pmp->audio_packets + 1;", "avio_skip(pb, 8);", "pmp->current_packet = 0;", "av_fast_malloc(&pmp->packet_sizes,\n&pmp->packet_sizes_alloc,\nVAR_4 * sizeof(*pmp->packet_sizes));", "if (!pmp->packet_sizes_alloc) {", "av_log(VAR_0, AV_LOG_ERROR, \"Cannot (re)allocate packet buffer\\n\");", "return AVERROR(ENOMEM);", "for (VAR_3 = 0; VAR_3 < VAR_4; VAR_3++)", "pmp->packet_sizes[VAR_3] = avio_rl32(pb);", "VAR_2 = av_get_packet(pb, VAR_1, pmp->packet_sizes[pmp->current_packet]);", "if (VAR_2 >= 0) {", "VAR_2 = 0;", "if (pmp->cur_stream == 0)\nVAR_1->dts = VAR_0->streams[0]->cur_dts++;", "VAR_1->stream_index = pmp->cur_stream;", "if (pmp->current_packet % pmp->audio_packets == 0)\npmp->cur_stream = (pmp->cur_stream + 1) % pmp->num_streams;", "pmp->current_packet++;", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15, 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37, 39 ], [ 41 ], [ 43 ], [ 45 ], [ 48 ], [ 50 ], [ 53 ], [ 55 ], [ 57 ], [ 63, 65 ], [ 67 ], [ 70, 72 ], [ 74 ], [ 76 ] ]
5,836
void virtio_queue_notify(VirtIODevice *vdev, int n) { if (n < VIRTIO_PCI_QUEUE_MAX) { virtio_queue_notify_vq(&vdev->vq[n]); } }
true
qemu
7157e2e23e89adcd436caeab31fdd6b47eded377
void virtio_queue_notify(VirtIODevice *vdev, int n) { if (n < VIRTIO_PCI_QUEUE_MAX) { virtio_queue_notify_vq(&vdev->vq[n]); } }
{ "code": [ " if (n < VIRTIO_PCI_QUEUE_MAX) {", " virtio_queue_notify_vq(&vdev->vq[n]);" ], "line_no": [ 5, 7 ] }
void FUNC_0(VirtIODevice *VAR_0, int VAR_1) { if (VAR_1 < VIRTIO_PCI_QUEUE_MAX) { virtio_queue_notify_vq(&VAR_0->vq[VAR_1]); } }
[ "void FUNC_0(VirtIODevice *VAR_0, int VAR_1)\n{", "if (VAR_1 < VIRTIO_PCI_QUEUE_MAX) {", "virtio_queue_notify_vq(&VAR_0->vq[VAR_1]);", "}", "}" ]
[ 0, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ] ]
5,838
int av_picture_crop(AVPicture *dst, const AVPicture *src, enum PixelFormat pix_fmt, int top_band, int left_band) { int y_shift; int x_shift; if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB) return -1; y_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h; x_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w; if (is_yuv_planar(&pix_fmt_info[pix_fmt])) { dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band; dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift); dst->data[2] = src->data[2] + ((top_band >> y_shift) * src->linesize[2]) + (left_band >> x_shift); } else{ if(top_band % (1<<y_shift) || left_band % (1<<x_shift)) return -1; if(left_band) //FIXME add support for this too return -1; dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band; } dst->linesize[0] = src->linesize[0]; dst->linesize[1] = src->linesize[1]; dst->linesize[2] = src->linesize[2]; return 0; }
false
FFmpeg
d7e14c0d103a2c9cca6c50568e09b40d6f48ea19
int av_picture_crop(AVPicture *dst, const AVPicture *src, enum PixelFormat pix_fmt, int top_band, int left_band) { int y_shift; int x_shift; if (pix_fmt < 0 || pix_fmt >= PIX_FMT_NB) return -1; y_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_h; x_shift = av_pix_fmt_descriptors[pix_fmt].log2_chroma_w; if (is_yuv_planar(&pix_fmt_info[pix_fmt])) { dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band; dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift); dst->data[2] = src->data[2] + ((top_band >> y_shift) * src->linesize[2]) + (left_band >> x_shift); } else{ if(top_band % (1<<y_shift) || left_band % (1<<x_shift)) return -1; if(left_band) return -1; dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band; } dst->linesize[0] = src->linesize[0]; dst->linesize[1] = src->linesize[1]; dst->linesize[2] = src->linesize[2]; return 0; }
{ "code": [], "line_no": [] }
int FUNC_0(AVPicture *VAR_0, const AVPicture *VAR_1, enum PixelFormat VAR_2, int VAR_3, int VAR_4) { int VAR_5; int VAR_6; if (VAR_2 < 0 || VAR_2 >= PIX_FMT_NB) return -1; VAR_5 = av_pix_fmt_descriptors[VAR_2].log2_chroma_h; VAR_6 = av_pix_fmt_descriptors[VAR_2].log2_chroma_w; if (is_yuv_planar(&pix_fmt_info[VAR_2])) { VAR_0->data[0] = VAR_1->data[0] + (VAR_3 * VAR_1->linesize[0]) + VAR_4; VAR_0->data[1] = VAR_1->data[1] + ((VAR_3 >> VAR_5) * VAR_1->linesize[1]) + (VAR_4 >> VAR_6); VAR_0->data[2] = VAR_1->data[2] + ((VAR_3 >> VAR_5) * VAR_1->linesize[2]) + (VAR_4 >> VAR_6); } else{ if(VAR_3 % (1<<VAR_5) || VAR_4 % (1<<VAR_6)) return -1; if(VAR_4) return -1; VAR_0->data[0] = VAR_1->data[0] + (VAR_3 * VAR_1->linesize[0]) + VAR_4; } VAR_0->linesize[0] = VAR_1->linesize[0]; VAR_0->linesize[1] = VAR_1->linesize[1]; VAR_0->linesize[2] = VAR_1->linesize[2]; return 0; }
[ "int FUNC_0(AVPicture *VAR_0, const AVPicture *VAR_1,\nenum PixelFormat VAR_2, int VAR_3, int VAR_4)\n{", "int VAR_5;", "int VAR_6;", "if (VAR_2 < 0 || VAR_2 >= PIX_FMT_NB)\nreturn -1;", "VAR_5 = av_pix_fmt_descriptors[VAR_2].log2_chroma_h;", "VAR_6 = av_pix_fmt_descriptors[VAR_2].log2_chroma_w;", "if (is_yuv_planar(&pix_fmt_info[VAR_2])) {", "VAR_0->data[0] = VAR_1->data[0] + (VAR_3 * VAR_1->linesize[0]) + VAR_4;", "VAR_0->data[1] = VAR_1->data[1] + ((VAR_3 >> VAR_5) * VAR_1->linesize[1]) + (VAR_4 >> VAR_6);", "VAR_0->data[2] = VAR_1->data[2] + ((VAR_3 >> VAR_5) * VAR_1->linesize[2]) + (VAR_4 >> VAR_6);", "} else{", "if(VAR_3 % (1<<VAR_5) || VAR_4 % (1<<VAR_6))\nreturn -1;", "if(VAR_4)\nreturn -1;", "VAR_0->data[0] = VAR_1->data[0] + (VAR_3 * VAR_1->linesize[0]) + VAR_4;", "}", "VAR_0->linesize[0] = VAR_1->linesize[0];", "VAR_0->linesize[1] = VAR_1->linesize[1];", "VAR_0->linesize[2] = VAR_1->linesize[2];", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ] ]
5,839
void ff_put_h264_qpel16_mc30_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hz_qrt_16w_msa(src - 2, stride, dst, stride, 16, 1); }
false
FFmpeg
b5da07d4340a8e8e40dcd1900977a76ff31fbb84
void ff_put_h264_qpel16_mc30_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_hz_qrt_16w_msa(src - 2, stride, dst, stride, 16, 1); }
{ "code": [], "line_no": [] }
void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1, ptrdiff_t VAR_2) { avc_luma_hz_qrt_16w_msa(VAR_1 - 2, VAR_2, VAR_0, VAR_2, 16, 1); }
[ "void FUNC_0(uint8_t *VAR_0, const uint8_t *VAR_1,\nptrdiff_t VAR_2)\n{", "avc_luma_hz_qrt_16w_msa(VAR_1 - 2, VAR_2, VAR_0, VAR_2, 16, 1);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ] ]
5,841
static int wv_read_packet(AVFormatContext *s, AVPacket *pkt) { WVContext *wc = s->priv_data; int ret, samples; if (url_feof(&s->pb)) return -EIO; if(wc->block_parsed){ if(wv_read_block_header(s, &s->pb) < 0) return -1; } samples = LE_32(wc->extra); /* should not happen but who knows */ if(samples * 2 * wc->chan > AVCODEC_MAX_AUDIO_FRAME_SIZE){ av_log(s, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n"); return -EIO; } if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE) < 0) return AVERROR_NOMEM; memcpy(pkt->data, wc->extra, WV_EXTRA_SIZE); ret = get_buffer(&s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize); if(ret != wc->blksize){ av_free_packet(pkt); return AVERROR_IO; } pkt->stream_index = 0; wc->block_parsed = 1; pkt->size = ret + WV_EXTRA_SIZE; return 0; }
false
FFmpeg
4ec0beaa593860796feead14132506226a1edf0e
static int wv_read_packet(AVFormatContext *s, AVPacket *pkt) { WVContext *wc = s->priv_data; int ret, samples; if (url_feof(&s->pb)) return -EIO; if(wc->block_parsed){ if(wv_read_block_header(s, &s->pb) < 0) return -1; } samples = LE_32(wc->extra); if(samples * 2 * wc->chan > AVCODEC_MAX_AUDIO_FRAME_SIZE){ av_log(s, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n"); return -EIO; } if(av_new_packet(pkt, wc->blksize + WV_EXTRA_SIZE) < 0) return AVERROR_NOMEM; memcpy(pkt->data, wc->extra, WV_EXTRA_SIZE); ret = get_buffer(&s->pb, pkt->data + WV_EXTRA_SIZE, wc->blksize); if(ret != wc->blksize){ av_free_packet(pkt); return AVERROR_IO; } pkt->stream_index = 0; wc->block_parsed = 1; pkt->size = ret + WV_EXTRA_SIZE; return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1) { WVContext *wc = VAR_0->priv_data; int VAR_2, VAR_3; if (url_feof(&VAR_0->pb)) return -EIO; if(wc->block_parsed){ if(wv_read_block_header(VAR_0, &VAR_0->pb) < 0) return -1; } VAR_3 = LE_32(wc->extra); if(VAR_3 * 2 * wc->chan > AVCODEC_MAX_AUDIO_FRAME_SIZE){ av_log(VAR_0, AV_LOG_ERROR, "Packet size is too big to be handled in lavc!\n"); return -EIO; } if(av_new_packet(VAR_1, wc->blksize + WV_EXTRA_SIZE) < 0) return AVERROR_NOMEM; memcpy(VAR_1->data, wc->extra, WV_EXTRA_SIZE); VAR_2 = get_buffer(&VAR_0->pb, VAR_1->data + WV_EXTRA_SIZE, wc->blksize); if(VAR_2 != wc->blksize){ av_free_packet(VAR_1); return AVERROR_IO; } VAR_1->stream_index = 0; wc->block_parsed = 1; VAR_1->size = VAR_2 + WV_EXTRA_SIZE; return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVPacket *VAR_1)\n{", "WVContext *wc = VAR_0->priv_data;", "int VAR_2, VAR_3;", "if (url_feof(&VAR_0->pb))\nreturn -EIO;", "if(wc->block_parsed){", "if(wv_read_block_header(VAR_0, &VAR_0->pb) < 0)\nreturn -1;", "}", "VAR_3 = LE_32(wc->extra);", "if(VAR_3 * 2 * wc->chan > AVCODEC_MAX_AUDIO_FRAME_SIZE){", "av_log(VAR_0, AV_LOG_ERROR, \"Packet size is too big to be handled in lavc!\\n\");", "return -EIO;", "}", "if(av_new_packet(VAR_1, wc->blksize + WV_EXTRA_SIZE) < 0)\nreturn AVERROR_NOMEM;", "memcpy(VAR_1->data, wc->extra, WV_EXTRA_SIZE);", "VAR_2 = get_buffer(&VAR_0->pb, VAR_1->data + WV_EXTRA_SIZE, wc->blksize);", "if(VAR_2 != wc->blksize){", "av_free_packet(VAR_1);", "return AVERROR_IO;", "}", "VAR_1->stream_index = 0;", "wc->block_parsed = 1;", "VAR_1->size = VAR_2 + WV_EXTRA_SIZE;", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13, 15 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ] ]
5,842
static void calc_masking(DCAEncContext *c, const int32_t *input) { int i, k, band, ch, ssf; int32_t data[512]; for (i = 0; i < 256; i++) for (ssf = 0; ssf < SUBSUBFRAMES; ssf++) c->masking_curve_cb[ssf][i] = -2047; for (ssf = 0; ssf < SUBSUBFRAMES; ssf++) for (ch = 0; ch < c->fullband_channels; ch++) { const int chi = c->channel_order_tab[ch]; for (i = 0, k = 128 + 256 * ssf; k < 512; i++, k++) data[i] = c->history[k][ch]; for (k -= 512; i < 512; i++, k++) data[i] = input[k * c->channels + chi]; adjust_jnd(c->samplerate_index, data, c->masking_curve_cb[ssf]); } for (i = 0; i < 256; i++) { int32_t m = 2048; for (ssf = 0; ssf < SUBSUBFRAMES; ssf++) if (c->masking_curve_cb[ssf][i] < m) m = c->masking_curve_cb[ssf][i]; c->eff_masking_curve_cb[i] = m; } for (band = 0; band < 32; band++) { c->band_masking_cb[band] = 2048; walk_band_low(c, band, 0, update_band_masking, NULL); walk_band_high(c, band, 0, update_band_masking, NULL); } }
false
FFmpeg
a6191d098a03f94685ae4c072bfdf10afcd86223
static void calc_masking(DCAEncContext *c, const int32_t *input) { int i, k, band, ch, ssf; int32_t data[512]; for (i = 0; i < 256; i++) for (ssf = 0; ssf < SUBSUBFRAMES; ssf++) c->masking_curve_cb[ssf][i] = -2047; for (ssf = 0; ssf < SUBSUBFRAMES; ssf++) for (ch = 0; ch < c->fullband_channels; ch++) { const int chi = c->channel_order_tab[ch]; for (i = 0, k = 128 + 256 * ssf; k < 512; i++, k++) data[i] = c->history[k][ch]; for (k -= 512; i < 512; i++, k++) data[i] = input[k * c->channels + chi]; adjust_jnd(c->samplerate_index, data, c->masking_curve_cb[ssf]); } for (i = 0; i < 256; i++) { int32_t m = 2048; for (ssf = 0; ssf < SUBSUBFRAMES; ssf++) if (c->masking_curve_cb[ssf][i] < m) m = c->masking_curve_cb[ssf][i]; c->eff_masking_curve_cb[i] = m; } for (band = 0; band < 32; band++) { c->band_masking_cb[band] = 2048; walk_band_low(c, band, 0, update_band_masking, NULL); walk_band_high(c, band, 0, update_band_masking, NULL); } }
{ "code": [], "line_no": [] }
static void FUNC_0(DCAEncContext *VAR_0, const int32_t *VAR_1) { int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6; int32_t data[512]; for (VAR_2 = 0; VAR_2 < 256; VAR_2++) for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++) VAR_0->masking_curve_cb[VAR_6][VAR_2] = -2047; for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++) for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++) { const int chi = VAR_0->channel_order_tab[VAR_5]; for (VAR_2 = 0, VAR_3 = 128 + 256 * VAR_6; VAR_3 < 512; VAR_2++, VAR_3++) data[VAR_2] = VAR_0->history[VAR_3][VAR_5]; for (VAR_3 -= 512; VAR_2 < 512; VAR_2++, VAR_3++) data[VAR_2] = VAR_1[VAR_3 * VAR_0->channels + chi]; adjust_jnd(VAR_0->samplerate_index, data, VAR_0->masking_curve_cb[VAR_6]); } for (VAR_2 = 0; VAR_2 < 256; VAR_2++) { int32_t m = 2048; for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++) if (VAR_0->masking_curve_cb[VAR_6][VAR_2] < m) m = VAR_0->masking_curve_cb[VAR_6][VAR_2]; VAR_0->eff_masking_curve_cb[VAR_2] = m; } for (VAR_4 = 0; VAR_4 < 32; VAR_4++) { VAR_0->band_masking_cb[VAR_4] = 2048; walk_band_low(VAR_0, VAR_4, 0, update_band_masking, NULL); walk_band_high(VAR_0, VAR_4, 0, update_band_masking, NULL); } }
[ "static void FUNC_0(DCAEncContext *VAR_0, const int32_t *VAR_1)\n{", "int VAR_2, VAR_3, VAR_4, VAR_5, VAR_6;", "int32_t data[512];", "for (VAR_2 = 0; VAR_2 < 256; VAR_2++)", "for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++)", "VAR_0->masking_curve_cb[VAR_6][VAR_2] = -2047;", "for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++)", "for (VAR_5 = 0; VAR_5 < VAR_0->fullband_channels; VAR_5++) {", "const int chi = VAR_0->channel_order_tab[VAR_5];", "for (VAR_2 = 0, VAR_3 = 128 + 256 * VAR_6; VAR_3 < 512; VAR_2++, VAR_3++)", "data[VAR_2] = VAR_0->history[VAR_3][VAR_5];", "for (VAR_3 -= 512; VAR_2 < 512; VAR_2++, VAR_3++)", "data[VAR_2] = VAR_1[VAR_3 * VAR_0->channels + chi];", "adjust_jnd(VAR_0->samplerate_index, data, VAR_0->masking_curve_cb[VAR_6]);", "}", "for (VAR_2 = 0; VAR_2 < 256; VAR_2++) {", "int32_t m = 2048;", "for (VAR_6 = 0; VAR_6 < SUBSUBFRAMES; VAR_6++)", "if (VAR_0->masking_curve_cb[VAR_6][VAR_2] < m)\nm = VAR_0->masking_curve_cb[VAR_6][VAR_2];", "VAR_0->eff_masking_curve_cb[VAR_2] = m;", "}", "for (VAR_4 = 0; VAR_4 < 32; VAR_4++) {", "VAR_0->band_masking_cb[VAR_4] = 2048;", "walk_band_low(VAR_0, VAR_4, 0, update_band_masking, NULL);", "walk_band_high(VAR_0, VAR_4, 0, update_band_masking, 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, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ] ]
5,843
static coroutine_fn void nbd_trip(void *opaque) { NBDClient *client = opaque; NBDExport *exp = client->exp; NBDRequestData *req; NBDRequest request = { 0 }; /* GCC thinks it can be used uninitialized */ int ret; int flags; int reply_data_len = 0; Error *local_err = NULL; char *msg = NULL; trace_nbd_trip(); if (client->closing) { nbd_client_put(client); return; } req = nbd_request_get(client); ret = nbd_co_receive_request(req, &request, &local_err); client->recv_coroutine = NULL; nbd_client_receive_next_request(client); if (ret == -EIO) { goto disconnect; } if (ret < 0) { goto reply; } if (client->closing) { /* * The client may be closed when we are blocked in * nbd_co_receive_request() */ goto done; } switch (request.type) { case NBD_CMD_READ: /* XXX: NBD Protocol only documents use of FUA with WRITE */ if (request.flags & NBD_CMD_FLAG_FUA) { ret = blk_co_flush(exp->blk); if (ret < 0) { error_setg_errno(&local_err, -ret, "flush failed"); break; } } ret = blk_pread(exp->blk, request.from + exp->dev_offset, req->data, request.len); if (ret < 0) { error_setg_errno(&local_err, -ret, "reading from file failed"); break; } reply_data_len = request.len; break; case NBD_CMD_WRITE: if (exp->nbdflags & NBD_FLAG_READ_ONLY) { error_setg(&local_err, "Export is read-only"); ret = -EROFS; break; } flags = 0; if (request.flags & NBD_CMD_FLAG_FUA) { flags |= BDRV_REQ_FUA; } ret = blk_pwrite(exp->blk, request.from + exp->dev_offset, req->data, request.len, flags); if (ret < 0) { error_setg_errno(&local_err, -ret, "writing to file failed"); } break; case NBD_CMD_WRITE_ZEROES: if (exp->nbdflags & NBD_FLAG_READ_ONLY) { error_setg(&local_err, "Export is read-only"); ret = -EROFS; break; } flags = 0; if (request.flags & NBD_CMD_FLAG_FUA) { flags |= BDRV_REQ_FUA; } if (!(request.flags & NBD_CMD_FLAG_NO_HOLE)) { flags |= BDRV_REQ_MAY_UNMAP; } ret = blk_pwrite_zeroes(exp->blk, request.from + exp->dev_offset, request.len, flags); if (ret < 0) { error_setg_errno(&local_err, -ret, "writing to file failed"); } break; case NBD_CMD_DISC: /* unreachable, thanks to special case in nbd_co_receive_request() */ abort(); case NBD_CMD_FLUSH: ret = blk_co_flush(exp->blk); if (ret < 0) { error_setg_errno(&local_err, -ret, "flush failed"); } break; case NBD_CMD_TRIM: ret = blk_co_pdiscard(exp->blk, request.from + exp->dev_offset, request.len); if (ret < 0) { error_setg_errno(&local_err, -ret, "discard failed"); } break; default: error_setg(&local_err, "invalid request type (%" PRIu32 ") received", request.type); ret = -EINVAL; } reply: if (local_err) { /* If we get here, local_err was not a fatal error, and should be sent * to the client. */ assert(ret < 0); msg = g_strdup(error_get_pretty(local_err)); error_report_err(local_err); local_err = NULL; } if (client->structured_reply && (ret < 0 || request.type == NBD_CMD_READ)) { if (ret < 0) { ret = nbd_co_send_structured_error(req->client, request.handle, -ret, msg, &local_err); } else { ret = nbd_co_send_structured_read(req->client, request.handle, request.from, req->data, reply_data_len, &local_err); } } else { ret = nbd_co_send_simple_reply(req->client, request.handle, ret < 0 ? -ret : 0, req->data, reply_data_len, &local_err); } g_free(msg); if (ret < 0) { error_prepend(&local_err, "Failed to send reply: "); goto disconnect; } /* We must disconnect after NBD_CMD_WRITE if we did not * read the payload. */ if (!req->complete) { error_setg(&local_err, "Request handling failed in intermediate state"); goto disconnect; } done: nbd_request_put(req); nbd_client_put(client); return; disconnect: if (local_err) { error_reportf_err(local_err, "Disconnect client, due to: "); } nbd_request_put(req); client_close(client, true); nbd_client_put(client); }
true
qemu
ef8c887ee01a4e4c8c5c28c86ea5b45162c51bcd
static coroutine_fn void nbd_trip(void *opaque) { NBDClient *client = opaque; NBDExport *exp = client->exp; NBDRequestData *req; NBDRequest request = { 0 }; int ret; int flags; int reply_data_len = 0; Error *local_err = NULL; char *msg = NULL; trace_nbd_trip(); if (client->closing) { nbd_client_put(client); return; } req = nbd_request_get(client); ret = nbd_co_receive_request(req, &request, &local_err); client->recv_coroutine = NULL; nbd_client_receive_next_request(client); if (ret == -EIO) { goto disconnect; } if (ret < 0) { goto reply; } if (client->closing) { goto done; } switch (request.type) { case NBD_CMD_READ: if (request.flags & NBD_CMD_FLAG_FUA) { ret = blk_co_flush(exp->blk); if (ret < 0) { error_setg_errno(&local_err, -ret, "flush failed"); break; } } ret = blk_pread(exp->blk, request.from + exp->dev_offset, req->data, request.len); if (ret < 0) { error_setg_errno(&local_err, -ret, "reading from file failed"); break; } reply_data_len = request.len; break; case NBD_CMD_WRITE: if (exp->nbdflags & NBD_FLAG_READ_ONLY) { error_setg(&local_err, "Export is read-only"); ret = -EROFS; break; } flags = 0; if (request.flags & NBD_CMD_FLAG_FUA) { flags |= BDRV_REQ_FUA; } ret = blk_pwrite(exp->blk, request.from + exp->dev_offset, req->data, request.len, flags); if (ret < 0) { error_setg_errno(&local_err, -ret, "writing to file failed"); } break; case NBD_CMD_WRITE_ZEROES: if (exp->nbdflags & NBD_FLAG_READ_ONLY) { error_setg(&local_err, "Export is read-only"); ret = -EROFS; break; } flags = 0; if (request.flags & NBD_CMD_FLAG_FUA) { flags |= BDRV_REQ_FUA; } if (!(request.flags & NBD_CMD_FLAG_NO_HOLE)) { flags |= BDRV_REQ_MAY_UNMAP; } ret = blk_pwrite_zeroes(exp->blk, request.from + exp->dev_offset, request.len, flags); if (ret < 0) { error_setg_errno(&local_err, -ret, "writing to file failed"); } break; case NBD_CMD_DISC: abort(); case NBD_CMD_FLUSH: ret = blk_co_flush(exp->blk); if (ret < 0) { error_setg_errno(&local_err, -ret, "flush failed"); } break; case NBD_CMD_TRIM: ret = blk_co_pdiscard(exp->blk, request.from + exp->dev_offset, request.len); if (ret < 0) { error_setg_errno(&local_err, -ret, "discard failed"); } break; default: error_setg(&local_err, "invalid request type (%" PRIu32 ") received", request.type); ret = -EINVAL; } reply: if (local_err) { assert(ret < 0); msg = g_strdup(error_get_pretty(local_err)); error_report_err(local_err); local_err = NULL; } if (client->structured_reply && (ret < 0 || request.type == NBD_CMD_READ)) { if (ret < 0) { ret = nbd_co_send_structured_error(req->client, request.handle, -ret, msg, &local_err); } else { ret = nbd_co_send_structured_read(req->client, request.handle, request.from, req->data, reply_data_len, &local_err); } } else { ret = nbd_co_send_simple_reply(req->client, request.handle, ret < 0 ? -ret : 0, req->data, reply_data_len, &local_err); } g_free(msg); if (ret < 0) { error_prepend(&local_err, "Failed to send reply: "); goto disconnect; } if (!req->complete) { error_setg(&local_err, "Request handling failed in intermediate state"); goto disconnect; } done: nbd_request_put(req); nbd_client_put(client); return; disconnect: if (local_err) { error_reportf_err(local_err, "Disconnect client, due to: "); } nbd_request_put(req); client_close(client, true); nbd_client_put(client); }
{ "code": [ " } else {" ], "line_no": [ 277 ] }
static coroutine_fn void FUNC_0(void *opaque) { NBDClient *client = opaque; NBDExport *exp = client->exp; NBDRequestData *req; NBDRequest request = { 0 }; int VAR_0; int VAR_1; int VAR_2 = 0; Error *local_err = NULL; char *VAR_3 = NULL; trace_nbd_trip(); if (client->closing) { nbd_client_put(client); return; } req = nbd_request_get(client); VAR_0 = nbd_co_receive_request(req, &request, &local_err); client->recv_coroutine = NULL; nbd_client_receive_next_request(client); if (VAR_0 == -EIO) { goto disconnect; } if (VAR_0 < 0) { goto reply; } if (client->closing) { goto done; } switch (request.type) { case NBD_CMD_READ: if (request.VAR_1 & NBD_CMD_FLAG_FUA) { VAR_0 = blk_co_flush(exp->blk); if (VAR_0 < 0) { error_setg_errno(&local_err, -VAR_0, "flush failed"); break; } } VAR_0 = blk_pread(exp->blk, request.from + exp->dev_offset, req->data, request.len); if (VAR_0 < 0) { error_setg_errno(&local_err, -VAR_0, "reading from file failed"); break; } VAR_2 = request.len; break; case NBD_CMD_WRITE: if (exp->nbdflags & NBD_FLAG_READ_ONLY) { error_setg(&local_err, "Export is read-only"); VAR_0 = -EROFS; break; } VAR_1 = 0; if (request.VAR_1 & NBD_CMD_FLAG_FUA) { VAR_1 |= BDRV_REQ_FUA; } VAR_0 = blk_pwrite(exp->blk, request.from + exp->dev_offset, req->data, request.len, VAR_1); if (VAR_0 < 0) { error_setg_errno(&local_err, -VAR_0, "writing to file failed"); } break; case NBD_CMD_WRITE_ZEROES: if (exp->nbdflags & NBD_FLAG_READ_ONLY) { error_setg(&local_err, "Export is read-only"); VAR_0 = -EROFS; break; } VAR_1 = 0; if (request.VAR_1 & NBD_CMD_FLAG_FUA) { VAR_1 |= BDRV_REQ_FUA; } if (!(request.VAR_1 & NBD_CMD_FLAG_NO_HOLE)) { VAR_1 |= BDRV_REQ_MAY_UNMAP; } VAR_0 = blk_pwrite_zeroes(exp->blk, request.from + exp->dev_offset, request.len, VAR_1); if (VAR_0 < 0) { error_setg_errno(&local_err, -VAR_0, "writing to file failed"); } break; case NBD_CMD_DISC: abort(); case NBD_CMD_FLUSH: VAR_0 = blk_co_flush(exp->blk); if (VAR_0 < 0) { error_setg_errno(&local_err, -VAR_0, "flush failed"); } break; case NBD_CMD_TRIM: VAR_0 = blk_co_pdiscard(exp->blk, request.from + exp->dev_offset, request.len); if (VAR_0 < 0) { error_setg_errno(&local_err, -VAR_0, "discard failed"); } break; default: error_setg(&local_err, "invalid request type (%" PRIu32 ") received", request.type); VAR_0 = -EINVAL; } reply: if (local_err) { assert(VAR_0 < 0); VAR_3 = g_strdup(error_get_pretty(local_err)); error_report_err(local_err); local_err = NULL; } if (client->structured_reply && (VAR_0 < 0 || request.type == NBD_CMD_READ)) { if (VAR_0 < 0) { VAR_0 = nbd_co_send_structured_error(req->client, request.handle, -VAR_0, VAR_3, &local_err); } else { VAR_0 = nbd_co_send_structured_read(req->client, request.handle, request.from, req->data, VAR_2, &local_err); } } else { VAR_0 = nbd_co_send_simple_reply(req->client, request.handle, VAR_0 < 0 ? -VAR_0 : 0, req->data, VAR_2, &local_err); } g_free(VAR_3); if (VAR_0 < 0) { error_prepend(&local_err, "Failed to send reply: "); goto disconnect; } if (!req->complete) { error_setg(&local_err, "Request handling failed in intermediate state"); goto disconnect; } done: nbd_request_put(req); nbd_client_put(client); return; disconnect: if (local_err) { error_reportf_err(local_err, "Disconnect client, due to: "); } nbd_request_put(req); client_close(client, true); nbd_client_put(client); }
[ "static coroutine_fn void FUNC_0(void *opaque)\n{", "NBDClient *client = opaque;", "NBDExport *exp = client->exp;", "NBDRequestData *req;", "NBDRequest request = { 0 };", "int VAR_0;", "int VAR_1;", "int VAR_2 = 0;", "Error *local_err = NULL;", "char *VAR_3 = NULL;", "trace_nbd_trip();", "if (client->closing) {", "nbd_client_put(client);", "return;", "}", "req = nbd_request_get(client);", "VAR_0 = nbd_co_receive_request(req, &request, &local_err);", "client->recv_coroutine = NULL;", "nbd_client_receive_next_request(client);", "if (VAR_0 == -EIO) {", "goto disconnect;", "}", "if (VAR_0 < 0) {", "goto reply;", "}", "if (client->closing) {", "goto done;", "}", "switch (request.type) {", "case NBD_CMD_READ:\nif (request.VAR_1 & NBD_CMD_FLAG_FUA) {", "VAR_0 = blk_co_flush(exp->blk);", "if (VAR_0 < 0) {", "error_setg_errno(&local_err, -VAR_0, \"flush failed\");", "break;", "}", "}", "VAR_0 = blk_pread(exp->blk, request.from + exp->dev_offset,\nreq->data, request.len);", "if (VAR_0 < 0) {", "error_setg_errno(&local_err, -VAR_0, \"reading from file failed\");", "break;", "}", "VAR_2 = request.len;", "break;", "case NBD_CMD_WRITE:\nif (exp->nbdflags & NBD_FLAG_READ_ONLY) {", "error_setg(&local_err, \"Export is read-only\");", "VAR_0 = -EROFS;", "break;", "}", "VAR_1 = 0;", "if (request.VAR_1 & NBD_CMD_FLAG_FUA) {", "VAR_1 |= BDRV_REQ_FUA;", "}", "VAR_0 = blk_pwrite(exp->blk, request.from + exp->dev_offset,\nreq->data, request.len, VAR_1);", "if (VAR_0 < 0) {", "error_setg_errno(&local_err, -VAR_0, \"writing to file failed\");", "}", "break;", "case NBD_CMD_WRITE_ZEROES:\nif (exp->nbdflags & NBD_FLAG_READ_ONLY) {", "error_setg(&local_err, \"Export is read-only\");", "VAR_0 = -EROFS;", "break;", "}", "VAR_1 = 0;", "if (request.VAR_1 & NBD_CMD_FLAG_FUA) {", "VAR_1 |= BDRV_REQ_FUA;", "}", "if (!(request.VAR_1 & NBD_CMD_FLAG_NO_HOLE)) {", "VAR_1 |= BDRV_REQ_MAY_UNMAP;", "}", "VAR_0 = blk_pwrite_zeroes(exp->blk, request.from + exp->dev_offset,\nrequest.len, VAR_1);", "if (VAR_0 < 0) {", "error_setg_errno(&local_err, -VAR_0, \"writing to file failed\");", "}", "break;", "case NBD_CMD_DISC:\nabort();", "case NBD_CMD_FLUSH:\nVAR_0 = blk_co_flush(exp->blk);", "if (VAR_0 < 0) {", "error_setg_errno(&local_err, -VAR_0, \"flush failed\");", "}", "break;", "case NBD_CMD_TRIM:\nVAR_0 = blk_co_pdiscard(exp->blk, request.from + exp->dev_offset,\nrequest.len);", "if (VAR_0 < 0) {", "error_setg_errno(&local_err, -VAR_0, \"discard failed\");", "}", "break;", "default:\nerror_setg(&local_err, \"invalid request type (%\" PRIu32 \") received\",\nrequest.type);", "VAR_0 = -EINVAL;", "}", "reply:\nif (local_err) {", "assert(VAR_0 < 0);", "VAR_3 = g_strdup(error_get_pretty(local_err));", "error_report_err(local_err);", "local_err = NULL;", "}", "if (client->structured_reply &&\n(VAR_0 < 0 || request.type == NBD_CMD_READ)) {", "if (VAR_0 < 0) {", "VAR_0 = nbd_co_send_structured_error(req->client, request.handle,\n-VAR_0, VAR_3, &local_err);", "} else {", "VAR_0 = nbd_co_send_structured_read(req->client, request.handle,\nrequest.from, req->data,\nVAR_2, &local_err);", "}", "} else {", "VAR_0 = nbd_co_send_simple_reply(req->client, request.handle,\nVAR_0 < 0 ? -VAR_0 : 0,\nreq->data, VAR_2, &local_err);", "}", "g_free(VAR_3);", "if (VAR_0 < 0) {", "error_prepend(&local_err, \"Failed to send reply: \");", "goto disconnect;", "}", "if (!req->complete) {", "error_setg(&local_err, \"Request handling failed in intermediate state\");", "goto disconnect;", "}", "done:\nnbd_request_put(req);", "nbd_client_put(client);", "return;", "disconnect:\nif (local_err) {", "error_reportf_err(local_err, \"Disconnect client, due to: \");", "}", "nbd_request_put(req);", "client_close(client, true);", "nbd_client_put(client);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 71 ], [ 73 ], [ 77 ], [ 79, 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 99, 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 113 ], [ 117 ], [ 119, 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141, 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153 ], [ 155, 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183, 185 ], [ 187 ], [ 189 ], [ 191 ], [ 195 ], [ 197, 201 ], [ 205, 207 ], [ 209 ], [ 211 ], [ 213 ], [ 217 ], [ 219, 221, 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233 ], [ 235, 237, 239 ], [ 241 ], [ 243 ], [ 247, 249 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 267, 269 ], [ 271 ], [ 273, 275 ], [ 277 ], [ 279, 281, 283 ], [ 285 ], [ 287 ], [ 289, 291, 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 315 ], [ 317 ], [ 319 ], [ 321 ], [ 325, 327 ], [ 329 ], [ 331 ], [ 335, 337 ], [ 339 ], [ 341 ], [ 343 ], [ 345 ], [ 347 ], [ 349 ] ]
5,844
static void quantize_mantissas_blk_ch(AC3EncodeContext *s, int32_t *fixed_coef, int8_t exp_shift, uint8_t *exp, uint8_t *bap, uint16_t *qmant, int n) { int i; for (i = 0; i < n; i++) { int v; int c = fixed_coef[i]; int e = exp[i] - exp_shift; int b = bap[i]; switch (b) { case 0: v = 0; break; case 1: v = sym_quant(c, e, 3); switch (s->mant1_cnt) { case 0: s->qmant1_ptr = &qmant[i]; v = 9 * v; s->mant1_cnt = 1; break; case 1: *s->qmant1_ptr += 3 * v; s->mant1_cnt = 2; v = 128; break; default: *s->qmant1_ptr += v; s->mant1_cnt = 0; v = 128; break; } break; case 2: v = sym_quant(c, e, 5); switch (s->mant2_cnt) { case 0: s->qmant2_ptr = &qmant[i]; v = 25 * v; s->mant2_cnt = 1; break; case 1: *s->qmant2_ptr += 5 * v; s->mant2_cnt = 2; v = 128; break; default: *s->qmant2_ptr += v; s->mant2_cnt = 0; v = 128; break; } break; case 3: v = sym_quant(c, e, 7); break; case 4: v = sym_quant(c, e, 11); switch (s->mant4_cnt) { case 0: s->qmant4_ptr = &qmant[i]; v = 11 * v; s->mant4_cnt = 1; break; default: *s->qmant4_ptr += v; s->mant4_cnt = 0; v = 128; break; } break; case 5: v = sym_quant(c, e, 15); break; case 14: v = asym_quant(c, e, 14); break; case 15: v = asym_quant(c, e, 16); break; default: v = asym_quant(c, e, b - 1); break; } qmant[i] = v; } }
true
FFmpeg
323e6fead07c75f418e4b60704a4f437bb3483b2
static void quantize_mantissas_blk_ch(AC3EncodeContext *s, int32_t *fixed_coef, int8_t exp_shift, uint8_t *exp, uint8_t *bap, uint16_t *qmant, int n) { int i; for (i = 0; i < n; i++) { int v; int c = fixed_coef[i]; int e = exp[i] - exp_shift; int b = bap[i]; switch (b) { case 0: v = 0; break; case 1: v = sym_quant(c, e, 3); switch (s->mant1_cnt) { case 0: s->qmant1_ptr = &qmant[i]; v = 9 * v; s->mant1_cnt = 1; break; case 1: *s->qmant1_ptr += 3 * v; s->mant1_cnt = 2; v = 128; break; default: *s->qmant1_ptr += v; s->mant1_cnt = 0; v = 128; break; } break; case 2: v = sym_quant(c, e, 5); switch (s->mant2_cnt) { case 0: s->qmant2_ptr = &qmant[i]; v = 25 * v; s->mant2_cnt = 1; break; case 1: *s->qmant2_ptr += 5 * v; s->mant2_cnt = 2; v = 128; break; default: *s->qmant2_ptr += v; s->mant2_cnt = 0; v = 128; break; } break; case 3: v = sym_quant(c, e, 7); break; case 4: v = sym_quant(c, e, 11); switch (s->mant4_cnt) { case 0: s->qmant4_ptr = &qmant[i]; v = 11 * v; s->mant4_cnt = 1; break; default: *s->qmant4_ptr += v; s->mant4_cnt = 0; v = 128; break; } break; case 5: v = sym_quant(c, e, 15); break; case 14: v = asym_quant(c, e, 14); break; case 15: v = asym_quant(c, e, 16); break; default: v = asym_quant(c, e, b - 1); break; } qmant[i] = v; } }
{ "code": [ " int8_t exp_shift, uint8_t *exp,", " int e = exp[i] - exp_shift;" ], "line_no": [ 3, 19 ] }
static void FUNC_0(AC3EncodeContext *VAR_0, int32_t *VAR_1, int8_t VAR_2, uint8_t *VAR_3, uint8_t *VAR_4, uint16_t *VAR_5, int VAR_6) { int VAR_7; for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) { int VAR_8; int VAR_9 = VAR_1[VAR_7]; int VAR_10 = VAR_3[VAR_7] - VAR_2; int VAR_11 = VAR_4[VAR_7]; switch (VAR_11) { case 0: VAR_8 = 0; break; case 1: VAR_8 = sym_quant(VAR_9, VAR_10, 3); switch (VAR_0->mant1_cnt) { case 0: VAR_0->qmant1_ptr = &VAR_5[VAR_7]; VAR_8 = 9 * VAR_8; VAR_0->mant1_cnt = 1; break; case 1: *VAR_0->qmant1_ptr += 3 * VAR_8; VAR_0->mant1_cnt = 2; VAR_8 = 128; break; default: *VAR_0->qmant1_ptr += VAR_8; VAR_0->mant1_cnt = 0; VAR_8 = 128; break; } break; case 2: VAR_8 = sym_quant(VAR_9, VAR_10, 5); switch (VAR_0->mant2_cnt) { case 0: VAR_0->qmant2_ptr = &VAR_5[VAR_7]; VAR_8 = 25 * VAR_8; VAR_0->mant2_cnt = 1; break; case 1: *VAR_0->qmant2_ptr += 5 * VAR_8; VAR_0->mant2_cnt = 2; VAR_8 = 128; break; default: *VAR_0->qmant2_ptr += VAR_8; VAR_0->mant2_cnt = 0; VAR_8 = 128; break; } break; case 3: VAR_8 = sym_quant(VAR_9, VAR_10, 7); break; case 4: VAR_8 = sym_quant(VAR_9, VAR_10, 11); switch (VAR_0->mant4_cnt) { case 0: VAR_0->qmant4_ptr = &VAR_5[VAR_7]; VAR_8 = 11 * VAR_8; VAR_0->mant4_cnt = 1; break; default: *VAR_0->qmant4_ptr += VAR_8; VAR_0->mant4_cnt = 0; VAR_8 = 128; break; } break; case 5: VAR_8 = sym_quant(VAR_9, VAR_10, 15); break; case 14: VAR_8 = asym_quant(VAR_9, VAR_10, 14); break; case 15: VAR_8 = asym_quant(VAR_9, VAR_10, 16); break; default: VAR_8 = asym_quant(VAR_9, VAR_10, VAR_11 - 1); break; } VAR_5[VAR_7] = VAR_8; } }
[ "static void FUNC_0(AC3EncodeContext *VAR_0, int32_t *VAR_1,\nint8_t VAR_2, uint8_t *VAR_3,\nuint8_t *VAR_4, uint16_t *VAR_5, int VAR_6)\n{", "int VAR_7;", "for (VAR_7 = 0; VAR_7 < VAR_6; VAR_7++) {", "int VAR_8;", "int VAR_9 = VAR_1[VAR_7];", "int VAR_10 = VAR_3[VAR_7] - VAR_2;", "int VAR_11 = VAR_4[VAR_7];", "switch (VAR_11) {", "case 0:\nVAR_8 = 0;", "break;", "case 1:\nVAR_8 = sym_quant(VAR_9, VAR_10, 3);", "switch (VAR_0->mant1_cnt) {", "case 0:\nVAR_0->qmant1_ptr = &VAR_5[VAR_7];", "VAR_8 = 9 * VAR_8;", "VAR_0->mant1_cnt = 1;", "break;", "case 1:\n*VAR_0->qmant1_ptr += 3 * VAR_8;", "VAR_0->mant1_cnt = 2;", "VAR_8 = 128;", "break;", "default:\n*VAR_0->qmant1_ptr += VAR_8;", "VAR_0->mant1_cnt = 0;", "VAR_8 = 128;", "break;", "}", "break;", "case 2:\nVAR_8 = sym_quant(VAR_9, VAR_10, 5);", "switch (VAR_0->mant2_cnt) {", "case 0:\nVAR_0->qmant2_ptr = &VAR_5[VAR_7];", "VAR_8 = 25 * VAR_8;", "VAR_0->mant2_cnt = 1;", "break;", "case 1:\n*VAR_0->qmant2_ptr += 5 * VAR_8;", "VAR_0->mant2_cnt = 2;", "VAR_8 = 128;", "break;", "default:\n*VAR_0->qmant2_ptr += VAR_8;", "VAR_0->mant2_cnt = 0;", "VAR_8 = 128;", "break;", "}", "break;", "case 3:\nVAR_8 = sym_quant(VAR_9, VAR_10, 7);", "break;", "case 4:\nVAR_8 = sym_quant(VAR_9, VAR_10, 11);", "switch (VAR_0->mant4_cnt) {", "case 0:\nVAR_0->qmant4_ptr = &VAR_5[VAR_7];", "VAR_8 = 11 * VAR_8;", "VAR_0->mant4_cnt = 1;", "break;", "default:\n*VAR_0->qmant4_ptr += VAR_8;", "VAR_0->mant4_cnt = 0;", "VAR_8 = 128;", "break;", "}", "break;", "case 5:\nVAR_8 = sym_quant(VAR_9, VAR_10, 15);", "break;", "case 14:\nVAR_8 = asym_quant(VAR_9, VAR_10, 14);", "break;", "case 15:\nVAR_8 = asym_quant(VAR_9, VAR_10, 16);", "break;", "default:\nVAR_8 = asym_quant(VAR_9, VAR_10, VAR_11 - 1);", "break;", "}", "VAR_5[VAR_7] = VAR_8;", "}", "}" ]
[ 1, 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 ]
[ [ 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 ], [ 83 ], [ 85 ], [ 87, 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97, 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111, 113 ], [ 115 ], [ 117, 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133, 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147, 149 ], [ 151 ], [ 153, 155 ], [ 157 ], [ 159, 161 ], [ 163 ], [ 165, 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ] ]
5,848
static inline void tb_alloc_page(TranslationBlock *tb, unsigned int n, tb_page_addr_t page_addr) { PageDesc *p; #ifndef CONFIG_USER_ONLY bool page_already_protected; #endif assert_memory_lock(); tb->page_addr[n] = page_addr; p = page_find_alloc(page_addr >> TARGET_PAGE_BITS, 1); tb->page_next[n] = p->first_tb; #ifndef CONFIG_USER_ONLY page_already_protected = p->first_tb != NULL; #endif p->first_tb = (TranslationBlock *)((uintptr_t)tb | n); invalidate_page_bitmap(p); #if defined(CONFIG_USER_ONLY) if (p->flags & PAGE_WRITE) { target_ulong addr; PageDesc *p2; int prot; /* force the host page as non writable (writes will have a page fault + mprotect overhead) */ page_addr &= qemu_host_page_mask; prot = 0; for (addr = page_addr; addr < page_addr + qemu_host_page_size; addr += TARGET_PAGE_SIZE) { p2 = page_find(addr >> TARGET_PAGE_BITS); if (!p2) { continue; } prot |= p2->flags; p2->flags &= ~PAGE_WRITE; } mprotect(g2h(page_addr), qemu_host_page_size, (prot & PAGE_BITS) & ~PAGE_WRITE); #ifdef DEBUG_TB_INVALIDATE printf("protecting code page: 0x" TARGET_FMT_lx "\n", page_addr); #endif } #else /* if some code is already present, then the pages are already protected. So we handle the case where only the first TB is allocated in a physical page */ if (!page_already_protected) { tlb_protect_code(page_addr); } #endif }
true
qemu
67a5b5d2f6eb6d3b980570223ba5c478487ddb6f
static inline void tb_alloc_page(TranslationBlock *tb, unsigned int n, tb_page_addr_t page_addr) { PageDesc *p; #ifndef CONFIG_USER_ONLY bool page_already_protected; #endif assert_memory_lock(); tb->page_addr[n] = page_addr; p = page_find_alloc(page_addr >> TARGET_PAGE_BITS, 1); tb->page_next[n] = p->first_tb; #ifndef CONFIG_USER_ONLY page_already_protected = p->first_tb != NULL; #endif p->first_tb = (TranslationBlock *)((uintptr_t)tb | n); invalidate_page_bitmap(p); #if defined(CONFIG_USER_ONLY) if (p->flags & PAGE_WRITE) { target_ulong addr; PageDesc *p2; int prot; page_addr &= qemu_host_page_mask; prot = 0; for (addr = page_addr; addr < page_addr + qemu_host_page_size; addr += TARGET_PAGE_SIZE) { p2 = page_find(addr >> TARGET_PAGE_BITS); if (!p2) { continue; } prot |= p2->flags; p2->flags &= ~PAGE_WRITE; } mprotect(g2h(page_addr), qemu_host_page_size, (prot & PAGE_BITS) & ~PAGE_WRITE); #ifdef DEBUG_TB_INVALIDATE printf("protecting code page: 0x" TARGET_FMT_lx "\n", page_addr); #endif } #else if (!page_already_protected) { tlb_protect_code(page_addr); } #endif }
{ "code": [ " printf(\"protecting code page: 0x\" TARGET_FMT_lx \"\\n\",", " page_addr);" ], "line_no": [ 85, 87 ] }
static inline void FUNC_0(TranslationBlock *VAR_0, unsigned int VAR_1, tb_page_addr_t VAR_2) { PageDesc *p; #ifndef CONFIG_USER_ONLY bool page_already_protected; #endif assert_memory_lock(); VAR_0->VAR_2[VAR_1] = VAR_2; p = page_find_alloc(VAR_2 >> TARGET_PAGE_BITS, 1); VAR_0->page_next[VAR_1] = p->first_tb; #ifndef CONFIG_USER_ONLY page_already_protected = p->first_tb != NULL; #endif p->first_tb = (TranslationBlock *)((uintptr_t)VAR_0 | VAR_1); invalidate_page_bitmap(p); #if defined(CONFIG_USER_ONLY) if (p->flags & PAGE_WRITE) { target_ulong addr; PageDesc *p2; int prot; VAR_2 &= qemu_host_page_mask; prot = 0; for (addr = VAR_2; addr < VAR_2 + qemu_host_page_size; addr += TARGET_PAGE_SIZE) { p2 = page_find(addr >> TARGET_PAGE_BITS); if (!p2) { continue; } prot |= p2->flags; p2->flags &= ~PAGE_WRITE; } mprotect(g2h(VAR_2), qemu_host_page_size, (prot & PAGE_BITS) & ~PAGE_WRITE); #ifdef DEBUG_TB_INVALIDATE printf("protecting code page: 0x" TARGET_FMT_lx "\VAR_1", VAR_2); #endif } #else if (!page_already_protected) { tlb_protect_code(VAR_2); } #endif }
[ "static inline void FUNC_0(TranslationBlock *VAR_0,\nunsigned int VAR_1, tb_page_addr_t VAR_2)\n{", "PageDesc *p;", "#ifndef CONFIG_USER_ONLY\nbool page_already_protected;", "#endif\nassert_memory_lock();", "VAR_0->VAR_2[VAR_1] = VAR_2;", "p = page_find_alloc(VAR_2 >> TARGET_PAGE_BITS, 1);", "VAR_0->page_next[VAR_1] = p->first_tb;", "#ifndef CONFIG_USER_ONLY\npage_already_protected = p->first_tb != NULL;", "#endif\np->first_tb = (TranslationBlock *)((uintptr_t)VAR_0 | VAR_1);", "invalidate_page_bitmap(p);", "#if defined(CONFIG_USER_ONLY)\nif (p->flags & PAGE_WRITE) {", "target_ulong addr;", "PageDesc *p2;", "int prot;", "VAR_2 &= qemu_host_page_mask;", "prot = 0;", "for (addr = VAR_2; addr < VAR_2 + qemu_host_page_size;", "addr += TARGET_PAGE_SIZE) {", "p2 = page_find(addr >> TARGET_PAGE_BITS);", "if (!p2) {", "continue;", "}", "prot |= p2->flags;", "p2->flags &= ~PAGE_WRITE;", "}", "mprotect(g2h(VAR_2), qemu_host_page_size,\n(prot & PAGE_BITS) & ~PAGE_WRITE);", "#ifdef DEBUG_TB_INVALIDATE\nprintf(\"protecting code page: 0x\" TARGET_FMT_lx \"\\VAR_1\",\nVAR_2);", "#endif\n}", "#else\nif (!page_already_protected) {", "tlb_protect_code(VAR_2);", "}", "#endif\n}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9, 11 ], [ 13, 17 ], [ 21 ], [ 23 ], [ 25 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 39, 41 ], [ 43 ], [ 45 ], [ 47 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79, 81 ], [ 83, 85, 87 ], [ 89, 91 ], [ 93, 101 ], [ 103 ], [ 105 ], [ 107, 109 ] ]
5,849
void address_space_destroy(AddressSpace *as) { /* Flush out anything from MemoryListeners listening in on this */ memory_region_transaction_begin(); as->root = NULL; memory_region_transaction_commit(); QTAILQ_REMOVE(&address_spaces, as, address_spaces_link); address_space_destroy_dispatch(as); flatview_destroy(as->current_map); g_free(as->current_map); }
true
qemu
4c19eb721a5929f2277d33a98bb59963c58c2e3b
void address_space_destroy(AddressSpace *as) { memory_region_transaction_begin(); as->root = NULL; memory_region_transaction_commit(); QTAILQ_REMOVE(&address_spaces, as, address_spaces_link); address_space_destroy_dispatch(as); flatview_destroy(as->current_map); g_free(as->current_map); }
{ "code": [], "line_no": [] }
void FUNC_0(AddressSpace *VAR_0) { memory_region_transaction_begin(); VAR_0->root = NULL; memory_region_transaction_commit(); QTAILQ_REMOVE(&address_spaces, VAR_0, address_spaces_link); address_space_destroy_dispatch(VAR_0); flatview_destroy(VAR_0->current_map); g_free(VAR_0->current_map); }
[ "void FUNC_0(AddressSpace *VAR_0)\n{", "memory_region_transaction_begin();", "VAR_0->root = NULL;", "memory_region_transaction_commit();", "QTAILQ_REMOVE(&address_spaces, VAR_0, address_spaces_link);", "address_space_destroy_dispatch(VAR_0);", "flatview_destroy(VAR_0->current_map);", "g_free(VAR_0->current_map);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 22 ] ]
5,850
static void test_submit(void) { WorkerTestData data = { .n = 0 }; thread_pool_submit(pool, worker_cb, &data); qemu_aio_wait_all(); g_assert_cmpint(data.n, ==, 1); }
true
qemu
35ecde26018207fe723bec6efbd340db6e9c2d53
static void test_submit(void) { WorkerTestData data = { .n = 0 }; thread_pool_submit(pool, worker_cb, &data); qemu_aio_wait_all(); g_assert_cmpint(data.n, ==, 1); }
{ "code": [ " qemu_aio_wait_all();", " qemu_aio_wait_all();", " qemu_aio_wait_all();", " qemu_aio_wait_all();" ], "line_no": [ 9, 9, 9, 9 ] }
static void FUNC_0(void) { WorkerTestData data = { .n = 0 }; thread_pool_submit(pool, worker_cb, &data); qemu_aio_wait_all(); g_assert_cmpint(data.n, ==, 1); }
[ "static void FUNC_0(void)\n{", "WorkerTestData data = { .n = 0 };", "thread_pool_submit(pool, worker_cb, &data);", "qemu_aio_wait_all();", "g_assert_cmpint(data.n, ==, 1);", "}" ]
[ 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ] ]
5,851
static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, uint8_t *data_start, unsigned int data_size) { WebPContext *s = avctx->priv_data; AVPacket pkt; int ret; if (!s->initialized) { ff_vp8_decode_init(avctx); s->initialized = 1; if (s->has_alpha) avctx->pix_fmt = AV_PIX_FMT_YUVA420P; } s->lossless = 0; if (data_size > INT_MAX) { av_log(avctx, AV_LOG_ERROR, "unsupported chunk size\n"); return AVERROR_PATCHWELCOME; } av_init_packet(&pkt); pkt.data = data_start; pkt.size = data_size; ret = ff_vp8_decode_frame(avctx, p, got_frame, &pkt); if (s->has_alpha) { ret = vp8_lossy_decode_alpha(avctx, p, s->alpha_data, s->alpha_data_size); } }
true
FFmpeg
9bf4523e40148fdd27064ab570952bd8c4d1016e
static int vp8_lossy_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, uint8_t *data_start, unsigned int data_size) { WebPContext *s = avctx->priv_data; AVPacket pkt; int ret; if (!s->initialized) { ff_vp8_decode_init(avctx); s->initialized = 1; if (s->has_alpha) avctx->pix_fmt = AV_PIX_FMT_YUVA420P; } s->lossless = 0; if (data_size > INT_MAX) { av_log(avctx, AV_LOG_ERROR, "unsupported chunk size\n"); return AVERROR_PATCHWELCOME; } av_init_packet(&pkt); pkt.data = data_start; pkt.size = data_size; ret = ff_vp8_decode_frame(avctx, p, got_frame, &pkt); if (s->has_alpha) { ret = vp8_lossy_decode_alpha(avctx, p, s->alpha_data, s->alpha_data_size); } }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1, int *VAR_2, uint8_t *VAR_3, unsigned int VAR_4) { WebPContext *s = VAR_0->priv_data; AVPacket pkt; int VAR_5; if (!s->initialized) { ff_vp8_decode_init(VAR_0); s->initialized = 1; if (s->has_alpha) VAR_0->pix_fmt = AV_PIX_FMT_YUVA420P; } s->lossless = 0; if (VAR_4 > INT_MAX) { av_log(VAR_0, AV_LOG_ERROR, "unsupported chunk size\n"); return AVERROR_PATCHWELCOME; } av_init_packet(&pkt); pkt.data = VAR_3; pkt.size = VAR_4; VAR_5 = ff_vp8_decode_frame(VAR_0, VAR_1, VAR_2, &pkt); if (s->has_alpha) { VAR_5 = vp8_lossy_decode_alpha(VAR_0, VAR_1, s->alpha_data, s->alpha_data_size); } }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVFrame *VAR_1,\nint *VAR_2, uint8_t *VAR_3,\nunsigned int VAR_4)\n{", "WebPContext *s = VAR_0->priv_data;", "AVPacket pkt;", "int VAR_5;", "if (!s->initialized) {", "ff_vp8_decode_init(VAR_0);", "s->initialized = 1;", "if (s->has_alpha)\nVAR_0->pix_fmt = AV_PIX_FMT_YUVA420P;", "}", "s->lossless = 0;", "if (VAR_4 > INT_MAX) {", "av_log(VAR_0, AV_LOG_ERROR, \"unsupported chunk size\\n\");", "return AVERROR_PATCHWELCOME;", "}", "av_init_packet(&pkt);", "pkt.data = VAR_3;", "pkt.size = VAR_4;", "VAR_5 = ff_vp8_decode_frame(VAR_0, VAR_1, VAR_2, &pkt);", "if (s->has_alpha) {", "VAR_5 = vp8_lossy_decode_alpha(VAR_0, VAR_1, s->alpha_data,\ns->alpha_data_size);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 45 ], [ 47 ], [ 51 ], [ 55 ], [ 57, 59 ], [ 63 ], [ 66 ] ]
5,853
static void vfio_calxeda_xgmac_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VFIOCalxedaXgmacDeviceClass *vcxc = VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass); vcxc->parent_realize = dc->realize; dc->realize = calxeda_xgmac_realize; dc->desc = "VFIO Calxeda XGMAC"; dc->vmsd = &vfio_platform_calxeda_xgmac_vmstate; }
true
qemu
e4f4fb1eca795e36f363b4647724221e774523c1
static void vfio_calxeda_xgmac_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VFIOCalxedaXgmacDeviceClass *vcxc = VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass); vcxc->parent_realize = dc->realize; dc->realize = calxeda_xgmac_realize; dc->desc = "VFIO Calxeda XGMAC"; dc->vmsd = &vfio_platform_calxeda_xgmac_vmstate; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); VFIOCalxedaXgmacDeviceClass *vcxc = VFIO_CALXEDA_XGMAC_DEVICE_CLASS(VAR_0); vcxc->parent_realize = dc->realize; dc->realize = calxeda_xgmac_realize; dc->desc = "VFIO Calxeda XGMAC"; dc->vmsd = &vfio_platform_calxeda_xgmac_vmstate; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "VFIOCalxedaXgmacDeviceClass *vcxc =\nVFIO_CALXEDA_XGMAC_DEVICE_CLASS(VAR_0);", "vcxc->parent_realize = dc->realize;", "dc->realize = calxeda_xgmac_realize;", "dc->desc = \"VFIO Calxeda XGMAC\";", "dc->vmsd = &vfio_platform_calxeda_xgmac_vmstate;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21 ] ]
5,854
static void ppcuic_set_irq (void *opaque, int irq_num, int level) { ppcuic_t *uic; uint32_t mask, sr; uic = opaque; mask = 1 << (31-irq_num); LOG_UIC("%s: irq %d level %d uicsr %08" PRIx32 " mask %08" PRIx32 " => %08" PRIx32 " %08" PRIx32 "\n", __func__, irq_num, level, uic->uicsr, mask, uic->uicsr & mask, level << irq_num); if (irq_num < 0 || irq_num > 31) return; sr = uic->uicsr; /* Update status register */ if (uic->uictr & mask) { /* Edge sensitive interrupt */ if (level == 1) uic->uicsr |= mask; } else { /* Level sensitive interrupt */ if (level == 1) { uic->uicsr |= mask; uic->level |= mask; } else { uic->uicsr &= ~mask; uic->level &= ~mask; } } LOG_UIC("%s: irq %d level %d sr %" PRIx32 " => " "%08" PRIx32 "\n", __func__, irq_num, level, uic->uicsr, sr); if (sr != uic->uicsr) ppcuic_trigger_irq(uic); }
true
qemu
a1f7f97b950a46393b0e55a9a0082e70f540cbbd
static void ppcuic_set_irq (void *opaque, int irq_num, int level) { ppcuic_t *uic; uint32_t mask, sr; uic = opaque; mask = 1 << (31-irq_num); LOG_UIC("%s: irq %d level %d uicsr %08" PRIx32 " mask %08" PRIx32 " => %08" PRIx32 " %08" PRIx32 "\n", __func__, irq_num, level, uic->uicsr, mask, uic->uicsr & mask, level << irq_num); if (irq_num < 0 || irq_num > 31) return; sr = uic->uicsr; if (uic->uictr & mask) { if (level == 1) uic->uicsr |= mask; } else { if (level == 1) { uic->uicsr |= mask; uic->level |= mask; } else { uic->uicsr &= ~mask; uic->level &= ~mask; } } LOG_UIC("%s: irq %d level %d sr %" PRIx32 " => " "%08" PRIx32 "\n", __func__, irq_num, level, uic->uicsr, sr); if (sr != uic->uicsr) ppcuic_trigger_irq(uic); }
{ "code": [ " mask = 1 << (31-irq_num);" ], "line_no": [ 13 ] }
static void FUNC_0 (void *VAR_0, int VAR_1, int VAR_2) { ppcuic_t *uic; uint32_t mask, sr; uic = VAR_0; mask = 1 << (31-VAR_1); LOG_UIC("%s: irq %d VAR_2 %d uicsr %08" PRIx32 " mask %08" PRIx32 " => %08" PRIx32 " %08" PRIx32 "\n", __func__, VAR_1, VAR_2, uic->uicsr, mask, uic->uicsr & mask, VAR_2 << VAR_1); if (VAR_1 < 0 || VAR_1 > 31) return; sr = uic->uicsr; if (uic->uictr & mask) { if (VAR_2 == 1) uic->uicsr |= mask; } else { if (VAR_2 == 1) { uic->uicsr |= mask; uic->VAR_2 |= mask; } else { uic->uicsr &= ~mask; uic->VAR_2 &= ~mask; } } LOG_UIC("%s: irq %d VAR_2 %d sr %" PRIx32 " => " "%08" PRIx32 "\n", __func__, VAR_1, VAR_2, uic->uicsr, sr); if (sr != uic->uicsr) ppcuic_trigger_irq(uic); }
[ "static void FUNC_0 (void *VAR_0, int VAR_1, int VAR_2)\n{", "ppcuic_t *uic;", "uint32_t mask, sr;", "uic = VAR_0;", "mask = 1 << (31-VAR_1);", "LOG_UIC(\"%s: irq %d VAR_2 %d uicsr %08\" PRIx32\n\" mask %08\" PRIx32 \" => %08\" PRIx32 \" %08\" PRIx32 \"\\n\",\n__func__, VAR_1, VAR_2,\nuic->uicsr, mask, uic->uicsr & mask, VAR_2 << VAR_1);", "if (VAR_1 < 0 || VAR_1 > 31)\nreturn;", "sr = uic->uicsr;", "if (uic->uictr & mask) {", "if (VAR_2 == 1)\nuic->uicsr |= mask;", "} else {", "if (VAR_2 == 1) {", "uic->uicsr |= mask;", "uic->VAR_2 |= mask;", "} else {", "uic->uicsr &= ~mask;", "uic->VAR_2 &= ~mask;", "}", "}", "LOG_UIC(\"%s: irq %d VAR_2 %d sr %\" PRIx32 \" => \"\n\"%08\" PRIx32 \"\\n\", __func__, VAR_1, VAR_2, uic->uicsr, sr);", "if (sr != uic->uicsr)\nppcuic_trigger_irq(uic);", "}" ]
[ 0, 0, 0, 0, 1, 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 ], [ 37, 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65, 67 ], [ 69 ] ]
5,856
static int avi_sync(AVFormatContext *s, int exit_early) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; int n; unsigned int d[8]; unsigned int size; int64_t i, sync; start_sync: memset(d, -1, sizeof(d)); for(i=sync=avio_tell(pb); !url_feof(pb); i++) { int j; for(j=0; j<7; j++) d[j]= d[j+1]; d[7]= avio_r8(pb); size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24); n= get_stream_idx(d+2); //av_log(s, AV_LOG_DEBUG, "%X %X %X %X %X %X %X %X %"PRId64" %d %d\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n); if(i + (uint64_t)size > avi->fsize || d[0] > 127) //parse ix## if( (d[0] == 'i' && d[1] == 'x' && n < s->nb_streams) //parse JUNK ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ avio_skip(pb, size); //av_log(s, AV_LOG_DEBUG, "SKIP\n"); goto start_sync; //parse stray LIST if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){ avio_skip(pb, 4); goto start_sync; n= get_stream_idx(d); if(!((i-avi->last_pkt_pos)&1) && get_stream_idx(d+1) < s->nb_streams) //detect ##ix chunk and skip if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){ avio_skip(pb, size); goto start_sync; //parse ##dc/##wb if(n < s->nb_streams){ AVStream *st; AVIStream *ast; st = s->streams[n]; ast = st->priv_data; if(s->nb_streams>=2){ AVStream *st1 = s->streams[1]; AVIStream *ast1= st1->priv_data; //workaround for broken small-file-bug402.avi if( d[2] == 'w' && d[3] == 'b' && n==0 && st ->codec->codec_type == AVMEDIA_TYPE_VIDEO && st1->codec->codec_type == AVMEDIA_TYPE_AUDIO && ast->prefix == 'd'*256+'c' && (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count) ){ n=1; st = st1; ast = ast1; av_log(s, AV_LOG_WARNING, "Invalid stream + prefix combination, assuming audio.\n"); if( (st->discard >= AVDISCARD_DEFAULT && size==0) /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering || st->discard >= AVDISCARD_ALL){ if (!exit_early) { ast->frame_offset += get_duration(ast, size); avio_skip(pb, size); goto start_sync; if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) { int k = avio_r8(pb); int last = (k + avio_r8(pb) - 1) & 0xFF; avio_rl16(pb); //flags for (; k <= last; k++) ast->pal[k] = 0xFF<<24 | avio_rb32(pb)>>8;// b + (g << 8) + (r << 16); ast->has_pal= 1; goto start_sync; } else if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) || d[2]*256+d[3] == ast->prefix /*|| (d[2] == 'd' && d[3] == 'c') || (d[2] == 'w' && d[3] == 'b')*/) { if (exit_early) return 0; //av_log(s, AV_LOG_DEBUG, "OK\n"); if(d[2]*256+d[3] == ast->prefix) ast->prefix_count++; else{ ast->prefix= d[2]*256+d[3]; ast->prefix_count= 0; avi->stream_index= n; ast->packet_size= size + 8; ast->remaining= size; if(size || !ast->sample_size){ uint64_t pos= avio_tell(pb) - 8; if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){ av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME); return 0; if(pb->error) return pb->error; return AVERROR_EOF;
true
FFmpeg
096231d497457be9496b0be01ff6da2093186c3c
static int avi_sync(AVFormatContext *s, int exit_early) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; int n; unsigned int d[8]; unsigned int size; int64_t i, sync; start_sync: memset(d, -1, sizeof(d)); for(i=sync=avio_tell(pb); !url_feof(pb); i++) { int j; for(j=0; j<7; j++) d[j]= d[j+1]; d[7]= avio_r8(pb); size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24); n= get_stream_idx(d+2); if(i + (uint64_t)size > avi->fsize || d[0] > 127) if( (d[0] == 'i' && d[1] == 'x' && n < s->nb_streams) ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ avio_skip(pb, size); goto start_sync; if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){ avio_skip(pb, 4); goto start_sync; n= get_stream_idx(d); if(!((i-avi->last_pkt_pos)&1) && get_stream_idx(d+1) < s->nb_streams) if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){ avio_skip(pb, size); goto start_sync; if(n < s->nb_streams){ AVStream *st; AVIStream *ast; st = s->streams[n]; ast = st->priv_data; if(s->nb_streams>=2){ AVStream *st1 = s->streams[1]; AVIStream *ast1= st1->priv_data; if( d[2] == 'w' && d[3] == 'b' && n==0 && st ->codec->codec_type == AVMEDIA_TYPE_VIDEO && st1->codec->codec_type == AVMEDIA_TYPE_AUDIO && ast->prefix == 'd'*256+'c' && (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count) ){ n=1; st = st1; ast = ast1; av_log(s, AV_LOG_WARNING, "Invalid stream + prefix combination, assuming audio.\n"); if( (st->discard >= AVDISCARD_DEFAULT && size==0) || st->discard >= AVDISCARD_ALL){ if (!exit_early) { ast->frame_offset += get_duration(ast, size); avio_skip(pb, size); goto start_sync; if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) { int k = avio_r8(pb); int last = (k + avio_r8(pb) - 1) & 0xFF; avio_rl16(pb); for (; k <= last; k++) ast->pal[k] = 0xFF<<24 | avio_rb32(pb)>>8; ast->has_pal= 1; goto start_sync; } else if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) || d[2]*256+d[3] == ast->prefix ) { if (exit_early) return 0; if(d[2]*256+d[3] == ast->prefix) ast->prefix_count++; else{ ast->prefix= d[2]*256+d[3]; ast->prefix_count= 0; avi->stream_index= n; ast->packet_size= size + 8; ast->remaining= size; if(size || !ast->sample_size){ uint64_t pos= avio_tell(pb) - 8; if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){ av_add_index_entry(st, pos, ast->frame_offset, size, 0, AVINDEX_KEYFRAME); return 0; if(pb->error) return pb->error; return AVERROR_EOF;
{ "code": [], "line_no": [] }
static int FUNC_0(AVFormatContext *VAR_0, int VAR_1) { AVIContext *avi = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; int VAR_2; unsigned int VAR_3[8]; unsigned int VAR_4; int64_t i, sync; start_sync: memset(VAR_3, -1, sizeof(VAR_3)); for(i=sync=avio_tell(pb); !url_feof(pb); i++) { int j; for(j=0; j<7; j++) VAR_3[j]= VAR_3[j+1]; VAR_3[7]= avio_r8(pb); VAR_4= VAR_3[4] + (VAR_3[5]<<8) + (VAR_3[6]<<16) + (VAR_3[7]<<24); VAR_2= get_stream_idx(VAR_3+2); if(i + (uint64_t)VAR_4 > avi->fsize || VAR_3[0] > 127) if( (VAR_3[0] == 'i' && VAR_3[1] == 'x' && VAR_2 < VAR_0->nb_streams) ||(VAR_3[0] == 'J' && VAR_3[1] == 'U' && VAR_3[2] == 'N' && VAR_3[3] == 'K') ||(VAR_3[0] == 'i' && VAR_3[1] == 'VAR_3' && VAR_3[2] == 'x' && VAR_3[3] == '1')){ avio_skip(pb, VAR_4); goto start_sync; if(VAR_3[0] == 'L' && VAR_3[1] == 'I' && VAR_3[2] == 'S' && VAR_3[3] == 'T'){ avio_skip(pb, 4); goto start_sync; VAR_2= get_stream_idx(VAR_3); if(!((i-avi->last_pkt_pos)&1) && get_stream_idx(VAR_3+1) < VAR_0->nb_streams) if(VAR_3[2] == 'i' && VAR_3[3] == 'x' && VAR_2 < VAR_0->nb_streams){ avio_skip(pb, VAR_4); goto start_sync; if(VAR_2 < VAR_0->nb_streams){ AVStream *st; AVIStream *ast; st = VAR_0->streams[VAR_2]; ast = st->priv_data; if(VAR_0->nb_streams>=2){ AVStream *st1 = VAR_0->streams[1]; AVIStream *ast1= st1->priv_data; if( VAR_3[2] == 'w' && VAR_3[3] == 'b' && VAR_2==0 && st ->codec->codec_type == AVMEDIA_TYPE_VIDEO && st1->codec->codec_type == AVMEDIA_TYPE_AUDIO && ast->prefix == 'VAR_3'*256+'c' && (VAR_3[2]*256+VAR_3[3] == ast1->prefix || !ast1->prefix_count) ){ VAR_2=1; st = st1; ast = ast1; av_log(VAR_0, AV_LOG_WARNING, "Invalid stream + prefix combination, assuming audio.\VAR_2"); if( (st->discard >= AVDISCARD_DEFAULT && VAR_4==0) || st->discard >= AVDISCARD_ALL){ if (!VAR_1) { ast->frame_offset += get_duration(ast, VAR_4); avio_skip(pb, VAR_4); goto start_sync; if (VAR_3[2] == 'p' && VAR_3[3] == 'c' && VAR_4<=4*256+4) { int k = avio_r8(pb); int last = (k + avio_r8(pb) - 1) & 0xFF; avio_rl16(pb); for (; k <= last; k++) ast->pal[k] = 0xFF<<24 | avio_rb32(pb)>>8; ast->has_pal= 1; goto start_sync; } else if( ((ast->prefix_count<5 || sync+9 > i) && VAR_3[2]<128 && VAR_3[3]<128) || VAR_3[2]*256+VAR_3[3] == ast->prefix ) { if (VAR_1) return 0; if(VAR_3[2]*256+VAR_3[3] == ast->prefix) ast->prefix_count++; else{ ast->prefix= VAR_3[2]*256+VAR_3[3]; ast->prefix_count= 0; avi->stream_index= VAR_2; ast->packet_size= VAR_4 + 8; ast->remaining= VAR_4; if(VAR_4 || !ast->sample_size){ uint64_t pos= avio_tell(pb) - 8; if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){ av_add_index_entry(st, pos, ast->frame_offset, VAR_4, 0, AVINDEX_KEYFRAME); return 0; if(pb->error) return pb->error; return AVERROR_EOF;
[ "static int FUNC_0(AVFormatContext *VAR_0, int VAR_1)\n{", "AVIContext *avi = VAR_0->priv_data;", "AVIOContext *pb = VAR_0->pb;", "int VAR_2;", "unsigned int VAR_3[8];", "unsigned int VAR_4;", "int64_t i, sync;", "start_sync:\nmemset(VAR_3, -1, sizeof(VAR_3));", "for(i=sync=avio_tell(pb); !url_feof(pb); i++) {", "int j;", "for(j=0; j<7; j++)", "VAR_3[j]= VAR_3[j+1];", "VAR_3[7]= avio_r8(pb);", "VAR_4= VAR_3[4] + (VAR_3[5]<<8) + (VAR_3[6]<<16) + (VAR_3[7]<<24);", "VAR_2= get_stream_idx(VAR_3+2);", "if(i + (uint64_t)VAR_4 > avi->fsize || VAR_3[0] > 127)\nif( (VAR_3[0] == 'i' && VAR_3[1] == 'x' && VAR_2 < VAR_0->nb_streams)\n||(VAR_3[0] == 'J' && VAR_3[1] == 'U' && VAR_3[2] == 'N' && VAR_3[3] == 'K')\n||(VAR_3[0] == 'i' && VAR_3[1] == 'VAR_3' && VAR_3[2] == 'x' && VAR_3[3] == '1')){", "avio_skip(pb, VAR_4);", "goto start_sync;", "if(VAR_3[0] == 'L' && VAR_3[1] == 'I' && VAR_3[2] == 'S' && VAR_3[3] == 'T'){", "avio_skip(pb, 4);", "goto start_sync;", "VAR_2= get_stream_idx(VAR_3);", "if(!((i-avi->last_pkt_pos)&1) && get_stream_idx(VAR_3+1) < VAR_0->nb_streams)\nif(VAR_3[2] == 'i' && VAR_3[3] == 'x' && VAR_2 < VAR_0->nb_streams){", "avio_skip(pb, VAR_4);", "goto start_sync;", "if(VAR_2 < VAR_0->nb_streams){", "AVStream *st;", "AVIStream *ast;", "st = VAR_0->streams[VAR_2];", "ast = st->priv_data;", "if(VAR_0->nb_streams>=2){", "AVStream *st1 = VAR_0->streams[1];", "AVIStream *ast1= st1->priv_data;", "if( VAR_3[2] == 'w' && VAR_3[3] == 'b'\n&& VAR_2==0\n&& st ->codec->codec_type == AVMEDIA_TYPE_VIDEO\n&& st1->codec->codec_type == AVMEDIA_TYPE_AUDIO\n&& ast->prefix == 'VAR_3'*256+'c'\n&& (VAR_3[2]*256+VAR_3[3] == ast1->prefix || !ast1->prefix_count)\n){", "VAR_2=1;", "st = st1;", "ast = ast1;", "av_log(VAR_0, AV_LOG_WARNING, \"Invalid stream + prefix combination, assuming audio.\\VAR_2\");", "if( (st->discard >= AVDISCARD_DEFAULT && VAR_4==0)\n|| st->discard >= AVDISCARD_ALL){", "if (!VAR_1) {", "ast->frame_offset += get_duration(ast, VAR_4);", "avio_skip(pb, VAR_4);", "goto start_sync;", "if (VAR_3[2] == 'p' && VAR_3[3] == 'c' && VAR_4<=4*256+4) {", "int k = avio_r8(pb);", "int last = (k + avio_r8(pb) - 1) & 0xFF;", "avio_rl16(pb);", "for (; k <= last; k++)", "ast->pal[k] = 0xFF<<24 | avio_rb32(pb)>>8;", "ast->has_pal= 1;", "goto start_sync;", "} else if( ((ast->prefix_count<5 || sync+9 > i) && VAR_3[2]<128 && VAR_3[3]<128) ||", "VAR_3[2]*256+VAR_3[3] == ast->prefix\n) {", "if (VAR_1)\nreturn 0;", "if(VAR_3[2]*256+VAR_3[3] == ast->prefix)\nast->prefix_count++;", "else{", "ast->prefix= VAR_3[2]*256+VAR_3[3];", "ast->prefix_count= 0;", "avi->stream_index= VAR_2;", "ast->packet_size= VAR_4 + 8;", "ast->remaining= VAR_4;", "if(VAR_4 || !ast->sample_size){", "uint64_t pos= avio_tell(pb) - 8;", "if(!st->index_entries || !st->nb_index_entries || st->index_entries[st->nb_index_entries - 1].pos < pos){", "av_add_index_entry(st, pos, ast->frame_offset, VAR_4, 0, AVINDEX_KEYFRAME);", "return 0;", "if(pb->error)\nreturn pb->error;", "return AVERROR_EOF;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 19, 21, 23, 24 ], [ 25 ], [ 27 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33, 35 ], [ 36 ], [ 37 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46 ], [ 48, 49, 50, 51, 52, 53, 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59, 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70 ], [ 71 ], [ 72 ], [ 73 ], [ 74 ], [ 75, 77 ], [ 78, 79 ], [ 81, 82 ], [ 83 ], [ 84 ], [ 85 ], [ 86 ], [ 87 ], [ 88 ], [ 89 ], [ 90 ], [ 91 ], [ 92 ], [ 93 ], [ 94, 95 ], [ 96 ] ]
5,857
static void ide_atapi_cmd(IDEState *s) { const uint8_t *packet; uint8_t *buf; int max_len; packet = s->io_buffer; buf = s->io_buffer; #ifdef DEBUG_IDE_ATAPI { int i; printf("ATAPI limit=0x%x packet:", s->lcyl | (s->hcyl << 8)); for(i = 0; i < ATAPI_PACKET_SIZE; i++) { printf(" %02x", packet[i]); printf("\n"); #endif /* If there's a UNIT_ATTENTION condition pending, only REQUEST_SENSE and INQUIRY commands are allowed to complete. */ if (s->sense_key == SENSE_UNIT_ATTENTION && s->io_buffer[0] != GPCMD_REQUEST_SENSE && s->io_buffer[0] != GPCMD_INQUIRY) { ide_atapi_cmd_check_status(s); return; switch(s->io_buffer[0]) { case GPCMD_TEST_UNIT_READY: if (bdrv_is_inserted(s->bs) && !s->cdrom_changed) { ide_atapi_cmd_ok(s); } else { s->cdrom_changed = 0; ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); case GPCMD_MODE_SENSE_6: case GPCMD_MODE_SENSE_10: { int action, code; if (packet[0] == GPCMD_MODE_SENSE_10) else max_len = packet[4]; action = packet[2] >> 6; code = packet[2] & 0x3f; switch(action) { case 0: /* current values */ switch(code) { case GPMODE_R_W_ERROR_PAGE: /* error recovery */ cpu_to_ube16(&buf[0], 16 + 6); buf[2] = 0x70; buf[3] = 0; buf[4] = 0; buf[5] = 0; buf[6] = 0; buf[7] = 0; buf[8] = 0x01; buf[9] = 0x06; buf[10] = 0x00; buf[11] = 0x05; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; ide_atapi_cmd_reply(s, 16, max_len); case GPMODE_AUDIO_CTL_PAGE: cpu_to_ube16(&buf[0], 24 + 6); buf[2] = 0x70; buf[3] = 0; buf[4] = 0; buf[5] = 0; buf[6] = 0; buf[7] = 0; /* Fill with CDROM audio volume */ buf[17] = 0; buf[19] = 0; buf[21] = 0; buf[23] = 0; ide_atapi_cmd_reply(s, 24, max_len); case GPMODE_CAPABILITIES_PAGE: cpu_to_ube16(&buf[0], 28 + 6); buf[2] = 0x70; buf[3] = 0; buf[4] = 0; buf[5] = 0; buf[6] = 0; buf[7] = 0; buf[8] = 0x2a; buf[9] = 0x12; buf[10] = 0x00; buf[11] = 0x00; /* Claim PLAY_AUDIO capability (0x01) since some Linux code checks for this to automount media. */ buf[12] = 0x71; buf[13] = 3 << 5; buf[14] = (1 << 0) | (1 << 3) | (1 << 5); if (bdrv_is_locked(s->bs)) buf[6] |= 1 << 1; buf[15] = 0x00; cpu_to_ube16(&buf[16], 706); buf[18] = 0; buf[19] = 2; cpu_to_ube16(&buf[20], 512); cpu_to_ube16(&buf[22], 706); buf[24] = 0; buf[25] = 0; buf[26] = 0; buf[27] = 0; ide_atapi_cmd_reply(s, 28, max_len); default: goto error_cmd; case 1: /* changeable values */ goto error_cmd; case 2: /* default values */ goto error_cmd; default: case 3: /* saved values */ ASC_SAVING_PARAMETERS_NOT_SUPPORTED); case GPCMD_REQUEST_SENSE: max_len = packet[4]; memset(buf, 0, 18); buf[0] = 0x70 | (1 << 7); buf[2] = s->sense_key; buf[7] = 10; buf[12] = s->asc; if (s->sense_key == SENSE_UNIT_ATTENTION) s->sense_key = SENSE_NONE; ide_atapi_cmd_reply(s, 18, max_len); case GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL: if (bdrv_is_inserted(s->bs)) { bdrv_set_locked(s->bs, packet[4] & 1); ide_atapi_cmd_ok(s); } else { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); case GPCMD_READ_10: case GPCMD_READ_12: { int nb_sectors, lba; if (packet[0] == GPCMD_READ_10) nb_sectors = ube16_to_cpu(packet + 7); else nb_sectors = ube32_to_cpu(packet + 6); lba = ube32_to_cpu(packet + 2); if (nb_sectors == 0) { ide_atapi_cmd_ok(s); ide_atapi_cmd_read(s, lba, nb_sectors, 2048); case GPCMD_READ_CD: { int nb_sectors, lba, transfer_request; nb_sectors = (packet[6] << 16) | (packet[7] << 8) | packet[8]; lba = ube32_to_cpu(packet + 2); if (nb_sectors == 0) { ide_atapi_cmd_ok(s); transfer_request = packet[9]; switch(transfer_request & 0xf8) { case 0x00: /* nothing */ ide_atapi_cmd_ok(s); case 0x10: /* normal read */ ide_atapi_cmd_read(s, lba, nb_sectors, 2048); case 0xf8: /* read all data */ ide_atapi_cmd_read(s, lba, nb_sectors, 2352); default: case GPCMD_SEEK: { unsigned int lba; uint64_t total_sectors; bdrv_get_geometry(s->bs, &total_sectors); total_sectors >>= 2; if (total_sectors == 0) { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); lba = ube32_to_cpu(packet + 2); if (lba >= total_sectors) { ASC_LOGICAL_BLOCK_OOR); ide_atapi_cmd_ok(s); case GPCMD_START_STOP_UNIT: { int start, eject, err = 0; start = packet[4] & 1; eject = (packet[4] >> 1) & 1; if (eject) { err = bdrv_eject(s->bs, !start); switch (err) { case 0: ide_atapi_cmd_ok(s); case -EBUSY: ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIA_REMOVAL_PREVENTED); default: ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); case GPCMD_MECHANISM_STATUS: { max_len = ube16_to_cpu(packet + 8); cpu_to_ube16(buf, 0); /* no current LBA */ buf[2] = 0; buf[3] = 0; buf[4] = 0; buf[5] = 1; cpu_to_ube16(buf + 6, 0); ide_atapi_cmd_reply(s, 8, max_len); case GPCMD_READ_TOC_PMA_ATIP: { int format, msf, start_track, len; uint64_t total_sectors; bdrv_get_geometry(s->bs, &total_sectors); total_sectors >>= 2; if (total_sectors == 0) { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); format = packet[9] >> 6; msf = (packet[1] >> 1) & 1; start_track = packet[6]; switch(format) { case 0: len = cdrom_read_toc(total_sectors, buf, msf, start_track); if (len < 0) goto error_cmd; ide_atapi_cmd_reply(s, len, max_len); case 1: /* multi session : only a single session defined */ memset(buf, 0, 12); buf[1] = 0x0a; buf[2] = 0x01; buf[3] = 0x01; ide_atapi_cmd_reply(s, 12, max_len); case 2: len = cdrom_read_toc_raw(total_sectors, buf, msf, start_track); if (len < 0) goto error_cmd; ide_atapi_cmd_reply(s, len, max_len); default: error_cmd: case GPCMD_READ_CDVD_CAPACITY: { uint64_t total_sectors; bdrv_get_geometry(s->bs, &total_sectors); total_sectors >>= 2; if (total_sectors == 0) { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); /* NOTE: it is really the number of sectors minus 1 */ cpu_to_ube32(buf, total_sectors - 1); cpu_to_ube32(buf + 4, 2048); ide_atapi_cmd_reply(s, 8, 8); case GPCMD_READ_DVD_STRUCTURE: { int media = packet[1]; int format = packet[7]; int ret; max_len = ube16_to_cpu(packet + 8); if (format < 0xff) { if (media_is_cd(s)) { ASC_INCOMPATIBLE_FORMAT); } else if (!media_present(s)) { memset(buf, 0, max_len > IDE_DMA_BUF_SECTORS * 512 + 4 ? IDE_DMA_BUF_SECTORS * 512 + 4 : max_len); switch (format) { case 0x00 ... 0x7f: case 0xff: if (media == 0) { ret = ide_dvd_read_structure(s, format, packet, buf); if (ret < 0) ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, -ret); else ide_atapi_cmd_reply(s, ret, max_len); /* TODO: BD support, fall through for now */ /* Generic disk structures */ case 0x80: /* TODO: AACS volume identifier */ case 0x81: /* TODO: AACS media serial number */ case 0x82: /* TODO: AACS media identifier */ case 0x83: /* TODO: AACS media key block */ case 0x90: /* TODO: List of recognized format layers */ case 0xc0: /* TODO: Write protection status */ default: case GPCMD_SET_SPEED: ide_atapi_cmd_ok(s); case GPCMD_INQUIRY: max_len = packet[4]; buf[0] = 0x05; /* CD-ROM */ buf[1] = 0x80; /* removable */ buf[2] = 0x00; /* ISO */ buf[3] = 0x21; /* ATAPI-2 (XXX: put ATAPI-4 ?) */ buf[4] = 31; /* additional length */ buf[5] = 0; /* reserved */ buf[6] = 0; /* reserved */ buf[7] = 0; /* reserved */ padstr8(buf + 8, 8, "QEMU"); padstr8(buf + 16, 16, "QEMU DVD-ROM"); padstr8(buf + 32, 4, s->version); ide_atapi_cmd_reply(s, 36, max_len); case GPCMD_GET_CONFIGURATION: { uint32_t len; uint8_t index = 0; /* only feature 0 is supported */ if (packet[2] != 0 || packet[3] != 0) { /* XXX: could result in alignment problems in some architectures */ /* * XXX: avoid overflow for io_buffer if max_len is bigger than * the size of that buffer (dimensioned to max number of * sectors to transfer at once) * * Only a problem if the feature/profiles grow. */ if (max_len > 512) /* XXX: assume 1 sector */ max_len = 512; memset(buf, 0, max_len); /* * the number of sectors from the media tells us which profile * to use as current. 0 means there is no media */ if (media_is_dvd(s)) cpu_to_ube16(buf + 6, MMC_PROFILE_DVD_ROM); else if (media_is_cd(s)) cpu_to_ube16(buf + 6, MMC_PROFILE_CD_ROM); buf[10] = 0x02 | 0x01; /* persistent and current */ len = 12; /* headers: 8 + 4 */ len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_DVD_ROM); len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_CD_ROM); cpu_to_ube32(buf, len - 4); /* data length */ ide_atapi_cmd_reply(s, len, max_len); default: ASC_ILLEGAL_OPCODE);
true
qemu
253cb7b9909806b83d73269afb9cf0ab3fa2ce2c
static void ide_atapi_cmd(IDEState *s) { const uint8_t *packet; uint8_t *buf; int max_len; packet = s->io_buffer; buf = s->io_buffer; #ifdef DEBUG_IDE_ATAPI { int i; printf("ATAPI limit=0x%x packet:", s->lcyl | (s->hcyl << 8)); for(i = 0; i < ATAPI_PACKET_SIZE; i++) { printf(" %02x", packet[i]); printf("\n"); #endif if (s->sense_key == SENSE_UNIT_ATTENTION && s->io_buffer[0] != GPCMD_REQUEST_SENSE && s->io_buffer[0] != GPCMD_INQUIRY) { ide_atapi_cmd_check_status(s); return; switch(s->io_buffer[0]) { case GPCMD_TEST_UNIT_READY: if (bdrv_is_inserted(s->bs) && !s->cdrom_changed) { ide_atapi_cmd_ok(s); } else { s->cdrom_changed = 0; ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); case GPCMD_MODE_SENSE_6: case GPCMD_MODE_SENSE_10: { int action, code; if (packet[0] == GPCMD_MODE_SENSE_10) else max_len = packet[4]; action = packet[2] >> 6; code = packet[2] & 0x3f; switch(action) { case 0: switch(code) { case GPMODE_R_W_ERROR_PAGE: cpu_to_ube16(&buf[0], 16 + 6); buf[2] = 0x70; buf[3] = 0; buf[4] = 0; buf[5] = 0; buf[6] = 0; buf[7] = 0; buf[8] = 0x01; buf[9] = 0x06; buf[10] = 0x00; buf[11] = 0x05; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; ide_atapi_cmd_reply(s, 16, max_len); case GPMODE_AUDIO_CTL_PAGE: cpu_to_ube16(&buf[0], 24 + 6); buf[2] = 0x70; buf[3] = 0; buf[4] = 0; buf[5] = 0; buf[6] = 0; buf[7] = 0; buf[17] = 0; buf[19] = 0; buf[21] = 0; buf[23] = 0; ide_atapi_cmd_reply(s, 24, max_len); case GPMODE_CAPABILITIES_PAGE: cpu_to_ube16(&buf[0], 28 + 6); buf[2] = 0x70; buf[3] = 0; buf[4] = 0; buf[5] = 0; buf[6] = 0; buf[7] = 0; buf[8] = 0x2a; buf[9] = 0x12; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x71; buf[13] = 3 << 5; buf[14] = (1 << 0) | (1 << 3) | (1 << 5); if (bdrv_is_locked(s->bs)) buf[6] |= 1 << 1; buf[15] = 0x00; cpu_to_ube16(&buf[16], 706); buf[18] = 0; buf[19] = 2; cpu_to_ube16(&buf[20], 512); cpu_to_ube16(&buf[22], 706); buf[24] = 0; buf[25] = 0; buf[26] = 0; buf[27] = 0; ide_atapi_cmd_reply(s, 28, max_len); default: goto error_cmd; case 1: goto error_cmd; case 2: goto error_cmd; default: case 3: ASC_SAVING_PARAMETERS_NOT_SUPPORTED); case GPCMD_REQUEST_SENSE: max_len = packet[4]; memset(buf, 0, 18); buf[0] = 0x70 | (1 << 7); buf[2] = s->sense_key; buf[7] = 10; buf[12] = s->asc; if (s->sense_key == SENSE_UNIT_ATTENTION) s->sense_key = SENSE_NONE; ide_atapi_cmd_reply(s, 18, max_len); case GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL: if (bdrv_is_inserted(s->bs)) { bdrv_set_locked(s->bs, packet[4] & 1); ide_atapi_cmd_ok(s); } else { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); case GPCMD_READ_10: case GPCMD_READ_12: { int nb_sectors, lba; if (packet[0] == GPCMD_READ_10) nb_sectors = ube16_to_cpu(packet + 7); else nb_sectors = ube32_to_cpu(packet + 6); lba = ube32_to_cpu(packet + 2); if (nb_sectors == 0) { ide_atapi_cmd_ok(s); ide_atapi_cmd_read(s, lba, nb_sectors, 2048); case GPCMD_READ_CD: { int nb_sectors, lba, transfer_request; nb_sectors = (packet[6] << 16) | (packet[7] << 8) | packet[8]; lba = ube32_to_cpu(packet + 2); if (nb_sectors == 0) { ide_atapi_cmd_ok(s); transfer_request = packet[9]; switch(transfer_request & 0xf8) { case 0x00: ide_atapi_cmd_ok(s); case 0x10: ide_atapi_cmd_read(s, lba, nb_sectors, 2048); case 0xf8: ide_atapi_cmd_read(s, lba, nb_sectors, 2352); default: case GPCMD_SEEK: { unsigned int lba; uint64_t total_sectors; bdrv_get_geometry(s->bs, &total_sectors); total_sectors >>= 2; if (total_sectors == 0) { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); lba = ube32_to_cpu(packet + 2); if (lba >= total_sectors) { ASC_LOGICAL_BLOCK_OOR); ide_atapi_cmd_ok(s); case GPCMD_START_STOP_UNIT: { int start, eject, err = 0; start = packet[4] & 1; eject = (packet[4] >> 1) & 1; if (eject) { err = bdrv_eject(s->bs, !start); switch (err) { case 0: ide_atapi_cmd_ok(s); case -EBUSY: ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIA_REMOVAL_PREVENTED); default: ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); case GPCMD_MECHANISM_STATUS: { max_len = ube16_to_cpu(packet + 8); cpu_to_ube16(buf, 0); buf[2] = 0; buf[3] = 0; buf[4] = 0; buf[5] = 1; cpu_to_ube16(buf + 6, 0); ide_atapi_cmd_reply(s, 8, max_len); case GPCMD_READ_TOC_PMA_ATIP: { int format, msf, start_track, len; uint64_t total_sectors; bdrv_get_geometry(s->bs, &total_sectors); total_sectors >>= 2; if (total_sectors == 0) { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); format = packet[9] >> 6; msf = (packet[1] >> 1) & 1; start_track = packet[6]; switch(format) { case 0: len = cdrom_read_toc(total_sectors, buf, msf, start_track); if (len < 0) goto error_cmd; ide_atapi_cmd_reply(s, len, max_len); case 1: memset(buf, 0, 12); buf[1] = 0x0a; buf[2] = 0x01; buf[3] = 0x01; ide_atapi_cmd_reply(s, 12, max_len); case 2: len = cdrom_read_toc_raw(total_sectors, buf, msf, start_track); if (len < 0) goto error_cmd; ide_atapi_cmd_reply(s, len, max_len); default: error_cmd: case GPCMD_READ_CDVD_CAPACITY: { uint64_t total_sectors; bdrv_get_geometry(s->bs, &total_sectors); total_sectors >>= 2; if (total_sectors == 0) { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); cpu_to_ube32(buf, total_sectors - 1); cpu_to_ube32(buf + 4, 2048); ide_atapi_cmd_reply(s, 8, 8); case GPCMD_READ_DVD_STRUCTURE: { int media = packet[1]; int format = packet[7]; int ret; max_len = ube16_to_cpu(packet + 8); if (format < 0xff) { if (media_is_cd(s)) { ASC_INCOMPATIBLE_FORMAT); } else if (!media_present(s)) { memset(buf, 0, max_len > IDE_DMA_BUF_SECTORS * 512 + 4 ? IDE_DMA_BUF_SECTORS * 512 + 4 : max_len); switch (format) { case 0x00 ... 0x7f: case 0xff: if (media == 0) { ret = ide_dvd_read_structure(s, format, packet, buf); if (ret < 0) ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, -ret); else ide_atapi_cmd_reply(s, ret, max_len); case 0x80: case 0x81: case 0x82: case 0x83: case 0x90: case 0xc0: default: case GPCMD_SET_SPEED: ide_atapi_cmd_ok(s); case GPCMD_INQUIRY: max_len = packet[4]; buf[0] = 0x05; buf[1] = 0x80; buf[2] = 0x00; buf[3] = 0x21; buf[4] = 31; buf[5] = 0; buf[6] = 0; buf[7] = 0; padstr8(buf + 8, 8, "QEMU"); padstr8(buf + 16, 16, "QEMU DVD-ROM"); padstr8(buf + 32, 4, s->version); ide_atapi_cmd_reply(s, 36, max_len); case GPCMD_GET_CONFIGURATION: { uint32_t len; uint8_t index = 0; if (packet[2] != 0 || packet[3] != 0) { if (max_len > 512) max_len = 512; memset(buf, 0, max_len); if (media_is_dvd(s)) cpu_to_ube16(buf + 6, MMC_PROFILE_DVD_ROM); else if (media_is_cd(s)) cpu_to_ube16(buf + 6, MMC_PROFILE_CD_ROM); buf[10] = 0x02 | 0x01; len = 12; len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_DVD_ROM); len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_CD_ROM); cpu_to_ube32(buf, len - 4); ide_atapi_cmd_reply(s, len, max_len); default: ASC_ILLEGAL_OPCODE);
{ "code": [], "line_no": [] }
static void FUNC_0(IDEState *VAR_0) { const uint8_t *VAR_1; uint8_t *buf; int VAR_2; VAR_1 = VAR_0->io_buffer; buf = VAR_0->io_buffer; #ifdef DEBUG_IDE_ATAPI { int i; printf("ATAPI limit=0x%x VAR_1:", VAR_0->lcyl | (VAR_0->hcyl << 8)); for(i = 0; i < ATAPI_PACKET_SIZE; i++) { printf(" %02x", VAR_1[i]); printf("\n"); #endif if (VAR_0->sense_key == SENSE_UNIT_ATTENTION && VAR_0->io_buffer[0] != GPCMD_REQUEST_SENSE && VAR_0->io_buffer[0] != GPCMD_INQUIRY) { ide_atapi_cmd_check_status(VAR_0); return; switch(VAR_0->io_buffer[0]) { case GPCMD_TEST_UNIT_READY: if (bdrv_is_inserted(VAR_0->bs) && !VAR_0->cdrom_changed) { ide_atapi_cmd_ok(VAR_0); } else { VAR_0->cdrom_changed = 0; ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); case GPCMD_MODE_SENSE_6: case GPCMD_MODE_SENSE_10: { int VAR_3, VAR_4; if (VAR_1[0] == GPCMD_MODE_SENSE_10) else VAR_2 = VAR_1[4]; VAR_3 = VAR_1[2] >> 6; VAR_4 = VAR_1[2] & 0x3f; switch(VAR_3) { case 0: switch(VAR_4) { case GPMODE_R_W_ERROR_PAGE: cpu_to_ube16(&buf[0], 16 + 6); buf[2] = 0x70; buf[3] = 0; buf[4] = 0; buf[5] = 0; buf[6] = 0; buf[7] = 0; buf[8] = 0x01; buf[9] = 0x06; buf[10] = 0x00; buf[11] = 0x05; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; ide_atapi_cmd_reply(VAR_0, 16, VAR_2); case GPMODE_AUDIO_CTL_PAGE: cpu_to_ube16(&buf[0], 24 + 6); buf[2] = 0x70; buf[3] = 0; buf[4] = 0; buf[5] = 0; buf[6] = 0; buf[7] = 0; buf[17] = 0; buf[19] = 0; buf[21] = 0; buf[23] = 0; ide_atapi_cmd_reply(VAR_0, 24, VAR_2); case GPMODE_CAPABILITIES_PAGE: cpu_to_ube16(&buf[0], 28 + 6); buf[2] = 0x70; buf[3] = 0; buf[4] = 0; buf[5] = 0; buf[6] = 0; buf[7] = 0; buf[8] = 0x2a; buf[9] = 0x12; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x71; buf[13] = 3 << 5; buf[14] = (1 << 0) | (1 << 3) | (1 << 5); if (bdrv_is_locked(VAR_0->bs)) buf[6] |= 1 << 1; buf[15] = 0x00; cpu_to_ube16(&buf[16], 706); buf[18] = 0; buf[19] = 2; cpu_to_ube16(&buf[20], 512); cpu_to_ube16(&buf[22], 706); buf[24] = 0; buf[25] = 0; buf[26] = 0; buf[27] = 0; ide_atapi_cmd_reply(VAR_0, 28, VAR_2); default: goto error_cmd; case 1: goto error_cmd; case 2: goto error_cmd; default: case 3: ASC_SAVING_PARAMETERS_NOT_SUPPORTED); case GPCMD_REQUEST_SENSE: VAR_2 = VAR_1[4]; memset(buf, 0, 18); buf[0] = 0x70 | (1 << 7); buf[2] = VAR_0->sense_key; buf[7] = 10; buf[12] = VAR_0->asc; if (VAR_0->sense_key == SENSE_UNIT_ATTENTION) VAR_0->sense_key = SENSE_NONE; ide_atapi_cmd_reply(VAR_0, 18, VAR_2); case GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL: if (bdrv_is_inserted(VAR_0->bs)) { bdrv_set_locked(VAR_0->bs, VAR_1[4] & 1); ide_atapi_cmd_ok(VAR_0); } else { ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); case GPCMD_READ_10: case GPCMD_READ_12: { int nb_sectors, lba; if (VAR_1[0] == GPCMD_READ_10) nb_sectors = ube16_to_cpu(VAR_1 + 7); else nb_sectors = ube32_to_cpu(VAR_1 + 6); lba = ube32_to_cpu(VAR_1 + 2); if (nb_sectors == 0) { ide_atapi_cmd_ok(VAR_0); ide_atapi_cmd_read(VAR_0, lba, nb_sectors, 2048); case GPCMD_READ_CD: { int nb_sectors, lba, transfer_request; nb_sectors = (VAR_1[6] << 16) | (VAR_1[7] << 8) | VAR_1[8]; lba = ube32_to_cpu(VAR_1 + 2); if (nb_sectors == 0) { ide_atapi_cmd_ok(VAR_0); transfer_request = VAR_1[9]; switch(transfer_request & 0xf8) { case 0x00: ide_atapi_cmd_ok(VAR_0); case 0x10: ide_atapi_cmd_read(VAR_0, lba, nb_sectors, 2048); case 0xf8: ide_atapi_cmd_read(VAR_0, lba, nb_sectors, 2352); default: case GPCMD_SEEK: { unsigned int lba; uint64_t total_sectors; bdrv_get_geometry(VAR_0->bs, &total_sectors); total_sectors >>= 2; if (total_sectors == 0) { ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); lba = ube32_to_cpu(VAR_1 + 2); if (lba >= total_sectors) { ASC_LOGICAL_BLOCK_OOR); ide_atapi_cmd_ok(VAR_0); case GPCMD_START_STOP_UNIT: { int start, eject, err = 0; start = VAR_1[4] & 1; eject = (VAR_1[4] >> 1) & 1; if (eject) { err = bdrv_eject(VAR_0->bs, !start); switch (err) { case 0: ide_atapi_cmd_ok(VAR_0); case -EBUSY: ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY, ASC_MEDIA_REMOVAL_PREVENTED); default: ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); case GPCMD_MECHANISM_STATUS: { VAR_2 = ube16_to_cpu(VAR_1 + 8); cpu_to_ube16(buf, 0); buf[2] = 0; buf[3] = 0; buf[4] = 0; buf[5] = 1; cpu_to_ube16(buf + 6, 0); ide_atapi_cmd_reply(VAR_0, 8, VAR_2); case GPCMD_READ_TOC_PMA_ATIP: { int format, msf, start_track, len; uint64_t total_sectors; bdrv_get_geometry(VAR_0->bs, &total_sectors); total_sectors >>= 2; if (total_sectors == 0) { ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); format = VAR_1[9] >> 6; msf = (VAR_1[1] >> 1) & 1; start_track = VAR_1[6]; switch(format) { case 0: len = cdrom_read_toc(total_sectors, buf, msf, start_track); if (len < 0) goto error_cmd; ide_atapi_cmd_reply(VAR_0, len, VAR_2); case 1: memset(buf, 0, 12); buf[1] = 0x0a; buf[2] = 0x01; buf[3] = 0x01; ide_atapi_cmd_reply(VAR_0, 12, VAR_2); case 2: len = cdrom_read_toc_raw(total_sectors, buf, msf, start_track); if (len < 0) goto error_cmd; ide_atapi_cmd_reply(VAR_0, len, VAR_2); default: error_cmd: case GPCMD_READ_CDVD_CAPACITY: { uint64_t total_sectors; bdrv_get_geometry(VAR_0->bs, &total_sectors); total_sectors >>= 2; if (total_sectors == 0) { ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); cpu_to_ube32(buf, total_sectors - 1); cpu_to_ube32(buf + 4, 2048); ide_atapi_cmd_reply(VAR_0, 8, 8); case GPCMD_READ_DVD_STRUCTURE: { int media = VAR_1[1]; int format = VAR_1[7]; int ret; VAR_2 = ube16_to_cpu(VAR_1 + 8); if (format < 0xff) { if (media_is_cd(VAR_0)) { ASC_INCOMPATIBLE_FORMAT); } else if (!media_present(VAR_0)) { memset(buf, 0, VAR_2 > IDE_DMA_BUF_SECTORS * 512 + 4 ? IDE_DMA_BUF_SECTORS * 512 + 4 : VAR_2); switch (format) { case 0x00 ... 0x7f: case 0xff: if (media == 0) { ret = ide_dvd_read_structure(VAR_0, format, VAR_1, buf); if (ret < 0) ide_atapi_cmd_error(VAR_0, SENSE_ILLEGAL_REQUEST, -ret); else ide_atapi_cmd_reply(VAR_0, ret, VAR_2); case 0x80: case 0x81: case 0x82: case 0x83: case 0x90: case 0xc0: default: case GPCMD_SET_SPEED: ide_atapi_cmd_ok(VAR_0); case GPCMD_INQUIRY: VAR_2 = VAR_1[4]; buf[0] = 0x05; buf[1] = 0x80; buf[2] = 0x00; buf[3] = 0x21; buf[4] = 31; buf[5] = 0; buf[6] = 0; buf[7] = 0; padstr8(buf + 8, 8, "QEMU"); padstr8(buf + 16, 16, "QEMU DVD-ROM"); padstr8(buf + 32, 4, VAR_0->version); ide_atapi_cmd_reply(VAR_0, 36, VAR_2); case GPCMD_GET_CONFIGURATION: { uint32_t len; uint8_t index = 0; if (VAR_1[2] != 0 || VAR_1[3] != 0) { if (VAR_2 > 512) VAR_2 = 512; memset(buf, 0, VAR_2); if (media_is_dvd(VAR_0)) cpu_to_ube16(buf + 6, MMC_PROFILE_DVD_ROM); else if (media_is_cd(VAR_0)) cpu_to_ube16(buf + 6, MMC_PROFILE_CD_ROM); buf[10] = 0x02 | 0x01; len = 12; len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_DVD_ROM); len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_CD_ROM); cpu_to_ube32(buf, len - 4); ide_atapi_cmd_reply(VAR_0, len, VAR_2); default: ASC_ILLEGAL_OPCODE);
[ "static void FUNC_0(IDEState *VAR_0)\n{", "const uint8_t *VAR_1;", "uint8_t *buf;", "int VAR_2;", "VAR_1 = VAR_0->io_buffer;", "buf = VAR_0->io_buffer;", "#ifdef DEBUG_IDE_ATAPI\n{", "int i;", "printf(\"ATAPI limit=0x%x VAR_1:\", VAR_0->lcyl | (VAR_0->hcyl << 8));", "for(i = 0; i < ATAPI_PACKET_SIZE; i++) {", "printf(\" %02x\", VAR_1[i]);", "printf(\"\\n\");", "#endif\nif (VAR_0->sense_key == SENSE_UNIT_ATTENTION &&\nVAR_0->io_buffer[0] != GPCMD_REQUEST_SENSE &&\nVAR_0->io_buffer[0] != GPCMD_INQUIRY) {", "ide_atapi_cmd_check_status(VAR_0);", "return;", "switch(VAR_0->io_buffer[0]) {", "case GPCMD_TEST_UNIT_READY:\nif (bdrv_is_inserted(VAR_0->bs) && !VAR_0->cdrom_changed) {", "ide_atapi_cmd_ok(VAR_0);", "} else {", "VAR_0->cdrom_changed = 0;", "ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY,\nASC_MEDIUM_NOT_PRESENT);", "case GPCMD_MODE_SENSE_6:\ncase GPCMD_MODE_SENSE_10:\n{", "int VAR_3, VAR_4;", "if (VAR_1[0] == GPCMD_MODE_SENSE_10)\nelse\nVAR_2 = VAR_1[4];", "VAR_3 = VAR_1[2] >> 6;", "VAR_4 = VAR_1[2] & 0x3f;", "switch(VAR_3) {", "case 0:\nswitch(VAR_4) {", "case GPMODE_R_W_ERROR_PAGE:\ncpu_to_ube16(&buf[0], 16 + 6);", "buf[2] = 0x70;", "buf[3] = 0;", "buf[4] = 0;", "buf[5] = 0;", "buf[6] = 0;", "buf[7] = 0;", "buf[8] = 0x01;", "buf[9] = 0x06;", "buf[10] = 0x00;", "buf[11] = 0x05;", "buf[12] = 0x00;", "buf[13] = 0x00;", "buf[14] = 0x00;", "buf[15] = 0x00;", "ide_atapi_cmd_reply(VAR_0, 16, VAR_2);", "case GPMODE_AUDIO_CTL_PAGE:\ncpu_to_ube16(&buf[0], 24 + 6);", "buf[2] = 0x70;", "buf[3] = 0;", "buf[4] = 0;", "buf[5] = 0;", "buf[6] = 0;", "buf[7] = 0;", "buf[17] = 0;", "buf[19] = 0;", "buf[21] = 0;", "buf[23] = 0;", "ide_atapi_cmd_reply(VAR_0, 24, VAR_2);", "case GPMODE_CAPABILITIES_PAGE:\ncpu_to_ube16(&buf[0], 28 + 6);", "buf[2] = 0x70;", "buf[3] = 0;", "buf[4] = 0;", "buf[5] = 0;", "buf[6] = 0;", "buf[7] = 0;", "buf[8] = 0x2a;", "buf[9] = 0x12;", "buf[10] = 0x00;", "buf[11] = 0x00;", "buf[12] = 0x71;", "buf[13] = 3 << 5;", "buf[14] = (1 << 0) | (1 << 3) | (1 << 5);", "if (bdrv_is_locked(VAR_0->bs))\nbuf[6] |= 1 << 1;", "buf[15] = 0x00;", "cpu_to_ube16(&buf[16], 706);", "buf[18] = 0;", "buf[19] = 2;", "cpu_to_ube16(&buf[20], 512);", "cpu_to_ube16(&buf[22], 706);", "buf[24] = 0;", "buf[25] = 0;", "buf[26] = 0;", "buf[27] = 0;", "ide_atapi_cmd_reply(VAR_0, 28, VAR_2);", "default:\ngoto error_cmd;", "case 1:\ngoto error_cmd;", "case 2:\ngoto error_cmd;", "default:\ncase 3:\nASC_SAVING_PARAMETERS_NOT_SUPPORTED);", "case GPCMD_REQUEST_SENSE:\nVAR_2 = VAR_1[4];", "memset(buf, 0, 18);", "buf[0] = 0x70 | (1 << 7);", "buf[2] = VAR_0->sense_key;", "buf[7] = 10;", "buf[12] = VAR_0->asc;", "if (VAR_0->sense_key == SENSE_UNIT_ATTENTION)\nVAR_0->sense_key = SENSE_NONE;", "ide_atapi_cmd_reply(VAR_0, 18, VAR_2);", "case GPCMD_PREVENT_ALLOW_MEDIUM_REMOVAL:\nif (bdrv_is_inserted(VAR_0->bs)) {", "bdrv_set_locked(VAR_0->bs, VAR_1[4] & 1);", "ide_atapi_cmd_ok(VAR_0);", "} else {", "ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY,\nASC_MEDIUM_NOT_PRESENT);", "case GPCMD_READ_10:\ncase GPCMD_READ_12:\n{", "int nb_sectors, lba;", "if (VAR_1[0] == GPCMD_READ_10)\nnb_sectors = ube16_to_cpu(VAR_1 + 7);", "else\nnb_sectors = ube32_to_cpu(VAR_1 + 6);", "lba = ube32_to_cpu(VAR_1 + 2);", "if (nb_sectors == 0) {", "ide_atapi_cmd_ok(VAR_0);", "ide_atapi_cmd_read(VAR_0, lba, nb_sectors, 2048);", "case GPCMD_READ_CD:\n{", "int nb_sectors, lba, transfer_request;", "nb_sectors = (VAR_1[6] << 16) | (VAR_1[7] << 8) | VAR_1[8];", "lba = ube32_to_cpu(VAR_1 + 2);", "if (nb_sectors == 0) {", "ide_atapi_cmd_ok(VAR_0);", "transfer_request = VAR_1[9];", "switch(transfer_request & 0xf8) {", "case 0x00:\nide_atapi_cmd_ok(VAR_0);", "case 0x10:\nide_atapi_cmd_read(VAR_0, lba, nb_sectors, 2048);", "case 0xf8:\nide_atapi_cmd_read(VAR_0, lba, nb_sectors, 2352);", "default:\ncase GPCMD_SEEK:\n{", "unsigned int lba;", "uint64_t total_sectors;", "bdrv_get_geometry(VAR_0->bs, &total_sectors);", "total_sectors >>= 2;", "if (total_sectors == 0) {", "ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY,\nASC_MEDIUM_NOT_PRESENT);", "lba = ube32_to_cpu(VAR_1 + 2);", "if (lba >= total_sectors) {", "ASC_LOGICAL_BLOCK_OOR);", "ide_atapi_cmd_ok(VAR_0);", "case GPCMD_START_STOP_UNIT:\n{", "int start, eject, err = 0;", "start = VAR_1[4] & 1;", "eject = (VAR_1[4] >> 1) & 1;", "if (eject) {", "err = bdrv_eject(VAR_0->bs, !start);", "switch (err) {", "case 0:\nide_atapi_cmd_ok(VAR_0);", "case -EBUSY:\nide_atapi_cmd_error(VAR_0, SENSE_NOT_READY,\nASC_MEDIA_REMOVAL_PREVENTED);", "default:\nide_atapi_cmd_error(VAR_0, SENSE_NOT_READY,\nASC_MEDIUM_NOT_PRESENT);", "case GPCMD_MECHANISM_STATUS:\n{", "VAR_2 = ube16_to_cpu(VAR_1 + 8);", "cpu_to_ube16(buf, 0);", "buf[2] = 0;", "buf[3] = 0;", "buf[4] = 0;", "buf[5] = 1;", "cpu_to_ube16(buf + 6, 0);", "ide_atapi_cmd_reply(VAR_0, 8, VAR_2);", "case GPCMD_READ_TOC_PMA_ATIP:\n{", "int format, msf, start_track, len;", "uint64_t total_sectors;", "bdrv_get_geometry(VAR_0->bs, &total_sectors);", "total_sectors >>= 2;", "if (total_sectors == 0) {", "ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY,\nASC_MEDIUM_NOT_PRESENT);", "format = VAR_1[9] >> 6;", "msf = (VAR_1[1] >> 1) & 1;", "start_track = VAR_1[6];", "switch(format) {", "case 0:\nlen = cdrom_read_toc(total_sectors, buf, msf, start_track);", "if (len < 0)\ngoto error_cmd;", "ide_atapi_cmd_reply(VAR_0, len, VAR_2);", "case 1:\nmemset(buf, 0, 12);", "buf[1] = 0x0a;", "buf[2] = 0x01;", "buf[3] = 0x01;", "ide_atapi_cmd_reply(VAR_0, 12, VAR_2);", "case 2:\nlen = cdrom_read_toc_raw(total_sectors, buf, msf, start_track);", "if (len < 0)\ngoto error_cmd;", "ide_atapi_cmd_reply(VAR_0, len, VAR_2);", "default:\nerror_cmd:\ncase GPCMD_READ_CDVD_CAPACITY:\n{", "uint64_t total_sectors;", "bdrv_get_geometry(VAR_0->bs, &total_sectors);", "total_sectors >>= 2;", "if (total_sectors == 0) {", "ide_atapi_cmd_error(VAR_0, SENSE_NOT_READY,\nASC_MEDIUM_NOT_PRESENT);", "cpu_to_ube32(buf, total_sectors - 1);", "cpu_to_ube32(buf + 4, 2048);", "ide_atapi_cmd_reply(VAR_0, 8, 8);", "case GPCMD_READ_DVD_STRUCTURE:\n{", "int media = VAR_1[1];", "int format = VAR_1[7];", "int ret;", "VAR_2 = ube16_to_cpu(VAR_1 + 8);", "if (format < 0xff) {", "if (media_is_cd(VAR_0)) {", "ASC_INCOMPATIBLE_FORMAT);", "} else if (!media_present(VAR_0)) {", "memset(buf, 0, VAR_2 > IDE_DMA_BUF_SECTORS * 512 + 4 ?\nIDE_DMA_BUF_SECTORS * 512 + 4 : VAR_2);", "switch (format) {", "case 0x00 ... 0x7f:\ncase 0xff:\nif (media == 0) {", "ret = ide_dvd_read_structure(VAR_0, format, VAR_1, buf);", "if (ret < 0)\nide_atapi_cmd_error(VAR_0, SENSE_ILLEGAL_REQUEST, -ret);", "else\nide_atapi_cmd_reply(VAR_0, ret, VAR_2);", "case 0x80:\ncase 0x81:\ncase 0x82:\ncase 0x83:\ncase 0x90:\ncase 0xc0:\ndefault:\ncase GPCMD_SET_SPEED:\nide_atapi_cmd_ok(VAR_0);", "case GPCMD_INQUIRY:\nVAR_2 = VAR_1[4];", "buf[0] = 0x05;", "buf[1] = 0x80;", "buf[2] = 0x00;", "buf[3] = 0x21;", "buf[4] = 31;", "buf[5] = 0;", "buf[6] = 0;", "buf[7] = 0;", "padstr8(buf + 8, 8, \"QEMU\");", "padstr8(buf + 16, 16, \"QEMU DVD-ROM\");", "padstr8(buf + 32, 4, VAR_0->version);", "ide_atapi_cmd_reply(VAR_0, 36, VAR_2);", "case GPCMD_GET_CONFIGURATION:\n{", "uint32_t len;", "uint8_t index = 0;", "if (VAR_1[2] != 0 || VAR_1[3] != 0) {", "if (VAR_2 > 512)\nVAR_2 = 512;", "memset(buf, 0, VAR_2);", "if (media_is_dvd(VAR_0))\ncpu_to_ube16(buf + 6, MMC_PROFILE_DVD_ROM);", "else if (media_is_cd(VAR_0))\ncpu_to_ube16(buf + 6, MMC_PROFILE_CD_ROM);", "buf[10] = 0x02 | 0x01;", "len = 12;", "len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_DVD_ROM);", "len += ide_atapi_set_profile(buf, &index, MMC_PROFILE_CD_ROM);", "cpu_to_ube32(buf, len - 4);", "ide_atapi_cmd_reply(VAR_0, len, VAR_2);", "default:\nASC_ILLEGAL_OPCODE);" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 18, 19, 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24, 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29, 30 ], [ 31, 32, 33 ], [ 34 ], [ 35, 36, 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41, 42 ], [ 43, 44 ], [ 45 ], [ 46 ], [ 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53 ], [ 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60, 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66 ], [ 67 ], [ 69 ], [ 70 ], [ 71 ], [ 72 ], [ 73 ], [ 74, 75 ], [ 76 ], [ 77 ], [ 78 ], [ 79 ], [ 80 ], [ 81 ], [ 82 ], [ 83 ], [ 84 ], [ 85 ], [ 88 ], [ 89 ], [ 90 ], [ 91, 92 ], [ 93 ], [ 94 ], [ 95 ], [ 96 ], [ 97 ], [ 98 ], [ 99 ], [ 100 ], [ 101 ], [ 102 ], [ 103 ], [ 104, 105 ], [ 106, 107 ], [ 108, 109 ], [ 110, 111, 112 ], [ 113, 114 ], [ 115 ], [ 116 ], [ 117 ], [ 118 ], [ 119 ], [ 120, 121 ], [ 122 ], [ 123, 124 ], [ 125 ], [ 126 ], [ 127 ], [ 128, 129 ], [ 130, 131, 132 ], [ 133 ], [ 134, 135 ], [ 136, 137 ], [ 138 ], [ 139 ], [ 140 ], [ 141 ], [ 142, 143 ], [ 144 ], [ 145 ], [ 146 ], [ 147 ], [ 148 ], [ 149 ], [ 150 ], [ 151, 153 ], [ 154, 156 ], [ 157, 159 ], [ 160, 161, 162 ], [ 163 ], [ 164 ], [ 165 ], [ 166 ], [ 167 ], [ 168, 169 ], [ 170 ], [ 171 ], [ 172 ], [ 173 ], [ 174, 175 ], [ 176 ], [ 177 ], [ 178 ], [ 179 ], [ 180 ], [ 181 ], [ 182, 183 ], [ 184, 185, 186 ], [ 187, 188, 189 ], [ 190, 191 ], [ 192 ], [ 193 ], [ 195 ], [ 196 ], [ 197 ], [ 198 ], [ 199 ], [ 200 ], [ 201, 202 ], [ 203 ], [ 204 ], [ 205 ], [ 206 ], [ 207 ], [ 208, 209 ], [ 210 ], [ 211 ], [ 212 ], [ 213 ], [ 214, 215 ], [ 216, 217 ], [ 218 ], [ 219, 221 ], [ 222 ], [ 223 ], [ 224 ], [ 225 ], [ 226, 227 ], [ 228, 229 ], [ 230 ], [ 231, 232, 233, 234 ], [ 235 ], [ 236 ], [ 237 ], [ 238 ], [ 239, 240 ], [ 242 ], [ 243 ], [ 244 ], [ 245, 246 ], [ 247 ], [ 248 ], [ 249 ], [ 250 ], [ 251 ], [ 252 ], [ 253 ], [ 254 ], [ 255, 256 ], [ 257 ], [ 258, 259, 260 ], [ 261 ], [ 262, 263 ], [ 264, 265 ], [ 268, 269, 270, 271, 272, 273, 274, 275, 276 ], [ 277, 278 ], [ 279 ], [ 280 ], [ 281 ], [ 282 ], [ 283 ], [ 284 ], [ 285 ], [ 286 ], [ 287 ], [ 288 ], [ 289 ], [ 290 ], [ 291, 292 ], [ 293 ], [ 294 ], [ 296 ], [ 305, 306 ], [ 307 ], [ 312, 313 ], [ 314, 315 ], [ 316 ], [ 317 ], [ 318 ], [ 319 ], [ 320 ], [ 321 ], [ 322, 323 ] ]
5,858
void rgb16tobgr15(const uint8_t *src, uint8_t *dst, unsigned int src_size) { unsigned i; unsigned num_pixels = src_size >> 1; for(i=0; i<num_pixels; i++) { unsigned b,g,r; register uint16_t rgb; rgb = src[2*i]; r = rgb&0x1F; g = (rgb&0x7E0)>>5; b = (rgb&0xF800)>>11; dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10); } }
true
FFmpeg
7f526efd17973ec6d2204f7a47b6923e2be31363
void rgb16tobgr15(const uint8_t *src, uint8_t *dst, unsigned int src_size) { unsigned i; unsigned num_pixels = src_size >> 1; for(i=0; i<num_pixels; i++) { unsigned b,g,r; register uint16_t rgb; rgb = src[2*i]; r = rgb&0x1F; g = (rgb&0x7E0)>>5; b = (rgb&0xF800)>>11; dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10); } }
{ "code": [ "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned i;", "\tunsigned num_pixels = src_size >> 1;", "void rgb16tobgr15(const uint8_t *src, uint8_t *dst, unsigned int src_size)", "\tunsigned i;", "\tunsigned num_pixels = src_size >> 1;", "\tunsigned i;", "\tunsigned num_pixels = src_size >> 1;", "\tunsigned i;", "\tunsigned num_pixels = src_size >> 1;", "\tunsigned i;" ], "line_no": [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 7, 1, 5, 7, 5, 7, 5, 7, 5 ] }
void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, unsigned int VAR_2) { unsigned VAR_3; unsigned VAR_4 = VAR_2 >> 1; for(VAR_3=0; VAR_3<VAR_4; VAR_3++) { unsigned VAR_5,VAR_6,VAR_7; register uint16_t VAR_8; VAR_8 = VAR_0[2*VAR_3]; VAR_7 = VAR_8&0x1F; VAR_6 = (VAR_8&0x7E0)>>5; VAR_5 = (VAR_8&0xF800)>>11; VAR_1[2*VAR_3] = (VAR_5&0x1F) | ((VAR_6&0x1F)<<5) | ((VAR_7&0x1F)<<10); } }
[ "void FUNC_0(const uint8_t *VAR_0, uint8_t *VAR_1, unsigned int VAR_2)\n{", "unsigned VAR_3;", "unsigned VAR_4 = VAR_2 >> 1;", "for(VAR_3=0; VAR_3<VAR_4; VAR_3++)", "{", "unsigned VAR_5,VAR_6,VAR_7;", "register uint16_t VAR_8;", "VAR_8 = VAR_0[2*VAR_3];", "VAR_7 = VAR_8&0x1F;", "VAR_6 = (VAR_8&0x7E0)>>5;", "VAR_5 = (VAR_8&0xF800)>>11;", "VAR_1[2*VAR_3] = (VAR_5&0x1F) | ((VAR_6&0x1F)<<5) | ((VAR_7&0x1F)<<10);", "}", "}" ]
[ 1, 1, 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 ] ]
5,859
static struct scsi_task *iscsi_do_inquiry(struct iscsi_context *iscsi, int lun, int evpd, int pc, void **inq, Error **errp) { int full_size; struct scsi_task *task = NULL; task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, 64); if (task == NULL || task->status != SCSI_STATUS_GOOD) { goto fail; } full_size = scsi_datain_getfullsize(task); if (full_size > task->datain.size) { scsi_free_scsi_task(task); /* we need more data for the full list */ task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, full_size); if (task == NULL || task->status != SCSI_STATUS_GOOD) { goto fail; } } *inq = scsi_datain_unmarshall(task); if (*inq == NULL) { error_setg(errp, "iSCSI: failed to unmarshall inquiry datain blob"); goto fail; } return task; fail: if (!error_is_set(errp)) { error_setg(errp, "iSCSI: Inquiry command failed : %s", iscsi_get_error(iscsi)); } if (task != NULL) { scsi_free_scsi_task(task); } return NULL; }
true
qemu
172fc4dd33e604dcf868c28e73398c19e161708b
static struct scsi_task *iscsi_do_inquiry(struct iscsi_context *iscsi, int lun, int evpd, int pc, void **inq, Error **errp) { int full_size; struct scsi_task *task = NULL; task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, 64); if (task == NULL || task->status != SCSI_STATUS_GOOD) { goto fail; } full_size = scsi_datain_getfullsize(task); if (full_size > task->datain.size) { scsi_free_scsi_task(task); task = iscsi_inquiry_sync(iscsi, lun, evpd, pc, full_size); if (task == NULL || task->status != SCSI_STATUS_GOOD) { goto fail; } } *inq = scsi_datain_unmarshall(task); if (*inq == NULL) { error_setg(errp, "iSCSI: failed to unmarshall inquiry datain blob"); goto fail; } return task; fail: if (!error_is_set(errp)) { error_setg(errp, "iSCSI: Inquiry command failed : %s", iscsi_get_error(iscsi)); } if (task != NULL) { scsi_free_scsi_task(task); } return NULL; }
{ "code": [ " goto fail;", " if (!error_is_set(errp)) {", " error_setg(errp, \"iSCSI: Inquiry command failed : %s\",", " iscsi_get_error(iscsi));" ], "line_no": [ 15, 59, 61, 63 ] }
static struct scsi_task *FUNC_0(struct iscsi_context *VAR_0, int VAR_1, int VAR_2, int VAR_3, void **VAR_4, Error **VAR_5) { int VAR_6; struct scsi_task *VAR_7 = NULL; VAR_7 = iscsi_inquiry_sync(VAR_0, VAR_1, VAR_2, VAR_3, 64); if (VAR_7 == NULL || VAR_7->status != SCSI_STATUS_GOOD) { goto fail; } VAR_6 = scsi_datain_getfullsize(VAR_7); if (VAR_6 > VAR_7->datain.size) { scsi_free_scsi_task(VAR_7); VAR_7 = iscsi_inquiry_sync(VAR_0, VAR_1, VAR_2, VAR_3, VAR_6); if (VAR_7 == NULL || VAR_7->status != SCSI_STATUS_GOOD) { goto fail; } } *VAR_4 = scsi_datain_unmarshall(VAR_7); if (*VAR_4 == NULL) { error_setg(VAR_5, "iSCSI: failed to unmarshall inquiry datain blob"); goto fail; } return VAR_7; fail: if (!error_is_set(VAR_5)) { error_setg(VAR_5, "iSCSI: Inquiry command failed : %s", iscsi_get_error(VAR_0)); } if (VAR_7 != NULL) { scsi_free_scsi_task(VAR_7); } return NULL; }
[ "static struct scsi_task *FUNC_0(struct iscsi_context *VAR_0, int VAR_1,\nint VAR_2, int VAR_3, void **VAR_4, Error **VAR_5)\n{", "int VAR_6;", "struct scsi_task *VAR_7 = NULL;", "VAR_7 = iscsi_inquiry_sync(VAR_0, VAR_1, VAR_2, VAR_3, 64);", "if (VAR_7 == NULL || VAR_7->status != SCSI_STATUS_GOOD) {", "goto fail;", "}", "VAR_6 = scsi_datain_getfullsize(VAR_7);", "if (VAR_6 > VAR_7->datain.size) {", "scsi_free_scsi_task(VAR_7);", "VAR_7 = iscsi_inquiry_sync(VAR_0, VAR_1, VAR_2, VAR_3, VAR_6);", "if (VAR_7 == NULL || VAR_7->status != SCSI_STATUS_GOOD) {", "goto fail;", "}", "}", "*VAR_4 = scsi_datain_unmarshall(VAR_7);", "if (*VAR_4 == NULL) {", "error_setg(VAR_5, \"iSCSI: failed to unmarshall inquiry datain blob\");", "goto fail;", "}", "return VAR_7;", "fail:\nif (!error_is_set(VAR_5)) {", "error_setg(VAR_5, \"iSCSI: Inquiry command failed : %s\",\niscsi_get_error(VAR_0));", "}", "if (VAR_7 != NULL) {", "scsi_free_scsi_task(VAR_7);", "}", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 57, 59 ], [ 61, 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ] ]
5,861
int kvm_arch_handle_exit(CPUPPCState *env, struct kvm_run *run) { int ret; switch (run->exit_reason) { case KVM_EXIT_DCR: if (run->dcr.is_write) { dprintf("handle dcr write\n"); ret = kvmppc_handle_dcr_write(env, run->dcr.dcrn, run->dcr.data); } else { dprintf("handle dcr read\n"); ret = kvmppc_handle_dcr_read(env, run->dcr.dcrn, &run->dcr.data); } break; case KVM_EXIT_HLT: dprintf("handle halt\n"); ret = kvmppc_handle_halt(env); break; #ifdef CONFIG_PSERIES case KVM_EXIT_PAPR_HCALL: dprintf("handle PAPR hypercall\n"); run->papr_hcall.ret = spapr_hypercall(env, run->papr_hcall.nr, run->papr_hcall.args); ret = 1; break; #endif default: fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason); ret = -1; break; } return ret; }
true
qemu
78e8fde26c032931ca2ae13bfc7c59e38afd17ee
int kvm_arch_handle_exit(CPUPPCState *env, struct kvm_run *run) { int ret; switch (run->exit_reason) { case KVM_EXIT_DCR: if (run->dcr.is_write) { dprintf("handle dcr write\n"); ret = kvmppc_handle_dcr_write(env, run->dcr.dcrn, run->dcr.data); } else { dprintf("handle dcr read\n"); ret = kvmppc_handle_dcr_read(env, run->dcr.dcrn, &run->dcr.data); } break; case KVM_EXIT_HLT: dprintf("handle halt\n"); ret = kvmppc_handle_halt(env); break; #ifdef CONFIG_PSERIES case KVM_EXIT_PAPR_HCALL: dprintf("handle PAPR hypercall\n"); run->papr_hcall.ret = spapr_hypercall(env, run->papr_hcall.nr, run->papr_hcall.args); ret = 1; break; #endif default: fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason); ret = -1; break; } return ret; }
{ "code": [ " ret = 1;" ], "line_no": [ 47 ] }
int FUNC_0(CPUPPCState *VAR_0, struct kvm_run *VAR_1) { int VAR_2; switch (VAR_1->exit_reason) { case KVM_EXIT_DCR: if (VAR_1->dcr.is_write) { dprintf("handle dcr write\n"); VAR_2 = kvmppc_handle_dcr_write(VAR_0, VAR_1->dcr.dcrn, VAR_1->dcr.data); } else { dprintf("handle dcr read\n"); VAR_2 = kvmppc_handle_dcr_read(VAR_0, VAR_1->dcr.dcrn, &VAR_1->dcr.data); } break; case KVM_EXIT_HLT: dprintf("handle halt\n"); VAR_2 = kvmppc_handle_halt(VAR_0); break; #ifdef CONFIG_PSERIES case KVM_EXIT_PAPR_HCALL: dprintf("handle PAPR hypercall\n"); VAR_1->papr_hcall.VAR_2 = spapr_hypercall(VAR_0, VAR_1->papr_hcall.nr, VAR_1->papr_hcall.args); VAR_2 = 1; break; #endif default: fprintf(stderr, "KVM: unknown exit reason %d\n", VAR_1->exit_reason); VAR_2 = -1; break; } return VAR_2; }
[ "int FUNC_0(CPUPPCState *VAR_0, struct kvm_run *VAR_1)\n{", "int VAR_2;", "switch (VAR_1->exit_reason) {", "case KVM_EXIT_DCR:\nif (VAR_1->dcr.is_write) {", "dprintf(\"handle dcr write\\n\");", "VAR_2 = kvmppc_handle_dcr_write(VAR_0, VAR_1->dcr.dcrn, VAR_1->dcr.data);", "} else {", "dprintf(\"handle dcr read\\n\");", "VAR_2 = kvmppc_handle_dcr_read(VAR_0, VAR_1->dcr.dcrn, &VAR_1->dcr.data);", "}", "break;", "case KVM_EXIT_HLT:\ndprintf(\"handle halt\\n\");", "VAR_2 = kvmppc_handle_halt(VAR_0);", "break;", "#ifdef CONFIG_PSERIES\ncase KVM_EXIT_PAPR_HCALL:\ndprintf(\"handle PAPR hypercall\\n\");", "VAR_1->papr_hcall.VAR_2 = spapr_hypercall(VAR_0, VAR_1->papr_hcall.nr,\nVAR_1->papr_hcall.args);", "VAR_2 = 1;", "break;", "#endif\ndefault:\nfprintf(stderr, \"KVM: unknown exit reason %d\\n\", VAR_1->exit_reason);", "VAR_2 = -1;", "break;", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11, 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37, 39, 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51, 53, 55 ], [ 57 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ] ]
5,862
static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) { static const S390Opcode ni_insns[4] = { RI_NILL, RI_NILH, RI_NIHL, RI_NIHH }; static const S390Opcode nif_insns[2] = { RIL_NILF, RIL_NIHF }; uint64_t valid = (type == TCG_TYPE_I32 ? 0xffffffffull : -1ull); int i; /* Look for the zero-extensions. */ if ((val & valid) == 0xffffffff) { tgen_ext32u(s, dest, dest); return; } if (facilities & FACILITY_EXT_IMM) { if ((val & valid) == 0xff) { tgen_ext8u(s, TCG_TYPE_I64, dest, dest); return; } if ((val & valid) == 0xffff) { tgen_ext16u(s, TCG_TYPE_I64, dest, dest); return; } } /* Try all 32-bit insns that can perform it in one go. */ for (i = 0; i < 4; i++) { tcg_target_ulong mask = ~(0xffffull << i*16); if (((val | ~valid) & mask) == mask) { tcg_out_insn_RI(s, ni_insns[i], dest, val >> i*16); return; } } /* Try all 48-bit insns that can perform it in one go. */ if (facilities & FACILITY_EXT_IMM) { for (i = 0; i < 2; i++) { tcg_target_ulong mask = ~(0xffffffffull << i*32); if (((val | ~valid) & mask) == mask) { tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i*32); return; } } } if ((facilities & FACILITY_GEN_INST_EXT) && risbg_mask(val)) { int msb, lsb; if ((val & 0x8000000000000001ull) == 0x8000000000000001ull) { /* Achieve wraparound by swapping msb and lsb. */ msb = 63 - ctz64(~val); lsb = clz64(~val) + 1; } else { msb = clz64(val); lsb = 63 - ctz64(val); } tcg_out_risbg(s, dest, dest, msb, lsb, 0, 1); return; } /* Fall back to loading the constant. */ tcg_out_movi(s, type, TCG_TMP0, val); if (type == TCG_TYPE_I32) { tcg_out_insn(s, RR, NR, dest, TCG_TMP0); } else { tcg_out_insn(s, RRE, NGR, dest, TCG_TMP0); } }
true
qemu
a1756896546fccf39eef6f282dcbd2f9292c1286
static void tgen_andi(TCGContext *s, TCGType type, TCGReg dest, uint64_t val) { static const S390Opcode ni_insns[4] = { RI_NILL, RI_NILH, RI_NIHL, RI_NIHH }; static const S390Opcode nif_insns[2] = { RIL_NILF, RIL_NIHF }; uint64_t valid = (type == TCG_TYPE_I32 ? 0xffffffffull : -1ull); int i; if ((val & valid) == 0xffffffff) { tgen_ext32u(s, dest, dest); return; } if (facilities & FACILITY_EXT_IMM) { if ((val & valid) == 0xff) { tgen_ext8u(s, TCG_TYPE_I64, dest, dest); return; } if ((val & valid) == 0xffff) { tgen_ext16u(s, TCG_TYPE_I64, dest, dest); return; } } for (i = 0; i < 4; i++) { tcg_target_ulong mask = ~(0xffffull << i*16); if (((val | ~valid) & mask) == mask) { tcg_out_insn_RI(s, ni_insns[i], dest, val >> i*16); return; } } if (facilities & FACILITY_EXT_IMM) { for (i = 0; i < 2; i++) { tcg_target_ulong mask = ~(0xffffffffull << i*32); if (((val | ~valid) & mask) == mask) { tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i*32); return; } } } if ((facilities & FACILITY_GEN_INST_EXT) && risbg_mask(val)) { int msb, lsb; if ((val & 0x8000000000000001ull) == 0x8000000000000001ull) { msb = 63 - ctz64(~val); lsb = clz64(~val) + 1; } else { msb = clz64(val); lsb = 63 - ctz64(val); } tcg_out_risbg(s, dest, dest, msb, lsb, 0, 1); return; } tcg_out_movi(s, type, TCG_TMP0, val); if (type == TCG_TYPE_I32) { tcg_out_insn(s, RR, NR, dest, TCG_TMP0); } else { tcg_out_insn(s, RRE, NGR, dest, TCG_TMP0); } }
{ "code": [ " msb = 63 - ctz64(~val);", " lsb = clz64(~val) + 1;" ], "line_no": [ 101, 103 ] }
static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGReg VAR_2, uint64_t VAR_3) { static const S390Opcode VAR_4[4] = { RI_NILL, RI_NILH, RI_NIHL, RI_NIHH }; static const S390Opcode VAR_5[2] = { RIL_NILF, RIL_NIHF }; uint64_t valid = (VAR_1 == TCG_TYPE_I32 ? 0xffffffffull : -1ull); int VAR_6; if ((VAR_3 & valid) == 0xffffffff) { tgen_ext32u(VAR_0, VAR_2, VAR_2); return; } if (facilities & FACILITY_EXT_IMM) { if ((VAR_3 & valid) == 0xff) { tgen_ext8u(VAR_0, TCG_TYPE_I64, VAR_2, VAR_2); return; } if ((VAR_3 & valid) == 0xffff) { tgen_ext16u(VAR_0, TCG_TYPE_I64, VAR_2, VAR_2); return; } } for (VAR_6 = 0; VAR_6 < 4; VAR_6++) { tcg_target_ulong mask = ~(0xffffull << VAR_6*16); if (((VAR_3 | ~valid) & mask) == mask) { tcg_out_insn_RI(VAR_0, VAR_4[VAR_6], VAR_2, VAR_3 >> VAR_6*16); return; } } if (facilities & FACILITY_EXT_IMM) { for (VAR_6 = 0; VAR_6 < 2; VAR_6++) { tcg_target_ulong mask = ~(0xffffffffull << VAR_6*32); if (((VAR_3 | ~valid) & mask) == mask) { tcg_out_insn_RIL(VAR_0, VAR_5[VAR_6], VAR_2, VAR_3 >> VAR_6*32); return; } } } if ((facilities & FACILITY_GEN_INST_EXT) && risbg_mask(VAR_3)) { int VAR_7, VAR_8; if ((VAR_3 & 0x8000000000000001ull) == 0x8000000000000001ull) { VAR_7 = 63 - ctz64(~VAR_3); VAR_8 = clz64(~VAR_3) + 1; } else { VAR_7 = clz64(VAR_3); VAR_8 = 63 - ctz64(VAR_3); } tcg_out_risbg(VAR_0, VAR_2, VAR_2, VAR_7, VAR_8, 0, 1); return; } tcg_out_movi(VAR_0, VAR_1, TCG_TMP0, VAR_3); if (VAR_1 == TCG_TYPE_I32) { tcg_out_insn(VAR_0, RR, NR, VAR_2, TCG_TMP0); } else { tcg_out_insn(VAR_0, RRE, NGR, VAR_2, TCG_TMP0); } }
[ "static void FUNC_0(TCGContext *VAR_0, TCGType VAR_1, TCGReg VAR_2, uint64_t VAR_3)\n{", "static const S390Opcode VAR_4[4] = {", "RI_NILL, RI_NILH, RI_NIHL, RI_NIHH\n};", "static const S390Opcode VAR_5[2] = {", "RIL_NILF, RIL_NIHF\n};", "uint64_t valid = (VAR_1 == TCG_TYPE_I32 ? 0xffffffffull : -1ull);", "int VAR_6;", "if ((VAR_3 & valid) == 0xffffffff) {", "tgen_ext32u(VAR_0, VAR_2, VAR_2);", "return;", "}", "if (facilities & FACILITY_EXT_IMM) {", "if ((VAR_3 & valid) == 0xff) {", "tgen_ext8u(VAR_0, TCG_TYPE_I64, VAR_2, VAR_2);", "return;", "}", "if ((VAR_3 & valid) == 0xffff) {", "tgen_ext16u(VAR_0, TCG_TYPE_I64, VAR_2, VAR_2);", "return;", "}", "}", "for (VAR_6 = 0; VAR_6 < 4; VAR_6++) {", "tcg_target_ulong mask = ~(0xffffull << VAR_6*16);", "if (((VAR_3 | ~valid) & mask) == mask) {", "tcg_out_insn_RI(VAR_0, VAR_4[VAR_6], VAR_2, VAR_3 >> VAR_6*16);", "return;", "}", "}", "if (facilities & FACILITY_EXT_IMM) {", "for (VAR_6 = 0; VAR_6 < 2; VAR_6++) {", "tcg_target_ulong mask = ~(0xffffffffull << VAR_6*32);", "if (((VAR_3 | ~valid) & mask) == mask) {", "tcg_out_insn_RIL(VAR_0, VAR_5[VAR_6], VAR_2, VAR_3 >> VAR_6*32);", "return;", "}", "}", "}", "if ((facilities & FACILITY_GEN_INST_EXT) && risbg_mask(VAR_3)) {", "int VAR_7, VAR_8;", "if ((VAR_3 & 0x8000000000000001ull) == 0x8000000000000001ull) {", "VAR_7 = 63 - ctz64(~VAR_3);", "VAR_8 = clz64(~VAR_3) + 1;", "} else {", "VAR_7 = clz64(VAR_3);", "VAR_8 = 63 - ctz64(VAR_3);", "}", "tcg_out_risbg(VAR_0, VAR_2, VAR_2, VAR_7, VAR_8, 0, 1);", "return;", "}", "tcg_out_movi(VAR_0, VAR_1, TCG_TMP0, VAR_3);", "if (VAR_1 == TCG_TYPE_I32) {", "tcg_out_insn(VAR_0, RR, NR, VAR_2, TCG_TMP0);", "} else {", "tcg_out_insn(VAR_0, RRE, NGR, VAR_2, TCG_TMP0);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ] ]
5,863
static inline void RENAME(rgb16to24)(const uint8_t *src, uint8_t *dst, unsigned src_size) { const uint16_t *end; #ifdef HAVE_MMX const uint16_t *mm_end; #endif uint8_t *d = (uint8_t *)dst; const uint16_t *s = (const uint16_t *)src; end = s + src_size/2; #ifdef HAVE_MMX __asm __volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 7; while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movq %1, %%mm0\n\t" "movq %1, %%mm1\n\t" "movq %1, %%mm2\n\t" "pand %2, %%mm0\n\t" "pand %3, %%mm1\n\t" "pand %4, %%mm2\n\t" "psllq $3, %%mm0\n\t" "psrlq $3, %%mm1\n\t" "psrlq $8, %%mm2\n\t" "movq %%mm0, %%mm3\n\t" "movq %%mm1, %%mm4\n\t" "movq %%mm2, %%mm5\n\t" "punpcklwd %5, %%mm0\n\t" "punpcklwd %5, %%mm1\n\t" "punpcklwd %5, %%mm2\n\t" "punpckhwd %5, %%mm3\n\t" "punpckhwd %5, %%mm4\n\t" "punpckhwd %5, %%mm5\n\t" "psllq $8, %%mm1\n\t" "psllq $16, %%mm2\n\t" "por %%mm1, %%mm0\n\t" "por %%mm2, %%mm0\n\t" "psllq $8, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm4, %%mm3\n\t" "por %%mm5, %%mm3\n\t" "movq %%mm0, %%mm6\n\t" "movq %%mm3, %%mm7\n\t" "movq 8%1, %%mm0\n\t" "movq 8%1, %%mm1\n\t" "movq 8%1, %%mm2\n\t" "pand %2, %%mm0\n\t" "pand %3, %%mm1\n\t" "pand %4, %%mm2\n\t" "psllq $3, %%mm0\n\t" "psrlq $3, %%mm1\n\t" "psrlq $8, %%mm2\n\t" "movq %%mm0, %%mm3\n\t" "movq %%mm1, %%mm4\n\t" "movq %%mm2, %%mm5\n\t" "punpcklwd %5, %%mm0\n\t" "punpcklwd %5, %%mm1\n\t" "punpcklwd %5, %%mm2\n\t" "punpckhwd %5, %%mm3\n\t" "punpckhwd %5, %%mm4\n\t" "punpckhwd %5, %%mm5\n\t" "psllq $8, %%mm1\n\t" "psllq $16, %%mm2\n\t" "por %%mm1, %%mm0\n\t" "por %%mm2, %%mm0\n\t" "psllq $8, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm4, %%mm3\n\t" "por %%mm5, %%mm3\n\t" :"=m"(*d) :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null) :"memory"); /* Borrowed 32 to 24 */ __asm __volatile( "movq %%mm0, %%mm4\n\t" "movq %%mm3, %%mm5\n\t" "movq %%mm6, %%mm0\n\t" "movq %%mm7, %%mm1\n\t" "movq %%mm4, %%mm6\n\t" "movq %%mm5, %%mm7\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm1, %%mm3\n\t" "psrlq $8, %%mm2\n\t" "psrlq $8, %%mm3\n\t" "psrlq $8, %%mm6\n\t" "psrlq $8, %%mm7\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm1\n\t" "pand %2, %%mm4\n\t" "pand %2, %%mm5\n\t" "pand %3, %%mm2\n\t" "pand %3, %%mm3\n\t" "pand %3, %%mm6\n\t" "pand %3, %%mm7\n\t" "por %%mm2, %%mm0\n\t" "por %%mm3, %%mm1\n\t" "por %%mm6, %%mm4\n\t" "por %%mm7, %%mm5\n\t" "movq %%mm1, %%mm2\n\t" "movq %%mm4, %%mm3\n\t" "psllq $48, %%mm2\n\t" "psllq $32, %%mm3\n\t" "pand %4, %%mm2\n\t" "pand %5, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "psrlq $16, %%mm1\n\t" "psrlq $32, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm3, %%mm1\n\t" "pand %6, %%mm5\n\t" "por %%mm5, %%mm4\n\t" MOVNTQ" %%mm0, %0\n\t" MOVNTQ" %%mm1, 8%0\n\t" MOVNTQ" %%mm4, 16%0" :"=m"(*d) :"m"(*s),"m"(mask24l),"m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh) :"memory"); d += 24; s += 8; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { register uint16_t bgr; bgr = *s++; *d++ = (bgr&0x1F)<<3; *d++ = (bgr&0x7E0)>>3; *d++ = (bgr&0xF800)>>8; } }
true
FFmpeg
7f526efd17973ec6d2204f7a47b6923e2be31363
static inline void RENAME(rgb16to24)(const uint8_t *src, uint8_t *dst, unsigned src_size) { const uint16_t *end; #ifdef HAVE_MMX const uint16_t *mm_end; #endif uint8_t *d = (uint8_t *)dst; const uint16_t *s = (const uint16_t *)src; end = s + src_size/2; #ifdef HAVE_MMX __asm __volatile(PREFETCH" %0"::"m"(*s):"memory"); mm_end = end - 7; while(s < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movq %1, %%mm0\n\t" "movq %1, %%mm1\n\t" "movq %1, %%mm2\n\t" "pand %2, %%mm0\n\t" "pand %3, %%mm1\n\t" "pand %4, %%mm2\n\t" "psllq $3, %%mm0\n\t" "psrlq $3, %%mm1\n\t" "psrlq $8, %%mm2\n\t" "movq %%mm0, %%mm3\n\t" "movq %%mm1, %%mm4\n\t" "movq %%mm2, %%mm5\n\t" "punpcklwd %5, %%mm0\n\t" "punpcklwd %5, %%mm1\n\t" "punpcklwd %5, %%mm2\n\t" "punpckhwd %5, %%mm3\n\t" "punpckhwd %5, %%mm4\n\t" "punpckhwd %5, %%mm5\n\t" "psllq $8, %%mm1\n\t" "psllq $16, %%mm2\n\t" "por %%mm1, %%mm0\n\t" "por %%mm2, %%mm0\n\t" "psllq $8, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm4, %%mm3\n\t" "por %%mm5, %%mm3\n\t" "movq %%mm0, %%mm6\n\t" "movq %%mm3, %%mm7\n\t" "movq 8%1, %%mm0\n\t" "movq 8%1, %%mm1\n\t" "movq 8%1, %%mm2\n\t" "pand %2, %%mm0\n\t" "pand %3, %%mm1\n\t" "pand %4, %%mm2\n\t" "psllq $3, %%mm0\n\t" "psrlq $3, %%mm1\n\t" "psrlq $8, %%mm2\n\t" "movq %%mm0, %%mm3\n\t" "movq %%mm1, %%mm4\n\t" "movq %%mm2, %%mm5\n\t" "punpcklwd %5, %%mm0\n\t" "punpcklwd %5, %%mm1\n\t" "punpcklwd %5, %%mm2\n\t" "punpckhwd %5, %%mm3\n\t" "punpckhwd %5, %%mm4\n\t" "punpckhwd %5, %%mm5\n\t" "psllq $8, %%mm1\n\t" "psllq $16, %%mm2\n\t" "por %%mm1, %%mm0\n\t" "por %%mm2, %%mm0\n\t" "psllq $8, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm4, %%mm3\n\t" "por %%mm5, %%mm3\n\t" :"=m"(*d) :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null) :"memory"); __asm __volatile( "movq %%mm0, %%mm4\n\t" "movq %%mm3, %%mm5\n\t" "movq %%mm6, %%mm0\n\t" "movq %%mm7, %%mm1\n\t" "movq %%mm4, %%mm6\n\t" "movq %%mm5, %%mm7\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm1, %%mm3\n\t" "psrlq $8, %%mm2\n\t" "psrlq $8, %%mm3\n\t" "psrlq $8, %%mm6\n\t" "psrlq $8, %%mm7\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm1\n\t" "pand %2, %%mm4\n\t" "pand %2, %%mm5\n\t" "pand %3, %%mm2\n\t" "pand %3, %%mm3\n\t" "pand %3, %%mm6\n\t" "pand %3, %%mm7\n\t" "por %%mm2, %%mm0\n\t" "por %%mm3, %%mm1\n\t" "por %%mm6, %%mm4\n\t" "por %%mm7, %%mm5\n\t" "movq %%mm1, %%mm2\n\t" "movq %%mm4, %%mm3\n\t" "psllq $48, %%mm2\n\t" "psllq $32, %%mm3\n\t" "pand %4, %%mm2\n\t" "pand %5, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "psrlq $16, %%mm1\n\t" "psrlq $32, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm3, %%mm1\n\t" "pand %6, %%mm5\n\t" "por %%mm5, %%mm4\n\t" MOVNTQ" %%mm0, %0\n\t" MOVNTQ" %%mm1, 8%0\n\t" MOVNTQ" %%mm4, 16%0" :"=m"(*d) :"m"(*s),"m"(mask24l),"m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh) :"memory"); d += 24; s += 8; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(s < end) { register uint16_t bgr; bgr = *s++; *d++ = (bgr&0x1F)<<3; *d++ = (bgr&0x7E0)>>3; *d++ = (bgr&0xF800)>>8; } }
{ "code": [ "static inline void RENAME(rgb16to24)(const uint8_t *src, uint8_t *dst, unsigned src_size)" ], "line_no": [ 1 ] }
static inline void FUNC_0(rgb16to24)(const uint8_t *src, uint8_t *dst, unsigned src_size) { const uint16_t *VAR_0; #ifdef HAVE_MMX const uint16_t *mm_end; #endif uint8_t *d = (uint8_t *)dst; const uint16_t *VAR_1 = (const uint16_t *)src; VAR_0 = VAR_1 + src_size/2; #ifdef HAVE_MMX __asm __volatile(PREFETCH" %0"::"m"(*VAR_1):"memory"); mm_end = VAR_0 - 7; while(VAR_1 < mm_end) { __asm __volatile( PREFETCH" 32%1\n\t" "movq %1, %%mm0\n\t" "movq %1, %%mm1\n\t" "movq %1, %%mm2\n\t" "pand %2, %%mm0\n\t" "pand %3, %%mm1\n\t" "pand %4, %%mm2\n\t" "psllq $3, %%mm0\n\t" "psrlq $3, %%mm1\n\t" "psrlq $8, %%mm2\n\t" "movq %%mm0, %%mm3\n\t" "movq %%mm1, %%mm4\n\t" "movq %%mm2, %%mm5\n\t" "punpcklwd %5, %%mm0\n\t" "punpcklwd %5, %%mm1\n\t" "punpcklwd %5, %%mm2\n\t" "punpckhwd %5, %%mm3\n\t" "punpckhwd %5, %%mm4\n\t" "punpckhwd %5, %%mm5\n\t" "psllq $8, %%mm1\n\t" "psllq $16, %%mm2\n\t" "por %%mm1, %%mm0\n\t" "por %%mm2, %%mm0\n\t" "psllq $8, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm4, %%mm3\n\t" "por %%mm5, %%mm3\n\t" "movq %%mm0, %%mm6\n\t" "movq %%mm3, %%mm7\n\t" "movq 8%1, %%mm0\n\t" "movq 8%1, %%mm1\n\t" "movq 8%1, %%mm2\n\t" "pand %2, %%mm0\n\t" "pand %3, %%mm1\n\t" "pand %4, %%mm2\n\t" "psllq $3, %%mm0\n\t" "psrlq $3, %%mm1\n\t" "psrlq $8, %%mm2\n\t" "movq %%mm0, %%mm3\n\t" "movq %%mm1, %%mm4\n\t" "movq %%mm2, %%mm5\n\t" "punpcklwd %5, %%mm0\n\t" "punpcklwd %5, %%mm1\n\t" "punpcklwd %5, %%mm2\n\t" "punpckhwd %5, %%mm3\n\t" "punpckhwd %5, %%mm4\n\t" "punpckhwd %5, %%mm5\n\t" "psllq $8, %%mm1\n\t" "psllq $16, %%mm2\n\t" "por %%mm1, %%mm0\n\t" "por %%mm2, %%mm0\n\t" "psllq $8, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm4, %%mm3\n\t" "por %%mm5, %%mm3\n\t" :"=m"(*d) :"m"(*VAR_1),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null) :"memory"); __asm __volatile( "movq %%mm0, %%mm4\n\t" "movq %%mm3, %%mm5\n\t" "movq %%mm6, %%mm0\n\t" "movq %%mm7, %%mm1\n\t" "movq %%mm4, %%mm6\n\t" "movq %%mm5, %%mm7\n\t" "movq %%mm0, %%mm2\n\t" "movq %%mm1, %%mm3\n\t" "psrlq $8, %%mm2\n\t" "psrlq $8, %%mm3\n\t" "psrlq $8, %%mm6\n\t" "psrlq $8, %%mm7\n\t" "pand %2, %%mm0\n\t" "pand %2, %%mm1\n\t" "pand %2, %%mm4\n\t" "pand %2, %%mm5\n\t" "pand %3, %%mm2\n\t" "pand %3, %%mm3\n\t" "pand %3, %%mm6\n\t" "pand %3, %%mm7\n\t" "por %%mm2, %%mm0\n\t" "por %%mm3, %%mm1\n\t" "por %%mm6, %%mm4\n\t" "por %%mm7, %%mm5\n\t" "movq %%mm1, %%mm2\n\t" "movq %%mm4, %%mm3\n\t" "psllq $48, %%mm2\n\t" "psllq $32, %%mm3\n\t" "pand %4, %%mm2\n\t" "pand %5, %%mm3\n\t" "por %%mm2, %%mm0\n\t" "psrlq $16, %%mm1\n\t" "psrlq $32, %%mm4\n\t" "psllq $16, %%mm5\n\t" "por %%mm3, %%mm1\n\t" "pand %6, %%mm5\n\t" "por %%mm5, %%mm4\n\t" MOVNTQ" %%mm0, %0\n\t" MOVNTQ" %%mm1, 8%0\n\t" MOVNTQ" %%mm4, 16%0" :"=m"(*d) :"m"(*VAR_1),"m"(mask24l),"m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh) :"memory"); d += 24; VAR_1 += 8; } __asm __volatile(SFENCE:::"memory"); __asm __volatile(EMMS:::"memory"); #endif while(VAR_1 < VAR_0) { register uint16_t VAR_2; VAR_2 = *VAR_1++; *d++ = (VAR_2&0x1F)<<3; *d++ = (VAR_2&0x7E0)>>3; *d++ = (VAR_2&0xF800)>>8; } }
[ "static inline void FUNC_0(rgb16to24)(const uint8_t *src, uint8_t *dst, unsigned src_size)\n{", "const uint16_t *VAR_0;", "#ifdef HAVE_MMX\nconst uint16_t *mm_end;", "#endif\nuint8_t *d = (uint8_t *)dst;", "const uint16_t *VAR_1 = (const uint16_t *)src;", "VAR_0 = VAR_1 + src_size/2;", "#ifdef HAVE_MMX\n__asm __volatile(PREFETCH\"\t%0\"::\"m\"(*VAR_1):\"memory\");", "mm_end = VAR_0 - 7;", "while(VAR_1 < mm_end)\n{", "__asm __volatile(\nPREFETCH\" 32%1\\n\\t\"\n\"movq\t%1, %%mm0\\n\\t\"\n\"movq\t%1, %%mm1\\n\\t\"\n\"movq\t%1, %%mm2\\n\\t\"\n\"pand\t%2, %%mm0\\n\\t\"\n\"pand\t%3, %%mm1\\n\\t\"\n\"pand\t%4, %%mm2\\n\\t\"\n\"psllq\t$3, %%mm0\\n\\t\"\n\"psrlq\t$3, %%mm1\\n\\t\"\n\"psrlq\t$8, %%mm2\\n\\t\"\n\"movq\t%%mm0, %%mm3\\n\\t\"\n\"movq\t%%mm1, %%mm4\\n\\t\"\n\"movq\t%%mm2, %%mm5\\n\\t\"\n\"punpcklwd %5, %%mm0\\n\\t\"\n\"punpcklwd %5, %%mm1\\n\\t\"\n\"punpcklwd %5, %%mm2\\n\\t\"\n\"punpckhwd %5, %%mm3\\n\\t\"\n\"punpckhwd %5, %%mm4\\n\\t\"\n\"punpckhwd %5, %%mm5\\n\\t\"\n\"psllq\t$8, %%mm1\\n\\t\"\n\"psllq\t$16, %%mm2\\n\\t\"\n\"por\t%%mm1, %%mm0\\n\\t\"\n\"por\t%%mm2, %%mm0\\n\\t\"\n\"psllq\t$8, %%mm4\\n\\t\"\n\"psllq\t$16, %%mm5\\n\\t\"\n\"por\t%%mm4, %%mm3\\n\\t\"\n\"por\t%%mm5, %%mm3\\n\\t\"\n\"movq\t%%mm0, %%mm6\\n\\t\"\n\"movq\t%%mm3, %%mm7\\n\\t\"\n\"movq\t8%1, %%mm0\\n\\t\"\n\"movq\t8%1, %%mm1\\n\\t\"\n\"movq\t8%1, %%mm2\\n\\t\"\n\"pand\t%2, %%mm0\\n\\t\"\n\"pand\t%3, %%mm1\\n\\t\"\n\"pand\t%4, %%mm2\\n\\t\"\n\"psllq\t$3, %%mm0\\n\\t\"\n\"psrlq\t$3, %%mm1\\n\\t\"\n\"psrlq\t$8, %%mm2\\n\\t\"\n\"movq\t%%mm0, %%mm3\\n\\t\"\n\"movq\t%%mm1, %%mm4\\n\\t\"\n\"movq\t%%mm2, %%mm5\\n\\t\"\n\"punpcklwd %5, %%mm0\\n\\t\"\n\"punpcklwd %5, %%mm1\\n\\t\"\n\"punpcklwd %5, %%mm2\\n\\t\"\n\"punpckhwd %5, %%mm3\\n\\t\"\n\"punpckhwd %5, %%mm4\\n\\t\"\n\"punpckhwd %5, %%mm5\\n\\t\"\n\"psllq\t$8, %%mm1\\n\\t\"\n\"psllq\t$16, %%mm2\\n\\t\"\n\"por\t%%mm1, %%mm0\\n\\t\"\n\"por\t%%mm2, %%mm0\\n\\t\"\n\"psllq\t$8, %%mm4\\n\\t\"\n\"psllq\t$16, %%mm5\\n\\t\"\n\"por\t%%mm4, %%mm3\\n\\t\"\n\"por\t%%mm5, %%mm3\\n\\t\"\n:\"=m\"(*d)\n:\"m\"(*VAR_1),\"m\"(mask16b),\"m\"(mask16g),\"m\"(mask16r),\"m\"(mmx_null)\n:\"memory\");", "__asm __volatile(\n\"movq\t%%mm0, %%mm4\\n\\t\"\n\"movq\t%%mm3, %%mm5\\n\\t\"\n\"movq\t%%mm6, %%mm0\\n\\t\"\n\"movq\t%%mm7, %%mm1\\n\\t\"\n\"movq\t%%mm4, %%mm6\\n\\t\"\n\"movq\t%%mm5, %%mm7\\n\\t\"\n\"movq\t%%mm0, %%mm2\\n\\t\"\n\"movq\t%%mm1, %%mm3\\n\\t\"\n\"psrlq\t$8, %%mm2\\n\\t\"\n\"psrlq\t$8, %%mm3\\n\\t\"\n\"psrlq\t$8, %%mm6\\n\\t\"\n\"psrlq\t$8, %%mm7\\n\\t\"\n\"pand\t%2, %%mm0\\n\\t\"\n\"pand\t%2, %%mm1\\n\\t\"\n\"pand\t%2, %%mm4\\n\\t\"\n\"pand\t%2, %%mm5\\n\\t\"\n\"pand\t%3, %%mm2\\n\\t\"\n\"pand\t%3, %%mm3\\n\\t\"\n\"pand\t%3, %%mm6\\n\\t\"\n\"pand\t%3, %%mm7\\n\\t\"\n\"por\t%%mm2, %%mm0\\n\\t\"\n\"por\t%%mm3, %%mm1\\n\\t\"\n\"por\t%%mm6, %%mm4\\n\\t\"\n\"por\t%%mm7, %%mm5\\n\\t\"\n\"movq\t%%mm1, %%mm2\\n\\t\"\n\"movq\t%%mm4, %%mm3\\n\\t\"\n\"psllq\t$48, %%mm2\\n\\t\"\n\"psllq\t$32, %%mm3\\n\\t\"\n\"pand\t%4, %%mm2\\n\\t\"\n\"pand\t%5, %%mm3\\n\\t\"\n\"por\t%%mm2, %%mm0\\n\\t\"\n\"psrlq\t$16, %%mm1\\n\\t\"\n\"psrlq\t$32, %%mm4\\n\\t\"\n\"psllq\t$16, %%mm5\\n\\t\"\n\"por\t%%mm3, %%mm1\\n\\t\"\n\"pand\t%6, %%mm5\\n\\t\"\n\"por\t%%mm5, %%mm4\\n\\t\"\nMOVNTQ\"\t%%mm0, %0\\n\\t\"\nMOVNTQ\"\t%%mm1, 8%0\\n\\t\"\nMOVNTQ\"\t%%mm4, 16%0\"\n:\"=m\"(*d)\n:\"m\"(*VAR_1),\"m\"(mask24l),\"m\"(mask24h),\"m\"(mask24hh),\"m\"(mask24hhh),\"m\"(mask24hhhh)\n:\"memory\");", "d += 24;", "VAR_1 += 8;", "}", "__asm __volatile(SFENCE:::\"memory\");", "__asm __volatile(EMMS:::\"memory\");", "#endif\nwhile(VAR_1 < VAR_0)\n{", "register uint16_t VAR_2;", "VAR_2 = *VAR_1++;", "*d++ = (VAR_2&0x1F)<<3;", "*d++ = (VAR_2&0x7E0)>>3;", "*d++ = (VAR_2&0xF800)>>8;", "}", "}" ]
[ 1, 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, 67, 69, 71, 73, 75, 77, 79, 81, 83, 87, 89, 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149 ], [ 153, 155, 157, 159, 161, 165, 167, 169, 171, 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 209, 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 237, 239, 241, 245, 247, 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261, 263, 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ] ]
5,865
static void gen_tlbsx_40x(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } t0 = tcg_temp_new(); gen_addr_reg_index(ctx, t0); gen_helper_4xx_tlbsx(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); tcg_temp_free(t0); if (Rc(ctx->opcode)) { TCGLabel *l1 = gen_new_label(); tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[rD(ctx->opcode)], -1, l1); tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], 0x02); gen_set_label(l1); } #endif }
true
qemu
9b2fadda3e0196ffd485adde4fe9cdd6fae35300
static void gen_tlbsx_40x(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } t0 = tcg_temp_new(); gen_addr_reg_index(ctx, t0); gen_helper_4xx_tlbsx(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); tcg_temp_free(t0); if (Rc(ctx->opcode)) { TCGLabel *l1 = gen_new_label(); tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[rD(ctx->opcode)], -1, l1); tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], 0x02); gen_set_label(l1); } #endif }
{ "code": [ " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", "#endif", "#endif", "#if defined(CONFIG_USER_ONLY)", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", " if (unlikely(ctx->pr)) {", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#else", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", "#if defined(CONFIG_USER_ONLY)", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", " if (unlikely(ctx->pr)) {", " gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);", "#endif" ], "line_no": [ 15, 7, 13, 15, 7, 13, 15, 7, 15, 5, 9, 13, 43, 5, 9, 13, 43, 43, 5, 9, 13, 7, 13, 15, 43, 13, 43, 13, 43, 13, 43, 13, 43, 13, 43, 13, 43, 13, 43, 13, 43, 13, 43, 13, 43, 13, 43, 7, 15, 43, 7, 13, 15, 43, 7, 15, 43, 7, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 13, 43, 13, 43, 13, 43, 13, 43, 5, 7, 9, 13, 15, 43, 7, 13, 15, 43, 5, 7, 9, 13, 15, 43, 5, 7, 9, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 5, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43, 7, 13, 15, 43 ] }
static void FUNC_0(DisasContext *VAR_0) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); #else TCGv t0; if (unlikely(VAR_0->pr)) { gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC); return; } t0 = tcg_temp_new(); gen_addr_reg_index(VAR_0, t0); gen_helper_4xx_tlbsx(cpu_gpr[rD(VAR_0->opcode)], cpu_env, t0); tcg_temp_free(t0); if (Rc(VAR_0->opcode)) { TCGLabel *l1 = gen_new_label(); tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[rD(VAR_0->opcode)], -1, l1); tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], 0x02); gen_set_label(l1); } #endif }
[ "static void FUNC_0(DisasContext *VAR_0)\n{", "#if defined(CONFIG_USER_ONLY)\ngen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "#else\nTCGv t0;", "if (unlikely(VAR_0->pr)) {", "gen_inval_exception(VAR_0, POWERPC_EXCP_PRIV_OPC);", "return;", "}", "t0 = tcg_temp_new();", "gen_addr_reg_index(VAR_0, t0);", "gen_helper_4xx_tlbsx(cpu_gpr[rD(VAR_0->opcode)], cpu_env, t0);", "tcg_temp_free(t0);", "if (Rc(VAR_0->opcode)) {", "TCGLabel *l1 = gen_new_label();", "tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so);", "tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[rD(VAR_0->opcode)], -1, l1);", "tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], 0x02);", "gen_set_label(l1);", "}", "#endif\n}" ]
[ 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ]
[ [ 1, 3 ], [ 5, 7 ], [ 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ] ]
5,866
static int sdp_parse_fmtp_config_h264(AVFormatContext *s, AVStream *stream, PayloadContext *h264_data, const char *attr, const char *value) { AVCodecParameters *par = stream->codecpar; if (!strcmp(attr, "packetization-mode")) { av_log(s, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value)); h264_data->packetization_mode = atoi(value); /* * Packetization Mode: * 0 or not present: Single NAL mode (Only nals from 1-23 are allowed) * 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed. * 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A), * and 29 (FU-B) are allowed. */ if (h264_data->packetization_mode > 1) av_log(s, AV_LOG_ERROR, "Interleaved RTP mode is not supported yet.\n"); } else if (!strcmp(attr, "profile-level-id")) { if (strlen(value) == 6) parse_profile_level_id(s, h264_data, value); } else if (!strcmp(attr, "sprop-parameter-sets")) { int ret; if (value[strlen(value) - 1] == ',') { av_log(s, AV_LOG_WARNING, "Missing PPS in sprop-parameter-sets, ignoring\n"); return 0; } par->extradata_size = 0; av_freep(&par->extradata); ret = ff_h264_parse_sprop_parameter_sets(s, &par->extradata, &par->extradata_size, value); av_log(s, AV_LOG_DEBUG, "Extradata set to %p (size: %d)\n", par->extradata, par->extradata_size); return ret; } return 0; }
true
FFmpeg
c42a1388a6d1bfd8001bf6a4241d8ca27e49326d
static int sdp_parse_fmtp_config_h264(AVFormatContext *s, AVStream *stream, PayloadContext *h264_data, const char *attr, const char *value) { AVCodecParameters *par = stream->codecpar; if (!strcmp(attr, "packetization-mode")) { av_log(s, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value)); h264_data->packetization_mode = atoi(value); if (h264_data->packetization_mode > 1) av_log(s, AV_LOG_ERROR, "Interleaved RTP mode is not supported yet.\n"); } else if (!strcmp(attr, "profile-level-id")) { if (strlen(value) == 6) parse_profile_level_id(s, h264_data, value); } else if (!strcmp(attr, "sprop-parameter-sets")) { int ret; if (value[strlen(value) - 1] == ',') { av_log(s, AV_LOG_WARNING, "Missing PPS in sprop-parameter-sets, ignoring\n"); return 0; } par->extradata_size = 0; av_freep(&par->extradata); ret = ff_h264_parse_sprop_parameter_sets(s, &par->extradata, &par->extradata_size, value); av_log(s, AV_LOG_DEBUG, "Extradata set to %p (size: %d)\n", par->extradata, par->extradata_size); return ret; } return 0; }
{ "code": [ " if (value[strlen(value) - 1] == ',') {" ], "line_no": [ 51 ] }
static int FUNC_0(AVFormatContext *VAR_0, AVStream *VAR_1, PayloadContext *VAR_2, const char *VAR_3, const char *VAR_4) { AVCodecParameters *par = VAR_1->codecpar; if (!strcmp(VAR_3, "packetization-mode")) { av_log(VAR_0, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(VAR_4)); VAR_2->packetization_mode = atoi(VAR_4); if (VAR_2->packetization_mode > 1) av_log(VAR_0, AV_LOG_ERROR, "Interleaved RTP mode is not supported yet.\n"); } else if (!strcmp(VAR_3, "profile-level-id")) { if (strlen(VAR_4) == 6) parse_profile_level_id(VAR_0, VAR_2, VAR_4); } else if (!strcmp(VAR_3, "sprop-parameter-sets")) { int VAR_5; if (VAR_4[strlen(VAR_4) - 1] == ',') { av_log(VAR_0, AV_LOG_WARNING, "Missing PPS in sprop-parameter-sets, ignoring\n"); return 0; } par->extradata_size = 0; av_freep(&par->extradata); VAR_5 = ff_h264_parse_sprop_parameter_sets(VAR_0, &par->extradata, &par->extradata_size, VAR_4); av_log(VAR_0, AV_LOG_DEBUG, "Extradata set to %p (size: %d)\n", par->extradata, par->extradata_size); return VAR_5; } return 0; }
[ "static int FUNC_0(AVFormatContext *VAR_0,\nAVStream *VAR_1,\nPayloadContext *VAR_2,\nconst char *VAR_3, const char *VAR_4)\n{", "AVCodecParameters *par = VAR_1->codecpar;", "if (!strcmp(VAR_3, \"packetization-mode\")) {", "av_log(VAR_0, AV_LOG_DEBUG, \"RTP Packetization Mode: %d\\n\", atoi(VAR_4));", "VAR_2->packetization_mode = atoi(VAR_4);", "if (VAR_2->packetization_mode > 1)\nav_log(VAR_0, AV_LOG_ERROR,\n\"Interleaved RTP mode is not supported yet.\\n\");", "} else if (!strcmp(VAR_3, \"profile-level-id\")) {", "if (strlen(VAR_4) == 6)\nparse_profile_level_id(VAR_0, VAR_2, VAR_4);", "} else if (!strcmp(VAR_3, \"sprop-parameter-sets\")) {", "int VAR_5;", "if (VAR_4[strlen(VAR_4) - 1] == ',') {", "av_log(VAR_0, AV_LOG_WARNING, \"Missing PPS in sprop-parameter-sets, ignoring\\n\");", "return 0;", "}", "par->extradata_size = 0;", "av_freep(&par->extradata);", "VAR_5 = ff_h264_parse_sprop_parameter_sets(VAR_0, &par->extradata,\n&par->extradata_size, VAR_4);", "av_log(VAR_0, AV_LOG_DEBUG, \"Extradata set to %p (size: %d)\\n\",\npar->extradata, par->extradata_size);", "return VAR_5;", "}", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5, 7, 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 35, 37, 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63, 65 ], [ 67, 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ] ]
5,868
int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, size_t threshold, size_t size_increase) { if ( s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < threshold && s->slice_context_count == 1 && s->pb.buf == s->avctx->internal->byte_buffer) { int lastgob_pos = s->ptr_lastgob - s->pb.buf; int vbv_pos = s->vbv_delay_ptr - s->pb.buf; uint8_t *new_buffer = NULL; int new_buffer_size = 0; av_fast_padded_malloc(&new_buffer, &new_buffer_size, s->avctx->internal->byte_buffer_size + size_increase); if (!new_buffer) memcpy(new_buffer, s->avctx->internal->byte_buffer, s->avctx->internal->byte_buffer_size); av_free(s->avctx->internal->byte_buffer); s->avctx->internal->byte_buffer = new_buffer; s->avctx->internal->byte_buffer_size = new_buffer_size; rebase_put_bits(&s->pb, new_buffer, new_buffer_size); s->ptr_lastgob = s->pb.buf + lastgob_pos; s->vbv_delay_ptr = s->pb.buf + vbv_pos; if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < threshold) return AVERROR(EINVAL); return 0;
true
FFmpeg
b65efbc0f4195421c15d2a6c228d331eec5b31c3
int ff_mpv_reallocate_putbitbuffer(MpegEncContext *s, size_t threshold, size_t size_increase) { if ( s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < threshold && s->slice_context_count == 1 && s->pb.buf == s->avctx->internal->byte_buffer) { int lastgob_pos = s->ptr_lastgob - s->pb.buf; int vbv_pos = s->vbv_delay_ptr - s->pb.buf; uint8_t *new_buffer = NULL; int new_buffer_size = 0; av_fast_padded_malloc(&new_buffer, &new_buffer_size, s->avctx->internal->byte_buffer_size + size_increase); if (!new_buffer) memcpy(new_buffer, s->avctx->internal->byte_buffer, s->avctx->internal->byte_buffer_size); av_free(s->avctx->internal->byte_buffer); s->avctx->internal->byte_buffer = new_buffer; s->avctx->internal->byte_buffer_size = new_buffer_size; rebase_put_bits(&s->pb, new_buffer, new_buffer_size); s->ptr_lastgob = s->pb.buf + lastgob_pos; s->vbv_delay_ptr = s->pb.buf + vbv_pos; if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < threshold) return AVERROR(EINVAL); return 0;
{ "code": [], "line_no": [] }
int FUNC_0(MpegEncContext *VAR_0, size_t VAR_1, size_t VAR_2) { if ( VAR_0->pb.buf_end - VAR_0->pb.buf - (put_bits_count(&VAR_0->pb)>>3) < VAR_1 && VAR_0->slice_context_count == 1 && VAR_0->pb.buf == VAR_0->avctx->internal->byte_buffer) { int VAR_3 = VAR_0->ptr_lastgob - VAR_0->pb.buf; int VAR_4 = VAR_0->vbv_delay_ptr - VAR_0->pb.buf; uint8_t *new_buffer = NULL; int VAR_5 = 0; av_fast_padded_malloc(&new_buffer, &VAR_5, VAR_0->avctx->internal->byte_buffer_size + VAR_2); if (!new_buffer) memcpy(new_buffer, VAR_0->avctx->internal->byte_buffer, VAR_0->avctx->internal->byte_buffer_size); av_free(VAR_0->avctx->internal->byte_buffer); VAR_0->avctx->internal->byte_buffer = new_buffer; VAR_0->avctx->internal->byte_buffer_size = VAR_5; rebase_put_bits(&VAR_0->pb, new_buffer, VAR_5); VAR_0->ptr_lastgob = VAR_0->pb.buf + VAR_3; VAR_0->vbv_delay_ptr = VAR_0->pb.buf + VAR_4; if (VAR_0->pb.buf_end - VAR_0->pb.buf - (put_bits_count(&VAR_0->pb)>>3) < VAR_1) return AVERROR(EINVAL); return 0;
[ "int FUNC_0(MpegEncContext *VAR_0, size_t VAR_1, size_t VAR_2)\n{", "if ( VAR_0->pb.buf_end - VAR_0->pb.buf - (put_bits_count(&VAR_0->pb)>>3) < VAR_1\n&& VAR_0->slice_context_count == 1\n&& VAR_0->pb.buf == VAR_0->avctx->internal->byte_buffer) {", "int VAR_3 = VAR_0->ptr_lastgob - VAR_0->pb.buf;", "int VAR_4 = VAR_0->vbv_delay_ptr - VAR_0->pb.buf;", "uint8_t *new_buffer = NULL;", "int VAR_5 = 0;", "av_fast_padded_malloc(&new_buffer, &VAR_5,\nVAR_0->avctx->internal->byte_buffer_size + VAR_2);", "if (!new_buffer)\nmemcpy(new_buffer, VAR_0->avctx->internal->byte_buffer, VAR_0->avctx->internal->byte_buffer_size);", "av_free(VAR_0->avctx->internal->byte_buffer);", "VAR_0->avctx->internal->byte_buffer = new_buffer;", "VAR_0->avctx->internal->byte_buffer_size = VAR_5;", "rebase_put_bits(&VAR_0->pb, new_buffer, VAR_5);", "VAR_0->ptr_lastgob = VAR_0->pb.buf + VAR_3;", "VAR_0->vbv_delay_ptr = VAR_0->pb.buf + VAR_4;", "if (VAR_0->pb.buf_end - VAR_0->pb.buf - (put_bits_count(&VAR_0->pb)>>3) < VAR_1)\nreturn AVERROR(EINVAL);", "return 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 ] ]
5,870
int64_t object_property_get_int(Object *obj, const char *name, Error **errp) { QObject *ret = object_property_get_qobject(obj, name, errp); QInt *qint; int64_t retval; if (!ret) { return -1; } qint = qobject_to_qint(ret); if (!qint) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "int"); retval = -1; } else { retval = qint_get_int(qint); } QDECREF(qint); return retval; }
true
qemu
560f19f162529d691619ac69ed032321c7f5f1fb
int64_t object_property_get_int(Object *obj, const char *name, Error **errp) { QObject *ret = object_property_get_qobject(obj, name, errp); QInt *qint; int64_t retval; if (!ret) { return -1; } qint = qobject_to_qint(ret); if (!qint) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "int"); retval = -1; } else { retval = qint_get_int(qint); } QDECREF(qint); return retval; }
{ "code": [ " QDECREF(qint);" ], "line_no": [ 37 ] }
int64_t FUNC_0(Object *obj, const char *name, Error **errp) { QObject *ret = object_property_get_qobject(obj, name, errp); QInt *qint; int64_t retval; if (!ret) { return -1; } qint = qobject_to_qint(ret); if (!qint) { error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, "int"); retval = -1; } else { retval = qint_get_int(qint); } QDECREF(qint); return retval; }
[ "int64_t FUNC_0(Object *obj, const char *name,\nError **errp)\n{", "QObject *ret = object_property_get_qobject(obj, name, errp);", "QInt *qint;", "int64_t retval;", "if (!ret) {", "return -1;", "}", "qint = qobject_to_qint(ret);", "if (!qint) {", "error_setg(errp, QERR_INVALID_PARAMETER_TYPE, name, \"int\");", "retval = -1;", "} else {", "retval = qint_get_int(qint);", "}", "QDECREF(qint);", "return retval;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ] ]
5,871
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout) { int i; if (nb_channels <= 0) nb_channels = av_get_channel_layout_nb_channels(channel_layout); for (i = 0; channel_layout_map[i].name; i++) if (nb_channels == channel_layout_map[i].nb_channels && channel_layout == channel_layout_map[i].layout) { av_strlcpy(buf, channel_layout_map[i].name, buf_size); return; } snprintf(buf, buf_size, "%d channels", nb_channels); if (channel_layout) { int i, ch; av_strlcat(buf, " (", buf_size); for (i = 0, ch = 0; i < 64; i++) { if ((channel_layout & (1L << i))) { const char *name = get_channel_name(i); if (name) { if (ch > 0) av_strlcat(buf, "|", buf_size); av_strlcat(buf, name, buf_size); } ch++; } } av_strlcat(buf, ")", buf_size); } }
true
FFmpeg
019dd2365729d44d66a5b629102e1ecb919f4f67
void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout) { int i; if (nb_channels <= 0) nb_channels = av_get_channel_layout_nb_channels(channel_layout); for (i = 0; channel_layout_map[i].name; i++) if (nb_channels == channel_layout_map[i].nb_channels && channel_layout == channel_layout_map[i].layout) { av_strlcpy(buf, channel_layout_map[i].name, buf_size); return; } snprintf(buf, buf_size, "%d channels", nb_channels); if (channel_layout) { int i, ch; av_strlcat(buf, " (", buf_size); for (i = 0, ch = 0; i < 64; i++) { if ((channel_layout & (1L << i))) { const char *name = get_channel_name(i); if (name) { if (ch > 0) av_strlcat(buf, "|", buf_size); av_strlcat(buf, name, buf_size); } ch++; } } av_strlcat(buf, ")", buf_size); } }
{ "code": [ " if ((channel_layout & (1L << i))) {" ], "line_no": [ 41 ] }
void FUNC_0(char *VAR_0, int VAR_1, int VAR_2, uint64_t VAR_3) { int VAR_5; if (VAR_2 <= 0) VAR_2 = av_get_channel_layout_nb_channels(VAR_3); for (VAR_5 = 0; channel_layout_map[VAR_5].VAR_6; VAR_5++) if (VAR_2 == channel_layout_map[VAR_5].VAR_2 && VAR_3 == channel_layout_map[VAR_5].layout) { av_strlcpy(VAR_0, channel_layout_map[VAR_5].VAR_6, VAR_1); return; } snprintf(VAR_0, VAR_1, "%d channels", VAR_2); if (VAR_3) { int VAR_5, VAR_5; av_strlcat(VAR_0, " (", VAR_1); for (VAR_5 = 0, VAR_5 = 0; VAR_5 < 64; VAR_5++) { if ((VAR_3 & (1L << VAR_5))) { const char *VAR_6 = get_channel_name(VAR_5); if (VAR_6) { if (VAR_5 > 0) av_strlcat(VAR_0, "|", VAR_1); av_strlcat(VAR_0, VAR_6, VAR_1); } VAR_5++; } } av_strlcat(VAR_0, ")", VAR_1); } }
[ "void FUNC_0(char *VAR_0, int VAR_1,\nint VAR_2, uint64_t VAR_3)\n{", "int VAR_5;", "if (VAR_2 <= 0)\nVAR_2 = av_get_channel_layout_nb_channels(VAR_3);", "for (VAR_5 = 0; channel_layout_map[VAR_5].VAR_6; VAR_5++)", "if (VAR_2 == channel_layout_map[VAR_5].VAR_2 &&\nVAR_3 == channel_layout_map[VAR_5].layout) {", "av_strlcpy(VAR_0, channel_layout_map[VAR_5].VAR_6, VAR_1);", "return;", "}", "snprintf(VAR_0, VAR_1, \"%d channels\", VAR_2);", "if (VAR_3) {", "int VAR_5, VAR_5;", "av_strlcat(VAR_0, \" (\", VAR_1);", "for (VAR_5 = 0, VAR_5 = 0; VAR_5 < 64; VAR_5++) {", "if ((VAR_3 & (1L << VAR_5))) {", "const char *VAR_6 = get_channel_name(VAR_5);", "if (VAR_6) {", "if (VAR_5 > 0)\nav_strlcat(VAR_0, \"|\", VAR_1);", "av_strlcat(VAR_0, VAR_6, VAR_1);", "}", "VAR_5++;", "}", "}", "av_strlcat(VAR_0, \")\", VAR_1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11, 13 ], [ 17 ], [ 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ] ]
5,872
int qemu_read_password(char *buf, int buf_size) { uint8_t ch; int i, ret; printf("password: "); fflush(stdout); term_init(); i = 0; for (;;) { ret = read(0, &ch, 1); if (ret == -1) { if (errno == EAGAIN || errno == EINTR) { continue; } else { break; } } else if (ret == 0) { ret = -1; break; } else { if (ch == '\r' || ch == '\n') { ret = 0; break; } if (i < (buf_size - 1)) { buf[i++] = ch; } } } term_exit(); buf[i] = '\0'; printf("\n"); return ret; }
true
qemu
788cf9f8c8cbda53843e060540f3e91a060eb744
int qemu_read_password(char *buf, int buf_size) { uint8_t ch; int i, ret; printf("password: "); fflush(stdout); term_init(); i = 0; for (;;) { ret = read(0, &ch, 1); if (ret == -1) { if (errno == EAGAIN || errno == EINTR) { continue; } else { break; } } else if (ret == 0) { ret = -1; break; } else { if (ch == '\r' || ch == '\n') { ret = 0; break; } if (i < (buf_size - 1)) { buf[i++] = ch; } } } term_exit(); buf[i] = '\0'; printf("\n"); return ret; }
{ "code": [ "int qemu_read_password(char *buf, int buf_size)", " uint8_t ch;", " int i, ret;", " printf(\"password: \");", " fflush(stdout);", " term_init();", " i = 0;", " for (;;) {", " ret = read(0, &ch, 1);", " if (ret == -1) {", " if (errno == EAGAIN || errno == EINTR) {", " continue;", " } else {", " break;", " } else if (ret == 0) {", " ret = -1;", " break;", " } else {", " if (ch == '\\r' ||", " ch == '\\n') {", " ret = 0;", " break;", " if (i < (buf_size - 1)) {", " buf[i++] = ch;", " term_exit();", " buf[i] = '\\0';", " printf(\"\\n\");", " return ret;", "int qemu_read_password(char *buf, int buf_size)", " fflush(stdout);", " i = 0;", " for (;;) {", " break;", " buf[i] = '\\0';" ], "line_no": [ 1, 5, 7, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 35, 37, 39, 41, 43, 45, 47, 31, 53, 55, 63, 65, 67, 69, 1, 13, 17, 19, 39, 65 ] }
int FUNC_0(char *VAR_0, int VAR_1) { uint8_t ch; int VAR_2, VAR_3; printf("password: "); fflush(stdout); term_init(); VAR_2 = 0; for (;;) { VAR_3 = read(0, &ch, 1); if (VAR_3 == -1) { if (errno == EAGAIN || errno == EINTR) { continue; } else { break; } } else if (VAR_3 == 0) { VAR_3 = -1; break; } else { if (ch == '\r' || ch == '\n') { VAR_3 = 0; break; } if (VAR_2 < (VAR_1 - 1)) { VAR_0[VAR_2++] = ch; } } } term_exit(); VAR_0[VAR_2] = '\0'; printf("\n"); return VAR_3; }
[ "int FUNC_0(char *VAR_0, int VAR_1)\n{", "uint8_t ch;", "int VAR_2, VAR_3;", "printf(\"password: \");", "fflush(stdout);", "term_init();", "VAR_2 = 0;", "for (;;) {", "VAR_3 = read(0, &ch, 1);", "if (VAR_3 == -1) {", "if (errno == EAGAIN || errno == EINTR) {", "continue;", "} else {", "break;", "}", "} else if (VAR_3 == 0) {", "VAR_3 = -1;", "break;", "} else {", "if (ch == '\\r' ||\nch == '\\n') {", "VAR_3 = 0;", "break;", "}", "if (VAR_2 < (VAR_1 - 1)) {", "VAR_0[VAR_2++] = ch;", "}", "}", "}", "term_exit();", "VAR_0[VAR_2] = '\\0';", "printf(\"\\n\");", "return VAR_3;", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ] ]
5,873
static void smbios_build_type_1_fields(const char *t) { char buf[1024]; if (get_param_value(buf, sizeof(buf), "manufacturer", t)) smbios_add_field(1, offsetof(struct smbios_type_1, manufacturer_str), strlen(buf) + 1, buf); if (get_param_value(buf, sizeof(buf), "product", t)) smbios_add_field(1, offsetof(struct smbios_type_1, product_name_str), strlen(buf) + 1, buf); if (get_param_value(buf, sizeof(buf), "version", t)) smbios_add_field(1, offsetof(struct smbios_type_1, version_str), strlen(buf) + 1, buf); if (get_param_value(buf, sizeof(buf), "serial", t)) smbios_add_field(1, offsetof(struct smbios_type_1, serial_number_str), strlen(buf) + 1, buf); if (get_param_value(buf, sizeof(buf), "uuid", t)) { if (qemu_uuid_parse(buf, qemu_uuid) != 0) { fprintf(stderr, "Invalid SMBIOS UUID string\n"); exit(1); } } if (get_param_value(buf, sizeof(buf), "sku", t)) smbios_add_field(1, offsetof(struct smbios_type_1, sku_number_str), strlen(buf) + 1, buf); if (get_param_value(buf, sizeof(buf), "family", t)) smbios_add_field(1, offsetof(struct smbios_type_1, family_str), strlen(buf) + 1, buf); }
false
qemu
5bb95e41868b461f37159efb48908828ebd7ab36
static void smbios_build_type_1_fields(const char *t) { char buf[1024]; if (get_param_value(buf, sizeof(buf), "manufacturer", t)) smbios_add_field(1, offsetof(struct smbios_type_1, manufacturer_str), strlen(buf) + 1, buf); if (get_param_value(buf, sizeof(buf), "product", t)) smbios_add_field(1, offsetof(struct smbios_type_1, product_name_str), strlen(buf) + 1, buf); if (get_param_value(buf, sizeof(buf), "version", t)) smbios_add_field(1, offsetof(struct smbios_type_1, version_str), strlen(buf) + 1, buf); if (get_param_value(buf, sizeof(buf), "serial", t)) smbios_add_field(1, offsetof(struct smbios_type_1, serial_number_str), strlen(buf) + 1, buf); if (get_param_value(buf, sizeof(buf), "uuid", t)) { if (qemu_uuid_parse(buf, qemu_uuid) != 0) { fprintf(stderr, "Invalid SMBIOS UUID string\n"); exit(1); } } if (get_param_value(buf, sizeof(buf), "sku", t)) smbios_add_field(1, offsetof(struct smbios_type_1, sku_number_str), strlen(buf) + 1, buf); if (get_param_value(buf, sizeof(buf), "family", t)) smbios_add_field(1, offsetof(struct smbios_type_1, family_str), strlen(buf) + 1, buf); }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0) { char VAR_1[1024]; if (get_param_value(VAR_1, sizeof(VAR_1), "manufacturer", VAR_0)) smbios_add_field(1, offsetof(struct smbios_type_1, manufacturer_str), strlen(VAR_1) + 1, VAR_1); if (get_param_value(VAR_1, sizeof(VAR_1), "product", VAR_0)) smbios_add_field(1, offsetof(struct smbios_type_1, product_name_str), strlen(VAR_1) + 1, VAR_1); if (get_param_value(VAR_1, sizeof(VAR_1), "version", VAR_0)) smbios_add_field(1, offsetof(struct smbios_type_1, version_str), strlen(VAR_1) + 1, VAR_1); if (get_param_value(VAR_1, sizeof(VAR_1), "serial", VAR_0)) smbios_add_field(1, offsetof(struct smbios_type_1, serial_number_str), strlen(VAR_1) + 1, VAR_1); if (get_param_value(VAR_1, sizeof(VAR_1), "uuid", VAR_0)) { if (qemu_uuid_parse(VAR_1, qemu_uuid) != 0) { fprintf(stderr, "Invalid SMBIOS UUID string\n"); exit(1); } } if (get_param_value(VAR_1, sizeof(VAR_1), "sku", VAR_0)) smbios_add_field(1, offsetof(struct smbios_type_1, sku_number_str), strlen(VAR_1) + 1, VAR_1); if (get_param_value(VAR_1, sizeof(VAR_1), "family", VAR_0)) smbios_add_field(1, offsetof(struct smbios_type_1, family_str), strlen(VAR_1) + 1, VAR_1); }
[ "static void FUNC_0(const char *VAR_0)\n{", "char VAR_1[1024];", "if (get_param_value(VAR_1, sizeof(VAR_1), \"manufacturer\", VAR_0))\nsmbios_add_field(1, offsetof(struct smbios_type_1, manufacturer_str),\nstrlen(VAR_1) + 1, VAR_1);", "if (get_param_value(VAR_1, sizeof(VAR_1), \"product\", VAR_0))\nsmbios_add_field(1, offsetof(struct smbios_type_1, product_name_str),\nstrlen(VAR_1) + 1, VAR_1);", "if (get_param_value(VAR_1, sizeof(VAR_1), \"version\", VAR_0))\nsmbios_add_field(1, offsetof(struct smbios_type_1, version_str),\nstrlen(VAR_1) + 1, VAR_1);", "if (get_param_value(VAR_1, sizeof(VAR_1), \"serial\", VAR_0))\nsmbios_add_field(1, offsetof(struct smbios_type_1, serial_number_str),\nstrlen(VAR_1) + 1, VAR_1);", "if (get_param_value(VAR_1, sizeof(VAR_1), \"uuid\", VAR_0)) {", "if (qemu_uuid_parse(VAR_1, qemu_uuid) != 0) {", "fprintf(stderr, \"Invalid SMBIOS UUID string\\n\");", "exit(1);", "}", "}", "if (get_param_value(VAR_1, sizeof(VAR_1), \"sku\", VAR_0))\nsmbios_add_field(1, offsetof(struct smbios_type_1, sku_number_str),\nstrlen(VAR_1) + 1, VAR_1);", "if (get_param_value(VAR_1, sizeof(VAR_1), \"family\", VAR_0))\nsmbios_add_field(1, offsetof(struct smbios_type_1, family_str),\nstrlen(VAR_1) + 1, VAR_1);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11, 13 ], [ 15, 17, 19 ], [ 21, 23, 25 ], [ 27, 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45, 47, 49 ], [ 51, 53, 55 ], [ 57 ] ]
5,876
int css_do_tsch_get_irb(SubchDev *sch, IRB *target_irb, int *irb_len) { SCSW *s = &sch->curr_status.scsw; PMCW *p = &sch->curr_status.pmcw; uint16_t stctl; IRB irb; if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) { return 3; } stctl = s->ctrl & SCSW_CTRL_MASK_STCTL; /* Prepare the irb for the guest. */ memset(&irb, 0, sizeof(IRB)); /* Copy scsw from current status. */ memcpy(&irb.scsw, s, sizeof(SCSW)); if (stctl & SCSW_STCTL_STATUS_PEND) { if (s->cstat & (SCSW_CSTAT_DATA_CHECK | SCSW_CSTAT_CHN_CTRL_CHK | SCSW_CSTAT_INTF_CTRL_CHK)) { irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF; irb.esw[0] = 0x04804000; } else { irb.esw[0] = 0x00800000; } /* If a unit check is pending, copy sense data. */ if ((s->dstat & SCSW_DSTAT_UNIT_CHECK) && (p->chars & PMCW_CHARS_MASK_CSENSE)) { int i; irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF | SCSW_FLAGS_MASK_ECTL; /* Attention: sense_data is already BE! */ memcpy(irb.ecw, sch->sense_data, sizeof(sch->sense_data)); for (i = 0; i < ARRAY_SIZE(irb.ecw); i++) { irb.ecw[i] = be32_to_cpu(irb.ecw[i]); } irb.esw[1] = 0x01000000 | (sizeof(sch->sense_data) << 8); } } /* Store the irb to the guest. */ copy_irb_to_guest(target_irb, &irb, p, irb_len); return ((stctl & SCSW_STCTL_STATUS_PEND) == 0); }
false
qemu
c679e74d2e29fa08ede9121d59aee4e9675611d7
int css_do_tsch_get_irb(SubchDev *sch, IRB *target_irb, int *irb_len) { SCSW *s = &sch->curr_status.scsw; PMCW *p = &sch->curr_status.pmcw; uint16_t stctl; IRB irb; if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) { return 3; } stctl = s->ctrl & SCSW_CTRL_MASK_STCTL; memset(&irb, 0, sizeof(IRB)); memcpy(&irb.scsw, s, sizeof(SCSW)); if (stctl & SCSW_STCTL_STATUS_PEND) { if (s->cstat & (SCSW_CSTAT_DATA_CHECK | SCSW_CSTAT_CHN_CTRL_CHK | SCSW_CSTAT_INTF_CTRL_CHK)) { irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF; irb.esw[0] = 0x04804000; } else { irb.esw[0] = 0x00800000; } if ((s->dstat & SCSW_DSTAT_UNIT_CHECK) && (p->chars & PMCW_CHARS_MASK_CSENSE)) { int i; irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF | SCSW_FLAGS_MASK_ECTL; memcpy(irb.ecw, sch->sense_data, sizeof(sch->sense_data)); for (i = 0; i < ARRAY_SIZE(irb.ecw); i++) { irb.ecw[i] = be32_to_cpu(irb.ecw[i]); } irb.esw[1] = 0x01000000 | (sizeof(sch->sense_data) << 8); } } copy_irb_to_guest(target_irb, &irb, p, irb_len); return ((stctl & SCSW_STCTL_STATUS_PEND) == 0); }
{ "code": [], "line_no": [] }
int FUNC_0(SubchDev *VAR_0, IRB *VAR_1, int *VAR_2) { SCSW *s = &VAR_0->curr_status.scsw; PMCW *p = &VAR_0->curr_status.pmcw; uint16_t stctl; IRB irb; if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) { return 3; } stctl = s->ctrl & SCSW_CTRL_MASK_STCTL; memset(&irb, 0, sizeof(IRB)); memcpy(&irb.scsw, s, sizeof(SCSW)); if (stctl & SCSW_STCTL_STATUS_PEND) { if (s->cstat & (SCSW_CSTAT_DATA_CHECK | SCSW_CSTAT_CHN_CTRL_CHK | SCSW_CSTAT_INTF_CTRL_CHK)) { irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF; irb.esw[0] = 0x04804000; } else { irb.esw[0] = 0x00800000; } if ((s->dstat & SCSW_DSTAT_UNIT_CHECK) && (p->chars & PMCW_CHARS_MASK_CSENSE)) { int VAR_3; irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF | SCSW_FLAGS_MASK_ECTL; memcpy(irb.ecw, VAR_0->sense_data, sizeof(VAR_0->sense_data)); for (VAR_3 = 0; VAR_3 < ARRAY_SIZE(irb.ecw); VAR_3++) { irb.ecw[VAR_3] = be32_to_cpu(irb.ecw[VAR_3]); } irb.esw[1] = 0x01000000 | (sizeof(VAR_0->sense_data) << 8); } } copy_irb_to_guest(VAR_1, &irb, p, VAR_2); return ((stctl & SCSW_STCTL_STATUS_PEND) == 0); }
[ "int FUNC_0(SubchDev *VAR_0, IRB *VAR_1, int *VAR_2)\n{", "SCSW *s = &VAR_0->curr_status.scsw;", "PMCW *p = &VAR_0->curr_status.pmcw;", "uint16_t stctl;", "IRB irb;", "if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) {", "return 3;", "}", "stctl = s->ctrl & SCSW_CTRL_MASK_STCTL;", "memset(&irb, 0, sizeof(IRB));", "memcpy(&irb.scsw, s, sizeof(SCSW));", "if (stctl & SCSW_STCTL_STATUS_PEND) {", "if (s->cstat & (SCSW_CSTAT_DATA_CHECK |\nSCSW_CSTAT_CHN_CTRL_CHK |\nSCSW_CSTAT_INTF_CTRL_CHK)) {", "irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF;", "irb.esw[0] = 0x04804000;", "} else {", "irb.esw[0] = 0x00800000;", "}", "if ((s->dstat & SCSW_DSTAT_UNIT_CHECK) &&\n(p->chars & PMCW_CHARS_MASK_CSENSE)) {", "int VAR_3;", "irb.scsw.flags |= SCSW_FLAGS_MASK_ESWF | SCSW_FLAGS_MASK_ECTL;", "memcpy(irb.ecw, VAR_0->sense_data, sizeof(VAR_0->sense_data));", "for (VAR_3 = 0; VAR_3 < ARRAY_SIZE(irb.ecw); VAR_3++) {", "irb.ecw[VAR_3] = be32_to_cpu(irb.ecw[VAR_3]);", "}", "irb.esw[1] = 0x01000000 | (sizeof(VAR_0->sense_data) << 8);", "}", "}", "copy_irb_to_guest(VAR_1, &irb, p, VAR_2);", "return ((stctl & SCSW_STCTL_STATUS_PEND) == 0);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 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 ], [ 23 ], [ 29 ], [ 35 ], [ 37 ], [ 39, 41, 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 57, 59 ], [ 61 ], [ 65 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 85 ], [ 89 ], [ 91 ] ]
5,877
void helper_ldq_kernel(uint64_t t0, uint64_t t1) { ldq_kernel(t1, t0); }
false
qemu
2374e73edafff0586cbfb67c333c5a7588f81fd5
void helper_ldq_kernel(uint64_t t0, uint64_t t1) { ldq_kernel(t1, t0); }
{ "code": [], "line_no": [] }
void FUNC_0(uint64_t VAR_0, uint64_t VAR_1) { ldq_kernel(VAR_1, VAR_0); }
[ "void FUNC_0(uint64_t VAR_0, uint64_t VAR_1)\n{", "ldq_kernel(VAR_1, VAR_0);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
5,878
static void lm32_uclinux_init(MachineState *machine) { const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; LM32CPU *cpu; CPULM32State *env; DriveInfo *dinfo; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *phys_ram = g_new(MemoryRegion, 1); qemu_irq *cpu_irq, irq[32]; HWSetup *hw; ResetInfo *reset_info; int i; /* memory map */ hwaddr flash_base = 0x04000000; size_t flash_sector_size = 256 * 1024; size_t flash_size = 32 * 1024 * 1024; hwaddr ram_base = 0x08000000; size_t ram_size = 64 * 1024 * 1024; hwaddr uart0_base = 0x80000000; hwaddr timer0_base = 0x80002000; hwaddr timer1_base = 0x80010000; hwaddr timer2_base = 0x80012000; int uart0_irq = 0; int timer0_irq = 1; int timer1_irq = 20; int timer2_irq = 21; hwaddr hwsetup_base = 0x0bffe000; hwaddr cmdline_base = 0x0bfff000; hwaddr initrd_base = 0x08400000; size_t initrd_max = 0x01000000; reset_info = g_malloc0(sizeof(ResetInfo)); if (cpu_model == NULL) { cpu_model = "lm32-full"; } cpu = cpu_lm32_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "qemu: unable to find CPU '%s'\n", cpu_model); exit(1); } env = &cpu->env; reset_info->cpu = cpu; reset_info->flash_base = flash_base; memory_region_init_ram(phys_ram, NULL, "lm32_uclinux.sdram", ram_size, &error_abort); vmstate_register_ram_global(phys_ram); memory_region_add_subregion(address_space_mem, ram_base, phys_ram); dinfo = drive_get(IF_PFLASH, 0, 0); /* Spansion S29NS128P */ pflash_cfi02_register(flash_base, NULL, "lm32_uclinux.flash", flash_size, dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, flash_sector_size, flash_size / flash_sector_size, 1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1); /* create irq lines */ cpu_irq = qemu_allocate_irqs(cpu_irq_handler, env, 1); env->pic_state = lm32_pic_init(*cpu_irq); for (i = 0; i < 32; i++) { irq[i] = qdev_get_gpio_in(env->pic_state, i); } sysbus_create_simple("lm32-uart", uart0_base, irq[uart0_irq]); sysbus_create_simple("lm32-timer", timer0_base, irq[timer0_irq]); sysbus_create_simple("lm32-timer", timer1_base, irq[timer1_irq]); sysbus_create_simple("lm32-timer", timer2_base, irq[timer2_irq]); /* make sure juart isn't the first chardev */ env->juart_state = lm32_juart_init(); reset_info->bootstrap_pc = flash_base; if (kernel_filename) { uint64_t entry; int kernel_size; kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL, 1, ELF_MACHINE, 0); reset_info->bootstrap_pc = entry; if (kernel_size < 0) { kernel_size = load_image_targphys(kernel_filename, ram_base, ram_size); reset_info->bootstrap_pc = ram_base; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } } /* generate a rom with the hardware description */ hw = hwsetup_init(); hwsetup_add_cpu(hw, "LM32", 75000000); hwsetup_add_flash(hw, "flash", flash_base, flash_size); hwsetup_add_ddr_sdram(hw, "ddr_sdram", ram_base, ram_size); hwsetup_add_timer(hw, "timer0", timer0_base, timer0_irq); hwsetup_add_timer(hw, "timer1_dev_only", timer1_base, timer1_irq); hwsetup_add_timer(hw, "timer2_dev_only", timer2_base, timer2_irq); hwsetup_add_uart(hw, "uart", uart0_base, uart0_irq); hwsetup_add_trailer(hw); hwsetup_create_rom(hw, hwsetup_base); hwsetup_free(hw); reset_info->hwsetup_base = hwsetup_base; if (kernel_cmdline && strlen(kernel_cmdline)) { pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline); reset_info->cmdline_base = cmdline_base; } if (initrd_filename) { size_t initrd_size; initrd_size = load_image_targphys(initrd_filename, initrd_base, initrd_max); reset_info->initrd_base = initrd_base; reset_info->initrd_size = initrd_size; } qemu_register_reset(main_cpu_reset, reset_info); }
false
qemu
4be746345f13e99e468c60acbd3a355e8183e3ce
static void lm32_uclinux_init(MachineState *machine) { const char *cpu_model = machine->cpu_model; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; LM32CPU *cpu; CPULM32State *env; DriveInfo *dinfo; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *phys_ram = g_new(MemoryRegion, 1); qemu_irq *cpu_irq, irq[32]; HWSetup *hw; ResetInfo *reset_info; int i; hwaddr flash_base = 0x04000000; size_t flash_sector_size = 256 * 1024; size_t flash_size = 32 * 1024 * 1024; hwaddr ram_base = 0x08000000; size_t ram_size = 64 * 1024 * 1024; hwaddr uart0_base = 0x80000000; hwaddr timer0_base = 0x80002000; hwaddr timer1_base = 0x80010000; hwaddr timer2_base = 0x80012000; int uart0_irq = 0; int timer0_irq = 1; int timer1_irq = 20; int timer2_irq = 21; hwaddr hwsetup_base = 0x0bffe000; hwaddr cmdline_base = 0x0bfff000; hwaddr initrd_base = 0x08400000; size_t initrd_max = 0x01000000; reset_info = g_malloc0(sizeof(ResetInfo)); if (cpu_model == NULL) { cpu_model = "lm32-full"; } cpu = cpu_lm32_init(cpu_model); if (cpu == NULL) { fprintf(stderr, "qemu: unable to find CPU '%s'\n", cpu_model); exit(1); } env = &cpu->env; reset_info->cpu = cpu; reset_info->flash_base = flash_base; memory_region_init_ram(phys_ram, NULL, "lm32_uclinux.sdram", ram_size, &error_abort); vmstate_register_ram_global(phys_ram); memory_region_add_subregion(address_space_mem, ram_base, phys_ram); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi02_register(flash_base, NULL, "lm32_uclinux.flash", flash_size, dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, flash_sector_size, flash_size / flash_sector_size, 1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1); cpu_irq = qemu_allocate_irqs(cpu_irq_handler, env, 1); env->pic_state = lm32_pic_init(*cpu_irq); for (i = 0; i < 32; i++) { irq[i] = qdev_get_gpio_in(env->pic_state, i); } sysbus_create_simple("lm32-uart", uart0_base, irq[uart0_irq]); sysbus_create_simple("lm32-timer", timer0_base, irq[timer0_irq]); sysbus_create_simple("lm32-timer", timer1_base, irq[timer1_irq]); sysbus_create_simple("lm32-timer", timer2_base, irq[timer2_irq]); env->juart_state = lm32_juart_init(); reset_info->bootstrap_pc = flash_base; if (kernel_filename) { uint64_t entry; int kernel_size; kernel_size = load_elf(kernel_filename, NULL, NULL, &entry, NULL, NULL, 1, ELF_MACHINE, 0); reset_info->bootstrap_pc = entry; if (kernel_size < 0) { kernel_size = load_image_targphys(kernel_filename, ram_base, ram_size); reset_info->bootstrap_pc = ram_base; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", kernel_filename); exit(1); } } hw = hwsetup_init(); hwsetup_add_cpu(hw, "LM32", 75000000); hwsetup_add_flash(hw, "flash", flash_base, flash_size); hwsetup_add_ddr_sdram(hw, "ddr_sdram", ram_base, ram_size); hwsetup_add_timer(hw, "timer0", timer0_base, timer0_irq); hwsetup_add_timer(hw, "timer1_dev_only", timer1_base, timer1_irq); hwsetup_add_timer(hw, "timer2_dev_only", timer2_base, timer2_irq); hwsetup_add_uart(hw, "uart", uart0_base, uart0_irq); hwsetup_add_trailer(hw); hwsetup_create_rom(hw, hwsetup_base); hwsetup_free(hw); reset_info->hwsetup_base = hwsetup_base; if (kernel_cmdline && strlen(kernel_cmdline)) { pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline); reset_info->cmdline_base = cmdline_base; } if (initrd_filename) { size_t initrd_size; initrd_size = load_image_targphys(initrd_filename, initrd_base, initrd_max); reset_info->initrd_base = initrd_base; reset_info->initrd_size = initrd_size; } qemu_register_reset(main_cpu_reset, reset_info); }
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { 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; LM32CPU *cpu; CPULM32State *env; DriveInfo *dinfo; MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *phys_ram = g_new(MemoryRegion, 1); qemu_irq *cpu_irq, irq[32]; HWSetup *hw; ResetInfo *reset_info; int VAR_5; hwaddr flash_base = 0x04000000; size_t flash_sector_size = 256 * 1024; size_t flash_size = 32 * 1024 * 1024; hwaddr ram_base = 0x08000000; size_t ram_size = 64 * 1024 * 1024; hwaddr uart0_base = 0x80000000; hwaddr timer0_base = 0x80002000; hwaddr timer1_base = 0x80010000; hwaddr timer2_base = 0x80012000; int VAR_6 = 0; int VAR_7 = 1; int VAR_8 = 20; int VAR_9 = 21; hwaddr hwsetup_base = 0x0bffe000; hwaddr cmdline_base = 0x0bfff000; hwaddr initrd_base = 0x08400000; size_t initrd_max = 0x01000000; reset_info = g_malloc0(sizeof(ResetInfo)); if (VAR_1 == NULL) { VAR_1 = "lm32-full"; } cpu = cpu_lm32_init(VAR_1); if (cpu == NULL) { fprintf(stderr, "qemu: unable to find CPU '%s'\n", VAR_1); exit(1); } env = &cpu->env; reset_info->cpu = cpu; reset_info->flash_base = flash_base; memory_region_init_ram(phys_ram, NULL, "lm32_uclinux.sdram", ram_size, &error_abort); vmstate_register_ram_global(phys_ram); memory_region_add_subregion(address_space_mem, ram_base, phys_ram); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi02_register(flash_base, NULL, "lm32_uclinux.flash", flash_size, dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, flash_sector_size, flash_size / flash_sector_size, 1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1); cpu_irq = qemu_allocate_irqs(cpu_irq_handler, env, 1); env->pic_state = lm32_pic_init(*cpu_irq); for (VAR_5 = 0; VAR_5 < 32; VAR_5++) { irq[VAR_5] = qdev_get_gpio_in(env->pic_state, VAR_5); } sysbus_create_simple("lm32-uart", uart0_base, irq[VAR_6]); sysbus_create_simple("lm32-timer", timer0_base, irq[VAR_7]); sysbus_create_simple("lm32-timer", timer1_base, irq[VAR_8]); sysbus_create_simple("lm32-timer", timer2_base, irq[VAR_9]); env->juart_state = lm32_juart_init(); reset_info->bootstrap_pc = flash_base; if (VAR_2) { uint64_t entry; int VAR_10; VAR_10 = load_elf(VAR_2, NULL, NULL, &entry, NULL, NULL, 1, ELF_MACHINE, 0); reset_info->bootstrap_pc = entry; if (VAR_10 < 0) { VAR_10 = load_image_targphys(VAR_2, ram_base, ram_size); reset_info->bootstrap_pc = ram_base; } if (VAR_10 < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", VAR_2); exit(1); } } hw = hwsetup_init(); hwsetup_add_cpu(hw, "LM32", 75000000); hwsetup_add_flash(hw, "flash", flash_base, flash_size); hwsetup_add_ddr_sdram(hw, "ddr_sdram", ram_base, ram_size); hwsetup_add_timer(hw, "timer0", timer0_base, VAR_7); hwsetup_add_timer(hw, "timer1_dev_only", timer1_base, VAR_8); hwsetup_add_timer(hw, "timer2_dev_only", timer2_base, VAR_9); hwsetup_add_uart(hw, "uart", uart0_base, VAR_6); hwsetup_add_trailer(hw); hwsetup_create_rom(hw, hwsetup_base); hwsetup_free(hw); reset_info->hwsetup_base = hwsetup_base; if (VAR_3 && strlen(VAR_3)) { pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, VAR_3); reset_info->cmdline_base = cmdline_base; } if (VAR_4) { size_t initrd_size; initrd_size = load_image_targphys(VAR_4, initrd_base, initrd_max); reset_info->initrd_base = initrd_base; reset_info->initrd_size = initrd_size; } qemu_register_reset(main_cpu_reset, reset_info); }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "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;", "LM32CPU *cpu;", "CPULM32State *env;", "DriveInfo *dinfo;", "MemoryRegion *address_space_mem = get_system_memory();", "MemoryRegion *phys_ram = g_new(MemoryRegion, 1);", "qemu_irq *cpu_irq, irq[32];", "HWSetup *hw;", "ResetInfo *reset_info;", "int VAR_5;", "hwaddr flash_base = 0x04000000;", "size_t flash_sector_size = 256 * 1024;", "size_t flash_size = 32 * 1024 * 1024;", "hwaddr ram_base = 0x08000000;", "size_t ram_size = 64 * 1024 * 1024;", "hwaddr uart0_base = 0x80000000;", "hwaddr timer0_base = 0x80002000;", "hwaddr timer1_base = 0x80010000;", "hwaddr timer2_base = 0x80012000;", "int VAR_6 = 0;", "int VAR_7 = 1;", "int VAR_8 = 20;", "int VAR_9 = 21;", "hwaddr hwsetup_base = 0x0bffe000;", "hwaddr cmdline_base = 0x0bfff000;", "hwaddr initrd_base = 0x08400000;", "size_t initrd_max = 0x01000000;", "reset_info = g_malloc0(sizeof(ResetInfo));", "if (VAR_1 == NULL) {", "VAR_1 = \"lm32-full\";", "}", "cpu = cpu_lm32_init(VAR_1);", "if (cpu == NULL) {", "fprintf(stderr, \"qemu: unable to find CPU '%s'\\n\", VAR_1);", "exit(1);", "}", "env = &cpu->env;", "reset_info->cpu = cpu;", "reset_info->flash_base = flash_base;", "memory_region_init_ram(phys_ram, NULL, \"lm32_uclinux.sdram\", ram_size,\n&error_abort);", "vmstate_register_ram_global(phys_ram);", "memory_region_add_subregion(address_space_mem, ram_base, phys_ram);", "dinfo = drive_get(IF_PFLASH, 0, 0);", "pflash_cfi02_register(flash_base, NULL, \"lm32_uclinux.flash\", flash_size,\ndinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL,\nflash_sector_size, flash_size / flash_sector_size,\n1, 2, 0x01, 0x7e, 0x43, 0x00, 0x555, 0x2aa, 1);", "cpu_irq = qemu_allocate_irqs(cpu_irq_handler, env, 1);", "env->pic_state = lm32_pic_init(*cpu_irq);", "for (VAR_5 = 0; VAR_5 < 32; VAR_5++) {", "irq[VAR_5] = qdev_get_gpio_in(env->pic_state, VAR_5);", "}", "sysbus_create_simple(\"lm32-uart\", uart0_base, irq[VAR_6]);", "sysbus_create_simple(\"lm32-timer\", timer0_base, irq[VAR_7]);", "sysbus_create_simple(\"lm32-timer\", timer1_base, irq[VAR_8]);", "sysbus_create_simple(\"lm32-timer\", timer2_base, irq[VAR_9]);", "env->juart_state = lm32_juart_init();", "reset_info->bootstrap_pc = flash_base;", "if (VAR_2) {", "uint64_t entry;", "int VAR_10;", "VAR_10 = load_elf(VAR_2, NULL, NULL, &entry, NULL, NULL,\n1, ELF_MACHINE, 0);", "reset_info->bootstrap_pc = entry;", "if (VAR_10 < 0) {", "VAR_10 = load_image_targphys(VAR_2, ram_base,\nram_size);", "reset_info->bootstrap_pc = ram_base;", "}", "if (VAR_10 < 0) {", "fprintf(stderr, \"qemu: could not load kernel '%s'\\n\",\nVAR_2);", "exit(1);", "}", "}", "hw = hwsetup_init();", "hwsetup_add_cpu(hw, \"LM32\", 75000000);", "hwsetup_add_flash(hw, \"flash\", flash_base, flash_size);", "hwsetup_add_ddr_sdram(hw, \"ddr_sdram\", ram_base, ram_size);", "hwsetup_add_timer(hw, \"timer0\", timer0_base, VAR_7);", "hwsetup_add_timer(hw, \"timer1_dev_only\", timer1_base, VAR_8);", "hwsetup_add_timer(hw, \"timer2_dev_only\", timer2_base, VAR_9);", "hwsetup_add_uart(hw, \"uart\", uart0_base, VAR_6);", "hwsetup_add_trailer(hw);", "hwsetup_create_rom(hw, hwsetup_base);", "hwsetup_free(hw);", "reset_info->hwsetup_base = hwsetup_base;", "if (VAR_3 && strlen(VAR_3)) {", "pstrcpy_targphys(\"cmdline\", cmdline_base, TARGET_PAGE_SIZE,\nVAR_3);", "reset_info->cmdline_base = cmdline_base;", "}", "if (VAR_4) {", "size_t initrd_size;", "initrd_size = load_image_targphys(VAR_4, initrd_base,\ninitrd_max);", "reset_info->initrd_base = initrd_base;", "reset_info->initrd_size = initrd_size;", "}", "qemu_register_reset(main_cpu_reset, reset_info);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 93 ], [ 95 ], [ 99 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 113 ], [ 117, 119, 121, 123 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 153 ], [ 157 ], [ 161 ], [ 163 ], [ 165 ], [ 169, 171 ], [ 173 ], [ 177 ], [ 179, 181 ], [ 183 ], [ 185 ], [ 189 ], [ 191, 193 ], [ 195 ], [ 197 ], [ 199 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 229 ], [ 233 ], [ 235, 237 ], [ 239 ], [ 241 ], [ 245 ], [ 247 ], [ 249, 251 ], [ 253 ], [ 255 ], [ 257 ], [ 261 ], [ 263 ] ]
5,879
static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, int size_min, int (*transfer_func)(URLContext *h, unsigned char *buf, int size)) { int ret, len; int fast_retries = 5; int64_t wait_since = 0; len = 0; while (len < size_min) { ret = transfer_func(h, buf+len, size-len); if (ret == AVERROR(EINTR)) continue; if (h->flags & AVIO_FLAG_NONBLOCK) return ret; if (ret == AVERROR(EAGAIN)) { ret = 0; if (fast_retries) { fast_retries--; } else { if (h->rw_timeout) { if (!wait_since) wait_since = av_gettime(); else if (av_gettime() > wait_since + h->rw_timeout) return AVERROR(EIO); } av_usleep(1000); } } else if (ret < 1) return (ret < 0 && ret != AVERROR_EOF) ? ret : len; if (ret) fast_retries = FFMAX(fast_retries, 2); len += ret; if (len < size && ff_check_interrupt(&h->interrupt_callback)) return AVERROR_EXIT; } return len; }
false
FFmpeg
34fd21120d8672357293cb83d8c9b770850db516
static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int size, int size_min, int (*transfer_func)(URLContext *h, unsigned char *buf, int size)) { int ret, len; int fast_retries = 5; int64_t wait_since = 0; len = 0; while (len < size_min) { ret = transfer_func(h, buf+len, size-len); if (ret == AVERROR(EINTR)) continue; if (h->flags & AVIO_FLAG_NONBLOCK) return ret; if (ret == AVERROR(EAGAIN)) { ret = 0; if (fast_retries) { fast_retries--; } else { if (h->rw_timeout) { if (!wait_since) wait_since = av_gettime(); else if (av_gettime() > wait_since + h->rw_timeout) return AVERROR(EIO); } av_usleep(1000); } } else if (ret < 1) return (ret < 0 && ret != AVERROR_EOF) ? ret : len; if (ret) fast_retries = FFMAX(fast_retries, 2); len += ret; if (len < size && ff_check_interrupt(&h->interrupt_callback)) return AVERROR_EXIT; } return len; }
{ "code": [], "line_no": [] }
static inline int FUNC_0(URLContext *VAR_5, unsigned char *VAR_5, int VAR_5, int VAR_3, int (*VAR_4)(URLContext *VAR_5, unsigned char *VAR_5, int VAR_5)) { int VAR_5, VAR_6; int VAR_7 = 5; int64_t wait_since = 0; VAR_6 = 0; while (VAR_6 < VAR_3) { VAR_5 = VAR_4(VAR_5, VAR_5+VAR_6, VAR_5-VAR_6); if (VAR_5 == AVERROR(EINTR)) continue; if (VAR_5->flags & AVIO_FLAG_NONBLOCK) return VAR_5; if (VAR_5 == AVERROR(EAGAIN)) { VAR_5 = 0; if (VAR_7) { VAR_7--; } else { if (VAR_5->rw_timeout) { if (!wait_since) wait_since = av_gettime(); else if (av_gettime() > wait_since + VAR_5->rw_timeout) return AVERROR(EIO); } av_usleep(1000); } } else if (VAR_5 < 1) return (VAR_5 < 0 && VAR_5 != AVERROR_EOF) ? VAR_5 : VAR_6; if (VAR_5) VAR_7 = FFMAX(VAR_7, 2); VAR_6 += VAR_5; if (VAR_6 < VAR_5 && ff_check_interrupt(&VAR_5->interrupt_callback)) return AVERROR_EXIT; } return VAR_6; }
[ "static inline int FUNC_0(URLContext *VAR_5, unsigned char *VAR_5, int VAR_5, int VAR_3,\nint (*VAR_4)(URLContext *VAR_5, unsigned char *VAR_5, int VAR_5))\n{", "int VAR_5, VAR_6;", "int VAR_7 = 5;", "int64_t wait_since = 0;", "VAR_6 = 0;", "while (VAR_6 < VAR_3) {", "VAR_5 = VAR_4(VAR_5, VAR_5+VAR_6, VAR_5-VAR_6);", "if (VAR_5 == AVERROR(EINTR))\ncontinue;", "if (VAR_5->flags & AVIO_FLAG_NONBLOCK)\nreturn VAR_5;", "if (VAR_5 == AVERROR(EAGAIN)) {", "VAR_5 = 0;", "if (VAR_7) {", "VAR_7--;", "} else {", "if (VAR_5->rw_timeout) {", "if (!wait_since)\nwait_since = av_gettime();", "else if (av_gettime() > wait_since + VAR_5->rw_timeout)\nreturn AVERROR(EIO);", "}", "av_usleep(1000);", "}", "} else if (VAR_5 < 1)", "return (VAR_5 < 0 && VAR_5 != AVERROR_EOF) ? VAR_5 : VAR_6;", "if (VAR_5)\nVAR_7 = FFMAX(VAR_7, 2);", "VAR_6 += VAR_5;", "if (VAR_6 < VAR_5 && ff_check_interrupt(&VAR_5->interrupt_callback))\nreturn AVERROR_EXIT;", "}", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ] ]
5,881
static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) { VirtIOSCSICcw *dev = VIRTIO_SCSI_CCW(ccw_dev); DeviceState *vdev = DEVICE(&dev->vdev); DeviceState *qdev = DEVICE(ccw_dev); Error *err = NULL; char *bus_name; /* * For command line compatibility, this sets the virtio-scsi-device bus * name as before. */ if (qdev->id) { bus_name = g_strdup_printf("%s.0", qdev->id); virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), bus_name); g_free(bus_name); } qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); object_property_set_bool(OBJECT(vdev), true, "realized", &err); if (err) { error_propagate(errp, err); } }
false
qemu
621ff94d5074d88253a5818c6b9c4db718fbfc65
static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) { VirtIOSCSICcw *dev = VIRTIO_SCSI_CCW(ccw_dev); DeviceState *vdev = DEVICE(&dev->vdev); DeviceState *qdev = DEVICE(ccw_dev); Error *err = NULL; char *bus_name; if (qdev->id) { bus_name = g_strdup_printf("%s.0", qdev->id); virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), bus_name); g_free(bus_name); } qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); object_property_set_bool(OBJECT(vdev), true, "realized", &err); if (err) { error_propagate(errp, err); } }
{ "code": [], "line_no": [] }
static void FUNC_0(VirtioCcwDevice *VAR_0, Error **VAR_1) { VirtIOSCSICcw *dev = VIRTIO_SCSI_CCW(VAR_0); DeviceState *vdev = DEVICE(&dev->vdev); DeviceState *qdev = DEVICE(VAR_0); Error *err = NULL; char *VAR_2; if (qdev->id) { VAR_2 = g_strdup_printf("%s.0", qdev->id); virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), VAR_2); g_free(VAR_2); } qdev_set_parent_bus(vdev, BUS(&VAR_0->bus)); object_property_set_bool(OBJECT(vdev), true, "realized", &err); if (err) { error_propagate(VAR_1, err); } }
[ "static void FUNC_0(VirtioCcwDevice *VAR_0, Error **VAR_1)\n{", "VirtIOSCSICcw *dev = VIRTIO_SCSI_CCW(VAR_0);", "DeviceState *vdev = DEVICE(&dev->vdev);", "DeviceState *qdev = DEVICE(VAR_0);", "Error *err = NULL;", "char *VAR_2;", "if (qdev->id) {", "VAR_2 = g_strdup_printf(\"%s.0\", qdev->id);", "virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), VAR_2);", "g_free(VAR_2);", "}", "qdev_set_parent_bus(vdev, BUS(&VAR_0->bus));", "object_property_set_bool(OBJECT(vdev), true, \"realized\", &err);", "if (err) {", "error_propagate(VAR_1, err);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ] ]
5,882
static void mpc8544_guts_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { addr &= MPC8544_GUTS_MMIO_SIZE - 1; switch (addr) { case MPC8544_GUTS_ADDR_RSTCR: if (value & MPC8544_GUTS_RSTCR_RESET) { qemu_system_reset_request(); } break; default: fprintf(stderr, "guts: Unknown register write: %x = %x\n", (int)addr, (unsigned)value); break; } }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
static void mpc8544_guts_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { addr &= MPC8544_GUTS_MMIO_SIZE - 1; switch (addr) { case MPC8544_GUTS_ADDR_RSTCR: if (value & MPC8544_GUTS_RSTCR_RESET) { qemu_system_reset_request(); } break; default: fprintf(stderr, "guts: Unknown register write: %x = %x\n", (int)addr, (unsigned)value); break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1, uint64_t VAR_2, unsigned VAR_3) { VAR_1 &= MPC8544_GUTS_MMIO_SIZE - 1; switch (VAR_1) { case MPC8544_GUTS_ADDR_RSTCR: if (VAR_2 & MPC8544_GUTS_RSTCR_RESET) { qemu_system_reset_request(); } break; default: fprintf(stderr, "guts: Unknown register write: %x = %x\n", (int)VAR_1, (unsigned)VAR_2); break; } }
[ "static void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "VAR_1 &= MPC8544_GUTS_MMIO_SIZE - 1;", "switch (VAR_1) {", "case MPC8544_GUTS_ADDR_RSTCR:\nif (VAR_2 & MPC8544_GUTS_RSTCR_RESET) {", "qemu_system_reset_request();", "}", "break;", "default:\nfprintf(stderr, \"guts: Unknown register write: %x = %x\\n\",\n(int)VAR_1, (unsigned)VAR_2);", "break;", "}", "}" ]
[ 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 ] ]
5,883
static int v9fs_do_chown(V9fsState *s, V9fsString *path, uid_t uid, gid_t gid) { return s->ops->chown(&s->ctx, path->data, uid, gid); }
false
qemu
f7613bee32ebd13ff4a8d721a59cf27b1fe5d94b
static int v9fs_do_chown(V9fsState *s, V9fsString *path, uid_t uid, gid_t gid) { return s->ops->chown(&s->ctx, path->data, uid, gid); }
{ "code": [], "line_no": [] }
static int FUNC_0(V9fsState *VAR_0, V9fsString *VAR_1, uid_t VAR_2, gid_t VAR_3) { return VAR_0->ops->chown(&VAR_0->ctx, VAR_1->data, VAR_2, VAR_3); }
[ "static int FUNC_0(V9fsState *VAR_0, V9fsString *VAR_1, uid_t VAR_2, gid_t VAR_3)\n{", "return VAR_0->ops->chown(&VAR_0->ctx, VAR_1->data, VAR_2, VAR_3);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
5,884
static int check_host_key_knownhosts(BDRVSSHState *s, const char *host, int port) { const char *home; char *knh_file = NULL; LIBSSH2_KNOWNHOSTS *knh = NULL; struct libssh2_knownhost *found; int ret, r; const char *hostkey; size_t len; int type; hostkey = libssh2_session_hostkey(s->session, &len, &type); if (!hostkey) { ret = -EINVAL; session_error_report(s, "failed to read remote host key"); goto out; } knh = libssh2_knownhost_init(s->session); if (!knh) { ret = -EINVAL; session_error_report(s, "failed to initialize known hosts support"); goto out; } home = getenv("HOME"); if (home) { knh_file = g_strdup_printf("%s/.ssh/known_hosts", home); } else { knh_file = g_strdup_printf("/root/.ssh/known_hosts"); } /* Read all known hosts from OpenSSH-style known_hosts file. */ libssh2_knownhost_readfile(knh, knh_file, LIBSSH2_KNOWNHOST_FILE_OPENSSH); r = libssh2_knownhost_checkp(knh, host, port, hostkey, len, LIBSSH2_KNOWNHOST_TYPE_PLAIN| LIBSSH2_KNOWNHOST_KEYENC_RAW, &found); switch (r) { case LIBSSH2_KNOWNHOST_CHECK_MATCH: /* OK */ DPRINTF("host key OK: %s", found->key); break; case LIBSSH2_KNOWNHOST_CHECK_MISMATCH: ret = -EINVAL; session_error_report(s, "host key does not match the one in known_hosts (found key %s)", found->key); goto out; case LIBSSH2_KNOWNHOST_CHECK_NOTFOUND: ret = -EINVAL; session_error_report(s, "no host key was found in known_hosts"); goto out; case LIBSSH2_KNOWNHOST_CHECK_FAILURE: ret = -EINVAL; session_error_report(s, "failure matching the host key with known_hosts"); goto out; default: ret = -EINVAL; session_error_report(s, "unknown error matching the host key with known_hosts (%d)", r); goto out; } /* known_hosts checking successful. */ ret = 0; out: if (knh != NULL) { libssh2_knownhost_free(knh); } g_free(knh_file); return ret; }
false
qemu
01c2b265fce921d6460e06f5af4dfb405119cbab
static int check_host_key_knownhosts(BDRVSSHState *s, const char *host, int port) { const char *home; char *knh_file = NULL; LIBSSH2_KNOWNHOSTS *knh = NULL; struct libssh2_knownhost *found; int ret, r; const char *hostkey; size_t len; int type; hostkey = libssh2_session_hostkey(s->session, &len, &type); if (!hostkey) { ret = -EINVAL; session_error_report(s, "failed to read remote host key"); goto out; } knh = libssh2_knownhost_init(s->session); if (!knh) { ret = -EINVAL; session_error_report(s, "failed to initialize known hosts support"); goto out; } home = getenv("HOME"); if (home) { knh_file = g_strdup_printf("%s/.ssh/known_hosts", home); } else { knh_file = g_strdup_printf("/root/.ssh/known_hosts"); } libssh2_knownhost_readfile(knh, knh_file, LIBSSH2_KNOWNHOST_FILE_OPENSSH); r = libssh2_knownhost_checkp(knh, host, port, hostkey, len, LIBSSH2_KNOWNHOST_TYPE_PLAIN| LIBSSH2_KNOWNHOST_KEYENC_RAW, &found); switch (r) { case LIBSSH2_KNOWNHOST_CHECK_MATCH: DPRINTF("host key OK: %s", found->key); break; case LIBSSH2_KNOWNHOST_CHECK_MISMATCH: ret = -EINVAL; session_error_report(s, "host key does not match the one in known_hosts (found key %s)", found->key); goto out; case LIBSSH2_KNOWNHOST_CHECK_NOTFOUND: ret = -EINVAL; session_error_report(s, "no host key was found in known_hosts"); goto out; case LIBSSH2_KNOWNHOST_CHECK_FAILURE: ret = -EINVAL; session_error_report(s, "failure matching the host key with known_hosts"); goto out; default: ret = -EINVAL; session_error_report(s, "unknown error matching the host key with known_hosts (%d)", r); goto out; } ret = 0; out: if (knh != NULL) { libssh2_knownhost_free(knh); } g_free(knh_file); return ret; }
{ "code": [], "line_no": [] }
static int FUNC_0(BDRVSSHState *VAR_0, const char *VAR_1, int VAR_2) { const char *VAR_3; char *VAR_4 = NULL; LIBSSH2_KNOWNHOSTS *knh = NULL; struct libssh2_knownhost *VAR_5; int VAR_6, VAR_7; const char *VAR_8; size_t len; int VAR_9; VAR_8 = libssh2_session_hostkey(VAR_0->session, &len, &VAR_9); if (!VAR_8) { VAR_6 = -EINVAL; session_error_report(VAR_0, "failed to read remote VAR_1 key"); goto out; } knh = libssh2_knownhost_init(VAR_0->session); if (!knh) { VAR_6 = -EINVAL; session_error_report(VAR_0, "failed to initialize known hosts support"); goto out; } VAR_3 = getenv("HOME"); if (VAR_3) { VAR_4 = g_strdup_printf("%VAR_0/.ssh/known_hosts", VAR_3); } else { VAR_4 = g_strdup_printf("/root/.ssh/known_hosts"); } libssh2_knownhost_readfile(knh, VAR_4, LIBSSH2_KNOWNHOST_FILE_OPENSSH); VAR_7 = libssh2_knownhost_checkp(knh, VAR_1, VAR_2, VAR_8, len, LIBSSH2_KNOWNHOST_TYPE_PLAIN| LIBSSH2_KNOWNHOST_KEYENC_RAW, &VAR_5); switch (VAR_7) { case LIBSSH2_KNOWNHOST_CHECK_MATCH: DPRINTF("VAR_1 key OK: %VAR_0", VAR_5->key); break; case LIBSSH2_KNOWNHOST_CHECK_MISMATCH: VAR_6 = -EINVAL; session_error_report(VAR_0, "VAR_1 key does not match the one in known_hosts (VAR_5 key %VAR_0)", VAR_5->key); goto out; case LIBSSH2_KNOWNHOST_CHECK_NOTFOUND: VAR_6 = -EINVAL; session_error_report(VAR_0, "no VAR_1 key was VAR_5 in known_hosts"); goto out; case LIBSSH2_KNOWNHOST_CHECK_FAILURE: VAR_6 = -EINVAL; session_error_report(VAR_0, "failure matching the VAR_1 key with known_hosts"); goto out; default: VAR_6 = -EINVAL; session_error_report(VAR_0, "unknown error matching the VAR_1 key with known_hosts (%d)", VAR_7); goto out; } VAR_6 = 0; out: if (knh != NULL) { libssh2_knownhost_free(knh); } g_free(VAR_4); return VAR_6; }
[ "static int FUNC_0(BDRVSSHState *VAR_0,\nconst char *VAR_1, int VAR_2)\n{", "const char *VAR_3;", "char *VAR_4 = NULL;", "LIBSSH2_KNOWNHOSTS *knh = NULL;", "struct libssh2_knownhost *VAR_5;", "int VAR_6, VAR_7;", "const char *VAR_8;", "size_t len;", "int VAR_9;", "VAR_8 = libssh2_session_hostkey(VAR_0->session, &len, &VAR_9);", "if (!VAR_8) {", "VAR_6 = -EINVAL;", "session_error_report(VAR_0, \"failed to read remote VAR_1 key\");", "goto out;", "}", "knh = libssh2_knownhost_init(VAR_0->session);", "if (!knh) {", "VAR_6 = -EINVAL;", "session_error_report(VAR_0, \"failed to initialize known hosts support\");", "goto out;", "}", "VAR_3 = getenv(\"HOME\");", "if (VAR_3) {", "VAR_4 = g_strdup_printf(\"%VAR_0/.ssh/known_hosts\", VAR_3);", "} else {", "VAR_4 = g_strdup_printf(\"/root/.ssh/known_hosts\");", "}", "libssh2_knownhost_readfile(knh, VAR_4, LIBSSH2_KNOWNHOST_FILE_OPENSSH);", "VAR_7 = libssh2_knownhost_checkp(knh, VAR_1, VAR_2, VAR_8, len,\nLIBSSH2_KNOWNHOST_TYPE_PLAIN|\nLIBSSH2_KNOWNHOST_KEYENC_RAW,\n&VAR_5);", "switch (VAR_7) {", "case LIBSSH2_KNOWNHOST_CHECK_MATCH:\nDPRINTF(\"VAR_1 key OK: %VAR_0\", VAR_5->key);", "break;", "case LIBSSH2_KNOWNHOST_CHECK_MISMATCH:\nVAR_6 = -EINVAL;", "session_error_report(VAR_0, \"VAR_1 key does not match the one in known_hosts (VAR_5 key %VAR_0)\",\nVAR_5->key);", "goto out;", "case LIBSSH2_KNOWNHOST_CHECK_NOTFOUND:\nVAR_6 = -EINVAL;", "session_error_report(VAR_0, \"no VAR_1 key was VAR_5 in known_hosts\");", "goto out;", "case LIBSSH2_KNOWNHOST_CHECK_FAILURE:\nVAR_6 = -EINVAL;", "session_error_report(VAR_0, \"failure matching the VAR_1 key with known_hosts\");", "goto out;", "default:\nVAR_6 = -EINVAL;", "session_error_report(VAR_0, \"unknown error matching the VAR_1 key with known_hosts (%d)\",\nVAR_7);", "goto out;", "}", "VAR_6 = 0;", "out:\nif (knh != NULL) {", "libssh2_knownhost_free(knh);", "}", "g_free(VAR_4);", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 69 ], [ 73, 75, 77, 79 ], [ 81 ], [ 83, 87 ], [ 89 ], [ 91, 93 ], [ 95, 97 ], [ 99 ], [ 101, 103 ], [ 105 ], [ 107 ], [ 109, 111 ], [ 113 ], [ 115 ], [ 117, 119 ], [ 121, 123 ], [ 125 ], [ 127 ], [ 133 ], [ 137, 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ] ]
5,885
static void numa_add(const char *optarg) { char option[128]; char *endptr; unsigned long long value, endvalue; int nodenr; optarg = get_opt_name(option, 128, optarg, ',') + 1; if (!strcmp(option, "node")) { if (get_param_value(option, 128, "nodeid", optarg) == 0) { nodenr = nb_numa_nodes; } else { nodenr = strtoull(option, NULL, 10); } if (get_param_value(option, 128, "mem", optarg) == 0) { node_mem[nodenr] = 0; } else { int64_t sval; sval = strtosz(option, &endptr); if (sval < 0 || *endptr) { fprintf(stderr, "qemu: invalid numa mem size: %s\n", optarg); exit(1); } node_mem[nodenr] = sval; } if (get_param_value(option, 128, "cpus", optarg) == 0) { node_cpumask[nodenr] = 0; } else { value = strtoull(option, &endptr, 10); if (value >= 64) { value = 63; fprintf(stderr, "only 64 CPUs in NUMA mode supported.\n"); } else { if (*endptr == '-') { endvalue = strtoull(endptr+1, &endptr, 10); if (endvalue >= 63) { endvalue = 62; fprintf(stderr, "only 63 CPUs in NUMA mode supported.\n"); } value = (2ULL << endvalue) - (1ULL << value); } else { value = 1ULL << value; } } node_cpumask[nodenr] = value; } nb_numa_nodes++; } return; }
false
qemu
ee785fed5dd035d4b12142cacec6d3c344426dec
static void numa_add(const char *optarg) { char option[128]; char *endptr; unsigned long long value, endvalue; int nodenr; optarg = get_opt_name(option, 128, optarg, ',') + 1; if (!strcmp(option, "node")) { if (get_param_value(option, 128, "nodeid", optarg) == 0) { nodenr = nb_numa_nodes; } else { nodenr = strtoull(option, NULL, 10); } if (get_param_value(option, 128, "mem", optarg) == 0) { node_mem[nodenr] = 0; } else { int64_t sval; sval = strtosz(option, &endptr); if (sval < 0 || *endptr) { fprintf(stderr, "qemu: invalid numa mem size: %s\n", optarg); exit(1); } node_mem[nodenr] = sval; } if (get_param_value(option, 128, "cpus", optarg) == 0) { node_cpumask[nodenr] = 0; } else { value = strtoull(option, &endptr, 10); if (value >= 64) { value = 63; fprintf(stderr, "only 64 CPUs in NUMA mode supported.\n"); } else { if (*endptr == '-') { endvalue = strtoull(endptr+1, &endptr, 10); if (endvalue >= 63) { endvalue = 62; fprintf(stderr, "only 63 CPUs in NUMA mode supported.\n"); } value = (2ULL << endvalue) - (1ULL << value); } else { value = 1ULL << value; } } node_cpumask[nodenr] = value; } nb_numa_nodes++; } return; }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0) { char VAR_1[128]; char *VAR_2; unsigned long long VAR_3, VAR_4; int VAR_5; VAR_0 = get_opt_name(VAR_1, 128, VAR_0, ',') + 1; if (!strcmp(VAR_1, "node")) { if (get_param_value(VAR_1, 128, "nodeid", VAR_0) == 0) { VAR_5 = nb_numa_nodes; } else { VAR_5 = strtoull(VAR_1, NULL, 10); } if (get_param_value(VAR_1, 128, "mem", VAR_0) == 0) { node_mem[VAR_5] = 0; } else { int64_t sval; sval = strtosz(VAR_1, &VAR_2); if (sval < 0 || *VAR_2) { fprintf(stderr, "qemu: invalid numa mem size: %s\n", VAR_0); exit(1); } node_mem[VAR_5] = sval; } if (get_param_value(VAR_1, 128, "cpus", VAR_0) == 0) { node_cpumask[VAR_5] = 0; } else { VAR_3 = strtoull(VAR_1, &VAR_2, 10); if (VAR_3 >= 64) { VAR_3 = 63; fprintf(stderr, "only 64 CPUs in NUMA mode supported.\n"); } else { if (*VAR_2 == '-') { VAR_4 = strtoull(VAR_2+1, &VAR_2, 10); if (VAR_4 >= 63) { VAR_4 = 62; fprintf(stderr, "only 63 CPUs in NUMA mode supported.\n"); } VAR_3 = (2ULL << VAR_4) - (1ULL << VAR_3); } else { VAR_3 = 1ULL << VAR_3; } } node_cpumask[VAR_5] = VAR_3; } nb_numa_nodes++; } return; }
[ "static void FUNC_0(const char *VAR_0)\n{", "char VAR_1[128];", "char *VAR_2;", "unsigned long long VAR_3, VAR_4;", "int VAR_5;", "VAR_0 = get_opt_name(VAR_1, 128, VAR_0, ',') + 1;", "if (!strcmp(VAR_1, \"node\")) {", "if (get_param_value(VAR_1, 128, \"nodeid\", VAR_0) == 0) {", "VAR_5 = nb_numa_nodes;", "} else {", "VAR_5 = strtoull(VAR_1, NULL, 10);", "}", "if (get_param_value(VAR_1, 128, \"mem\", VAR_0) == 0) {", "node_mem[VAR_5] = 0;", "} else {", "int64_t sval;", "sval = strtosz(VAR_1, &VAR_2);", "if (sval < 0 || *VAR_2) {", "fprintf(stderr, \"qemu: invalid numa mem size: %s\\n\", VAR_0);", "exit(1);", "}", "node_mem[VAR_5] = sval;", "}", "if (get_param_value(VAR_1, 128, \"cpus\", VAR_0) == 0) {", "node_cpumask[VAR_5] = 0;", "} else {", "VAR_3 = strtoull(VAR_1, &VAR_2, 10);", "if (VAR_3 >= 64) {", "VAR_3 = 63;", "fprintf(stderr, \"only 64 CPUs in NUMA mode supported.\\n\");", "} else {", "if (*VAR_2 == '-') {", "VAR_4 = strtoull(VAR_2+1, &VAR_2, 10);", "if (VAR_4 >= 63) {", "VAR_4 = 62;", "fprintf(stderr,\n\"only 63 CPUs in NUMA mode supported.\\n\");", "}", "VAR_3 = (2ULL << VAR_4) - (1ULL << VAR_3);", "} else {", "VAR_3 = 1ULL << VAR_3;", "}", "}", "node_cpumask[VAR_5] = VAR_3;", "}", "nb_numa_nodes++;", "}", "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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 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, 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ] ]
5,886
static uint32_t rtas_set_dr_indicator(uint32_t idx, uint32_t state) { sPAPRDRConnector *drc = spapr_drc_by_index(idx); if (!drc) { return RTAS_OUT_PARAM_ERROR; } trace_spapr_drc_set_dr_indicator(idx, state); drc->dr_indicator = state; return RTAS_OUT_SUCCESS; }
false
qemu
67fea71bf3be579ad0be5abe34cd6fa1bc65ad5b
static uint32_t rtas_set_dr_indicator(uint32_t idx, uint32_t state) { sPAPRDRConnector *drc = spapr_drc_by_index(idx); if (!drc) { return RTAS_OUT_PARAM_ERROR; } trace_spapr_drc_set_dr_indicator(idx, state); drc->dr_indicator = state; return RTAS_OUT_SUCCESS; }
{ "code": [], "line_no": [] }
static uint32_t FUNC_0(uint32_t idx, uint32_t state) { sPAPRDRConnector *drc = spapr_drc_by_index(idx); if (!drc) { return RTAS_OUT_PARAM_ERROR; } trace_spapr_drc_set_dr_indicator(idx, state); drc->dr_indicator = state; return RTAS_OUT_SUCCESS; }
[ "static uint32_t FUNC_0(uint32_t idx, uint32_t state)\n{", "sPAPRDRConnector *drc = spapr_drc_by_index(idx);", "if (!drc) {", "return RTAS_OUT_PARAM_ERROR;", "}", "trace_spapr_drc_set_dr_indicator(idx, state);", "drc->dr_indicator = state;", "return RTAS_OUT_SUCCESS;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ] ]
5,888
static void unplug_disks(PCIBus *b, PCIDevice *d, void *o) { /* We have to ignore passthrough devices */ if (!strcmp(d->name, "xen-pci-passthrough")) { return; } switch (pci_get_word(d->config + PCI_CLASS_DEVICE)) { case PCI_CLASS_STORAGE_IDE: pci_piix3_xen_ide_unplug(DEVICE(d)); break; case PCI_CLASS_STORAGE_SCSI: case PCI_CLASS_STORAGE_EXPRESS: object_unparent(OBJECT(d)); break; default: break; } }
false
qemu
ae4d2eb273b167dad748ea4249720319240b1ac2
static void unplug_disks(PCIBus *b, PCIDevice *d, void *o) { if (!strcmp(d->name, "xen-pci-passthrough")) { return; } switch (pci_get_word(d->config + PCI_CLASS_DEVICE)) { case PCI_CLASS_STORAGE_IDE: pci_piix3_xen_ide_unplug(DEVICE(d)); break; case PCI_CLASS_STORAGE_SCSI: case PCI_CLASS_STORAGE_EXPRESS: object_unparent(OBJECT(d)); break; default: break; } }
{ "code": [], "line_no": [] }
static void FUNC_0(PCIBus *VAR_0, PCIDevice *VAR_1, void *VAR_2) { if (!strcmp(VAR_1->name, "xen-pci-passthrough")) { return; } switch (pci_get_word(VAR_1->config + PCI_CLASS_DEVICE)) { case PCI_CLASS_STORAGE_IDE: pci_piix3_xen_ide_unplug(DEVICE(VAR_1)); break; case PCI_CLASS_STORAGE_SCSI: case PCI_CLASS_STORAGE_EXPRESS: object_unparent(OBJECT(VAR_1)); break; default: break; } }
[ "static void FUNC_0(PCIBus *VAR_0, PCIDevice *VAR_1, void *VAR_2)\n{", "if (!strcmp(VAR_1->name, \"xen-pci-passthrough\")) {", "return;", "}", "switch (pci_get_word(VAR_1->config + PCI_CLASS_DEVICE)) {", "case PCI_CLASS_STORAGE_IDE:\npci_piix3_xen_ide_unplug(DEVICE(VAR_1));", "break;", "case PCI_CLASS_STORAGE_SCSI:\ncase PCI_CLASS_STORAGE_EXPRESS:\nobject_unparent(OBJECT(VAR_1));", "break;", "default:\nbreak;", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 21 ], [ 25, 27, 29 ], [ 31 ], [ 35, 37 ], [ 39 ], [ 41 ] ]
5,889
static void monitor_start_input(void) { readline_start("(qemu) ", 0, monitor_handle_command1, NULL); }
false
qemu
396f929762d10ba2c7b38f7e8a2276dd066be2d7
static void monitor_start_input(void) { readline_start("(qemu) ", 0, monitor_handle_command1, NULL); }
{ "code": [], "line_no": [] }
static void FUNC_0(void) { readline_start("(qemu) ", 0, monitor_handle_command1, NULL); }
[ "static void FUNC_0(void)\n{", "readline_start(\"(qemu) \", 0, monitor_handle_command1, NULL);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
5,890
MKSCALE16(scale16be, AV_RB16, AV_WB16) MKSCALE16(scale16le, AV_RL16, AV_WL16) static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const AVPixFmtDescriptor *desc; RawVideoContext *context = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int linesize_align = 4; int stride; int res, len; int need_copy; AVFrame *frame = data; if (avctx->width <= 0) { av_log(avctx, AV_LOG_ERROR, "width is not set\n"); return AVERROR_INVALIDDATA; } if (avctx->height <= 0) { av_log(avctx, AV_LOG_ERROR, "height is not set\n"); return AVERROR_INVALIDDATA; } if (context->is_nut_mono) stride = avctx->width / 8 + (avctx->width & 7 ? 1 : 0); else if (context->is_nut_pal8) stride = avctx->width; else stride = avpkt->size / avctx->height; av_log(avctx, AV_LOG_DEBUG, "PACKET SIZE: %d, STRIDE: %d\n", avpkt->size, stride); if (stride == 0 || avpkt->size < stride * avctx->height) { av_log(avctx, AV_LOG_ERROR, "Packet too small (%d)\n", avpkt->size); return AVERROR_INVALIDDATA; } desc = av_pix_fmt_desc_get(avctx->pix_fmt); if ((avctx->bits_per_coded_sample == 8 || avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2 || avctx->bits_per_coded_sample == 1 || (avctx->bits_per_coded_sample == 0 && (context->is_nut_pal8 || context->is_mono)) ) && (context->is_mono || context->is_pal8) && (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' ') || context->is_nut_mono || context->is_nut_pal8)) { context->is_1_2_4_8_bpp = 1; if (context->is_mono) { int row_bytes = avctx->width / 8 + (avctx->width & 7 ? 1 : 0); context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(row_bytes, 16) * 8, avctx->height, 1); } else context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->width, 16), avctx->height, 1); } else { context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16; context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1); } if (context->frame_size < 0) return context->frame_size; need_copy = !avpkt->buf || context->is_1_2_4_8_bpp || context->is_yuv2 || context->is_lt_16bpp; frame->pict_type = AV_PICTURE_TYPE_I; frame->key_frame = 1; res = ff_decode_frame_props(avctx, frame); if (res < 0) return res; av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos); av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration); if (context->tff >= 0) { frame->interlaced_frame = 1; frame->top_field_first = context->tff; } if ((res = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0) return res; if (need_copy) frame->buf[0] = av_buffer_alloc(FFMAX(context->frame_size, buf_size)); else frame->buf[0] = av_buffer_ref(avpkt->buf); if (!frame->buf[0]) return AVERROR(ENOMEM); // 1, 2, 4 and 8 bpp in avi/mov, 1 and 8 bpp in nut if (context->is_1_2_4_8_bpp) { int i, j, row_pix = 0; uint8_t *dst = frame->buf[0]->data; buf_size = context->frame_size - (context->is_pal8 ? AVPALETTE_SIZE : 0); if (avctx->bits_per_coded_sample == 8 || context->is_nut_pal8 || context->is_mono) { int pix_per_byte = context->is_mono ? 8 : 1; for (i = 0, j = 0; j < buf_size && i<avpkt->size; i++, j++) { dst[j] = buf[i]; row_pix += pix_per_byte; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 16 - (j % 16) - 1; row_pix = 0; } } } else if (avctx->bits_per_coded_sample == 4) { for (i = 0, j = 0; 2 * j + 1 < buf_size && i<avpkt->size; i++, j++) { dst[2 * j + 0] = buf[i] >> 4; dst[2 * j + 1] = buf[i] & 15; row_pix += 2; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 8 - (j % 8) - 1; row_pix = 0; } } } else if (avctx->bits_per_coded_sample == 2) { for (i = 0, j = 0; 4 * j + 3 < buf_size && i<avpkt->size; i++, j++) { dst[4 * j + 0] = buf[i] >> 6; dst[4 * j + 1] = buf[i] >> 4 & 3; dst[4 * j + 2] = buf[i] >> 2 & 3; dst[4 * j + 3] = buf[i] & 3; row_pix += 4; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 4 - (j % 4) - 1; row_pix = 0; } } } else { av_assert0(avctx->bits_per_coded_sample == 1); for (i = 0, j = 0; 8 * j + 7 < buf_size && i<avpkt->size; i++, j++) { dst[8 * j + 0] = buf[i] >> 7; dst[8 * j + 1] = buf[i] >> 6 & 1; dst[8 * j + 2] = buf[i] >> 5 & 1; dst[8 * j + 3] = buf[i] >> 4 & 1; dst[8 * j + 4] = buf[i] >> 3 & 1; dst[8 * j + 5] = buf[i] >> 2 & 1; dst[8 * j + 6] = buf[i] >> 1 & 1; dst[8 * j + 7] = buf[i] & 1; row_pix += 8; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 2 - (j % 2) - 1; row_pix = 0; } } } linesize_align = 16; buf = dst; } else if (context->is_lt_16bpp) { uint8_t *dst = frame->buf[0]->data; int packed = (avctx->codec_tag & 0xFFFFFF) == MKTAG('B','I','T', 0); int swap = avctx->codec_tag >> 24; if (packed && swap) { av_fast_padded_malloc(&context->bitstream_buf, &context->bitstream_buf_size, buf_size); if (!context->bitstream_buf) return AVERROR(ENOMEM); if (swap == 16) context->bbdsp.bswap16_buf(context->bitstream_buf, (const uint16_t*)buf, buf_size / 2); else if (swap == 32) context->bbdsp.bswap_buf(context->bitstream_buf, (const uint32_t*)buf, buf_size / 4); else return AVERROR_INVALIDDATA; buf = context->bitstream_buf; } if (desc->flags & AV_PIX_FMT_FLAG_BE) scale16be(avctx, dst, buf, buf_size, packed); else scale16le(avctx, dst, buf, buf_size, packed); buf = dst; } else if (need_copy) { memcpy(frame->buf[0]->data, buf, buf_size); buf = frame->buf[0]->data; } if (avctx->codec_tag == MKTAG('A', 'V', '1', 'x') || avctx->codec_tag == MKTAG('A', 'V', 'u', 'p')) buf += buf_size - context->frame_size; len = context->frame_size - (avctx->pix_fmt==AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0); if (buf_size < len && ((avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0) || !need_copy)) { av_log(avctx, AV_LOG_ERROR, "Invalid buffer size, packet size %d < expected frame_size %d\n", buf_size, len); av_buffer_unref(&frame->buf[0]); return AVERROR(EINVAL); } if ((res = av_image_fill_arrays(frame->data, frame->linesize, buf, avctx->pix_fmt, avctx->width, avctx->height, 1)) < 0) { av_buffer_unref(&frame->buf[0]); return res; } if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); int ret; if (!context->palette) context->palette = av_buffer_alloc(AVPALETTE_SIZE); if (!context->palette) { av_buffer_unref(&frame->buf[0]); return AVERROR(ENOMEM); } ret = av_buffer_make_writable(&context->palette); if (ret < 0) { av_buffer_unref(&frame->buf[0]); return ret; } if (pal) { memcpy(context->palette->data, pal, AVPALETTE_SIZE); frame->palette_has_changed = 1; } else if (context->is_nut_pal8) { int vid_size = avctx->width * avctx->height; int pal_size = avpkt->size - vid_size; if (avpkt->size > vid_size && pal_size <= AVPALETTE_SIZE) { pal = avpkt->data + vid_size; memcpy(context->palette->data, pal, pal_size); frame->palette_has_changed = 1; } } } if ((avctx->pix_fmt==AV_PIX_FMT_RGB24 || avctx->pix_fmt==AV_PIX_FMT_BGR24 || avctx->pix_fmt==AV_PIX_FMT_GRAY8 || avctx->pix_fmt==AV_PIX_FMT_RGB555LE || avctx->pix_fmt==AV_PIX_FMT_RGB555BE || avctx->pix_fmt==AV_PIX_FMT_RGB565LE || avctx->pix_fmt==AV_PIX_FMT_MONOWHITE || avctx->pix_fmt==AV_PIX_FMT_MONOBLACK || avctx->pix_fmt==AV_PIX_FMT_PAL8) && FFALIGN(frame->linesize[0], linesize_align) * avctx->height <= buf_size) frame->linesize[0] = FFALIGN(frame->linesize[0], linesize_align); if (avctx->pix_fmt == AV_PIX_FMT_NV12 && avctx->codec_tag == MKTAG('N', 'V', '1', '2') && FFALIGN(frame->linesize[0], linesize_align) * avctx->height + FFALIGN(frame->linesize[1], linesize_align) * ((avctx->height + 1) / 2) <= buf_size) { int la0 = FFALIGN(frame->linesize[0], linesize_align); frame->data[1] += (la0 - frame->linesize[0]) * avctx->height; frame->linesize[0] = la0; frame->linesize[1] = FFALIGN(frame->linesize[1], linesize_align); } if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) || (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) { frame->buf[1] = av_buffer_ref(context->palette); if (!frame->buf[1]) { av_buffer_unref(&frame->buf[0]); return AVERROR(ENOMEM); } frame->data[1] = frame->buf[1]->data; } if (avctx->pix_fmt == AV_PIX_FMT_BGR24 && ((frame->linesize[0] + 3) & ~3) * avctx->height <= buf_size) frame->linesize[0] = (frame->linesize[0] + 3) & ~3; if (context->flip) flip(avctx, frame); if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2') || avctx->codec_tag == MKTAG('Y', 'V', '1', '6') || avctx->codec_tag == MKTAG('Y', 'V', '2', '4') || avctx->codec_tag == MKTAG('Y', 'V', 'U', '9')) FFSWAP(uint8_t *, frame->data[1], frame->data[2]); if (avctx->codec_tag == AV_RL32("I420") && (avctx->width+1)*(avctx->height+1) * 3/2 == buf_size) { frame->data[1] = frame->data[1] + (avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height; frame->data[2] = frame->data[2] + ((avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height)*5/4; } if (avctx->codec_tag == AV_RL32("yuv2") && avctx->pix_fmt == AV_PIX_FMT_YUYV422) { int x, y; uint8_t *line = frame->data[0]; for (y = 0; y < avctx->height; y++) { for (x = 0; x < avctx->width; x++) line[2 * x + 1] ^= 0x80; line += frame->linesize[0]; } } if (avctx->codec_tag == AV_RL32("b64a") && avctx->pix_fmt == AV_PIX_FMT_RGBA64BE) { uint8_t *dst = frame->data[0]; uint64_t v; int x; for (x = 0; x >> 3 < avctx->width * avctx->height; x += 8) { v = AV_RB64(&dst[x]); AV_WB64(&dst[x], v << 16 | v >> 48); } } if (avctx->field_order > AV_FIELD_PROGRESSIVE) { /* we have interlaced material flagged in container */ frame->interlaced_frame = 1; if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB) frame->top_field_first = 1; } *got_frame = 1; return buf_size; }
false
FFmpeg
5f0bc0215a0f7099a2bcba5dced2e045e70fee61
MKSCALE16(scale16be, AV_RB16, AV_WB16) MKSCALE16(scale16le, AV_RL16, AV_WL16) static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const AVPixFmtDescriptor *desc; RawVideoContext *context = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int linesize_align = 4; int stride; int res, len; int need_copy; AVFrame *frame = data; if (avctx->width <= 0) { av_log(avctx, AV_LOG_ERROR, "width is not set\n"); return AVERROR_INVALIDDATA; } if (avctx->height <= 0) { av_log(avctx, AV_LOG_ERROR, "height is not set\n"); return AVERROR_INVALIDDATA; } if (context->is_nut_mono) stride = avctx->width / 8 + (avctx->width & 7 ? 1 : 0); else if (context->is_nut_pal8) stride = avctx->width; else stride = avpkt->size / avctx->height; av_log(avctx, AV_LOG_DEBUG, "PACKET SIZE: %d, STRIDE: %d\n", avpkt->size, stride); if (stride == 0 || avpkt->size < stride * avctx->height) { av_log(avctx, AV_LOG_ERROR, "Packet too small (%d)\n", avpkt->size); return AVERROR_INVALIDDATA; } desc = av_pix_fmt_desc_get(avctx->pix_fmt); if ((avctx->bits_per_coded_sample == 8 || avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2 || avctx->bits_per_coded_sample == 1 || (avctx->bits_per_coded_sample == 0 && (context->is_nut_pal8 || context->is_mono)) ) && (context->is_mono || context->is_pal8) && (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' ') || context->is_nut_mono || context->is_nut_pal8)) { context->is_1_2_4_8_bpp = 1; if (context->is_mono) { int row_bytes = avctx->width / 8 + (avctx->width & 7 ? 1 : 0); context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(row_bytes, 16) * 8, avctx->height, 1); } else context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->width, 16), avctx->height, 1); } else { context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16; context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1); } if (context->frame_size < 0) return context->frame_size; need_copy = !avpkt->buf || context->is_1_2_4_8_bpp || context->is_yuv2 || context->is_lt_16bpp; frame->pict_type = AV_PICTURE_TYPE_I; frame->key_frame = 1; res = ff_decode_frame_props(avctx, frame); if (res < 0) return res; av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos); av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration); if (context->tff >= 0) { frame->interlaced_frame = 1; frame->top_field_first = context->tff; } if ((res = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0) return res; if (need_copy) frame->buf[0] = av_buffer_alloc(FFMAX(context->frame_size, buf_size)); else frame->buf[0] = av_buffer_ref(avpkt->buf); if (!frame->buf[0]) return AVERROR(ENOMEM); if (context->is_1_2_4_8_bpp) { int i, j, row_pix = 0; uint8_t *dst = frame->buf[0]->data; buf_size = context->frame_size - (context->is_pal8 ? AVPALETTE_SIZE : 0); if (avctx->bits_per_coded_sample == 8 || context->is_nut_pal8 || context->is_mono) { int pix_per_byte = context->is_mono ? 8 : 1; for (i = 0, j = 0; j < buf_size && i<avpkt->size; i++, j++) { dst[j] = buf[i]; row_pix += pix_per_byte; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 16 - (j % 16) - 1; row_pix = 0; } } } else if (avctx->bits_per_coded_sample == 4) { for (i = 0, j = 0; 2 * j + 1 < buf_size && i<avpkt->size; i++, j++) { dst[2 * j + 0] = buf[i] >> 4; dst[2 * j + 1] = buf[i] & 15; row_pix += 2; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 8 - (j % 8) - 1; row_pix = 0; } } } else if (avctx->bits_per_coded_sample == 2) { for (i = 0, j = 0; 4 * j + 3 < buf_size && i<avpkt->size; i++, j++) { dst[4 * j + 0] = buf[i] >> 6; dst[4 * j + 1] = buf[i] >> 4 & 3; dst[4 * j + 2] = buf[i] >> 2 & 3; dst[4 * j + 3] = buf[i] & 3; row_pix += 4; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 4 - (j % 4) - 1; row_pix = 0; } } } else { av_assert0(avctx->bits_per_coded_sample == 1); for (i = 0, j = 0; 8 * j + 7 < buf_size && i<avpkt->size; i++, j++) { dst[8 * j + 0] = buf[i] >> 7; dst[8 * j + 1] = buf[i] >> 6 & 1; dst[8 * j + 2] = buf[i] >> 5 & 1; dst[8 * j + 3] = buf[i] >> 4 & 1; dst[8 * j + 4] = buf[i] >> 3 & 1; dst[8 * j + 5] = buf[i] >> 2 & 1; dst[8 * j + 6] = buf[i] >> 1 & 1; dst[8 * j + 7] = buf[i] & 1; row_pix += 8; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 2 - (j % 2) - 1; row_pix = 0; } } } linesize_align = 16; buf = dst; } else if (context->is_lt_16bpp) { uint8_t *dst = frame->buf[0]->data; int packed = (avctx->codec_tag & 0xFFFFFF) == MKTAG('B','I','T', 0); int swap = avctx->codec_tag >> 24; if (packed && swap) { av_fast_padded_malloc(&context->bitstream_buf, &context->bitstream_buf_size, buf_size); if (!context->bitstream_buf) return AVERROR(ENOMEM); if (swap == 16) context->bbdsp.bswap16_buf(context->bitstream_buf, (const uint16_t*)buf, buf_size / 2); else if (swap == 32) context->bbdsp.bswap_buf(context->bitstream_buf, (const uint32_t*)buf, buf_size / 4); else return AVERROR_INVALIDDATA; buf = context->bitstream_buf; } if (desc->flags & AV_PIX_FMT_FLAG_BE) scale16be(avctx, dst, buf, buf_size, packed); else scale16le(avctx, dst, buf, buf_size, packed); buf = dst; } else if (need_copy) { memcpy(frame->buf[0]->data, buf, buf_size); buf = frame->buf[0]->data; } if (avctx->codec_tag == MKTAG('A', 'V', '1', 'x') || avctx->codec_tag == MKTAG('A', 'V', 'u', 'p')) buf += buf_size - context->frame_size; len = context->frame_size - (avctx->pix_fmt==AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0); if (buf_size < len && ((avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0) || !need_copy)) { av_log(avctx, AV_LOG_ERROR, "Invalid buffer size, packet size %d < expected frame_size %d\n", buf_size, len); av_buffer_unref(&frame->buf[0]); return AVERROR(EINVAL); } if ((res = av_image_fill_arrays(frame->data, frame->linesize, buf, avctx->pix_fmt, avctx->width, avctx->height, 1)) < 0) { av_buffer_unref(&frame->buf[0]); return res; } if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); int ret; if (!context->palette) context->palette = av_buffer_alloc(AVPALETTE_SIZE); if (!context->palette) { av_buffer_unref(&frame->buf[0]); return AVERROR(ENOMEM); } ret = av_buffer_make_writable(&context->palette); if (ret < 0) { av_buffer_unref(&frame->buf[0]); return ret; } if (pal) { memcpy(context->palette->data, pal, AVPALETTE_SIZE); frame->palette_has_changed = 1; } else if (context->is_nut_pal8) { int vid_size = avctx->width * avctx->height; int pal_size = avpkt->size - vid_size; if (avpkt->size > vid_size && pal_size <= AVPALETTE_SIZE) { pal = avpkt->data + vid_size; memcpy(context->palette->data, pal, pal_size); frame->palette_has_changed = 1; } } } if ((avctx->pix_fmt==AV_PIX_FMT_RGB24 || avctx->pix_fmt==AV_PIX_FMT_BGR24 || avctx->pix_fmt==AV_PIX_FMT_GRAY8 || avctx->pix_fmt==AV_PIX_FMT_RGB555LE || avctx->pix_fmt==AV_PIX_FMT_RGB555BE || avctx->pix_fmt==AV_PIX_FMT_RGB565LE || avctx->pix_fmt==AV_PIX_FMT_MONOWHITE || avctx->pix_fmt==AV_PIX_FMT_MONOBLACK || avctx->pix_fmt==AV_PIX_FMT_PAL8) && FFALIGN(frame->linesize[0], linesize_align) * avctx->height <= buf_size) frame->linesize[0] = FFALIGN(frame->linesize[0], linesize_align); if (avctx->pix_fmt == AV_PIX_FMT_NV12 && avctx->codec_tag == MKTAG('N', 'V', '1', '2') && FFALIGN(frame->linesize[0], linesize_align) * avctx->height + FFALIGN(frame->linesize[1], linesize_align) * ((avctx->height + 1) / 2) <= buf_size) { int la0 = FFALIGN(frame->linesize[0], linesize_align); frame->data[1] += (la0 - frame->linesize[0]) * avctx->height; frame->linesize[0] = la0; frame->linesize[1] = FFALIGN(frame->linesize[1], linesize_align); } if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) || (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) { frame->buf[1] = av_buffer_ref(context->palette); if (!frame->buf[1]) { av_buffer_unref(&frame->buf[0]); return AVERROR(ENOMEM); } frame->data[1] = frame->buf[1]->data; } if (avctx->pix_fmt == AV_PIX_FMT_BGR24 && ((frame->linesize[0] + 3) & ~3) * avctx->height <= buf_size) frame->linesize[0] = (frame->linesize[0] + 3) & ~3; if (context->flip) flip(avctx, frame); if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2') || avctx->codec_tag == MKTAG('Y', 'V', '1', '6') || avctx->codec_tag == MKTAG('Y', 'V', '2', '4') || avctx->codec_tag == MKTAG('Y', 'V', 'U', '9')) FFSWAP(uint8_t *, frame->data[1], frame->data[2]); if (avctx->codec_tag == AV_RL32("I420") && (avctx->width+1)*(avctx->height+1) * 3/2 == buf_size) { frame->data[1] = frame->data[1] + (avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height; frame->data[2] = frame->data[2] + ((avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height)*5/4; } if (avctx->codec_tag == AV_RL32("yuv2") && avctx->pix_fmt == AV_PIX_FMT_YUYV422) { int x, y; uint8_t *line = frame->data[0]; for (y = 0; y < avctx->height; y++) { for (x = 0; x < avctx->width; x++) line[2 * x + 1] ^= 0x80; line += frame->linesize[0]; } } if (avctx->codec_tag == AV_RL32("b64a") && avctx->pix_fmt == AV_PIX_FMT_RGBA64BE) { uint8_t *dst = frame->data[0]; uint64_t v; int x; for (x = 0; x >> 3 < avctx->width * avctx->height; x += 8) { v = AV_RB64(&dst[x]); AV_WB64(&dst[x], v << 16 | v >> 48); } } if (avctx->field_order > AV_FIELD_PROGRESSIVE) { frame->interlaced_frame = 1; if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB) frame->top_field_first = 1; } *got_frame = 1; return buf_size; }
{ "code": [], "line_no": [] }
MKSCALE16(scale16be, AV_RB16, AV_WB16) MKSCALE16(scale16le, AV_RL16, AV_WL16) static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const AVPixFmtDescriptor *desc; RawVideoContext *context = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; int linesize_align = 4; int stride; int res, len; int need_copy; AVFrame *frame = data; if (avctx->width <= 0) { av_log(avctx, AV_LOG_ERROR, "width is not set\n"); return AVERROR_INVALIDDATA; } if (avctx->height <= 0) { av_log(avctx, AV_LOG_ERROR, "height is not set\n"); return AVERROR_INVALIDDATA; } if (context->is_nut_mono) stride = avctx->width / 8 + (avctx->width & 7 ? 1 : 0); else if (context->is_nut_pal8) stride = avctx->width; else stride = avpkt->size / avctx->height; av_log(avctx, AV_LOG_DEBUG, "PACKET SIZE: %d, STRIDE: %d\n", avpkt->size, stride); if (stride == 0 || avpkt->size < stride * avctx->height) { av_log(avctx, AV_LOG_ERROR, "Packet too small (%d)\n", avpkt->size); return AVERROR_INVALIDDATA; } desc = av_pix_fmt_desc_get(avctx->pix_fmt); if ((avctx->bits_per_coded_sample == 8 || avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2 || avctx->bits_per_coded_sample == 1 || (avctx->bits_per_coded_sample == 0 && (context->is_nut_pal8 || context->is_mono)) ) && (context->is_mono || context->is_pal8) && (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' ') || context->is_nut_mono || context->is_nut_pal8)) { context->is_1_2_4_8_bpp = 1; if (context->is_mono) { int row_bytes = avctx->width / 8 + (avctx->width & 7 ? 1 : 0); context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(row_bytes, 16) * 8, avctx->height, 1); } else context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, FFALIGN(avctx->width, 16), avctx->height, 1); } else { context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16; context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1); } if (context->frame_size < 0) return context->frame_size; need_copy = !avpkt->buf || context->is_1_2_4_8_bpp || context->is_yuv2 || context->is_lt_16bpp; frame->pict_type = AV_PICTURE_TYPE_I; frame->key_frame = 1; res = ff_decode_frame_props(avctx, frame); if (res < 0) return res; av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos); av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration); if (context->tff >= 0) { frame->interlaced_frame = 1; frame->top_field_first = context->tff; } if ((res = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0) return res; if (need_copy) frame->buf[0] = av_buffer_alloc(FFMAX(context->frame_size, buf_size)); else frame->buf[0] = av_buffer_ref(avpkt->buf); if (!frame->buf[0]) return AVERROR(ENOMEM); if (context->is_1_2_4_8_bpp) { int i, j, row_pix = 0; uint8_t *dst = frame->buf[0]->data; buf_size = context->frame_size - (context->is_pal8 ? AVPALETTE_SIZE : 0); if (avctx->bits_per_coded_sample == 8 || context->is_nut_pal8 || context->is_mono) { int pix_per_byte = context->is_mono ? 8 : 1; for (i = 0, j = 0; j < buf_size && i<avpkt->size; i++, j++) { dst[j] = buf[i]; row_pix += pix_per_byte; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 16 - (j % 16) - 1; row_pix = 0; } } } else if (avctx->bits_per_coded_sample == 4) { for (i = 0, j = 0; 2 * j + 1 < buf_size && i<avpkt->size; i++, j++) { dst[2 * j + 0] = buf[i] >> 4; dst[2 * j + 1] = buf[i] & 15; row_pix += 2; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 8 - (j % 8) - 1; row_pix = 0; } } } else if (avctx->bits_per_coded_sample == 2) { for (i = 0, j = 0; 4 * j + 3 < buf_size && i<avpkt->size; i++, j++) { dst[4 * j + 0] = buf[i] >> 6; dst[4 * j + 1] = buf[i] >> 4 & 3; dst[4 * j + 2] = buf[i] >> 2 & 3; dst[4 * j + 3] = buf[i] & 3; row_pix += 4; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 4 - (j % 4) - 1; row_pix = 0; } } } else { av_assert0(avctx->bits_per_coded_sample == 1); for (i = 0, j = 0; 8 * j + 7 < buf_size && i<avpkt->size; i++, j++) { dst[8 * j + 0] = buf[i] >> 7; dst[8 * j + 1] = buf[i] >> 6 & 1; dst[8 * j + 2] = buf[i] >> 5 & 1; dst[8 * j + 3] = buf[i] >> 4 & 1; dst[8 * j + 4] = buf[i] >> 3 & 1; dst[8 * j + 5] = buf[i] >> 2 & 1; dst[8 * j + 6] = buf[i] >> 1 & 1; dst[8 * j + 7] = buf[i] & 1; row_pix += 8; if (row_pix >= avctx->width) { i += stride - (i % stride) - 1; j += 2 - (j % 2) - 1; row_pix = 0; } } } linesize_align = 16; buf = dst; } else if (context->is_lt_16bpp) { uint8_t *dst = frame->buf[0]->data; int packed = (avctx->codec_tag & 0xFFFFFF) == MKTAG('B','I','T', 0); int swap = avctx->codec_tag >> 24; if (packed && swap) { av_fast_padded_malloc(&context->bitstream_buf, &context->bitstream_buf_size, buf_size); if (!context->bitstream_buf) return AVERROR(ENOMEM); if (swap == 16) context->bbdsp.bswap16_buf(context->bitstream_buf, (const uint16_t*)buf, buf_size / 2); else if (swap == 32) context->bbdsp.bswap_buf(context->bitstream_buf, (const uint32_t*)buf, buf_size / 4); else return AVERROR_INVALIDDATA; buf = context->bitstream_buf; } if (desc->flags & AV_PIX_FMT_FLAG_BE) scale16be(avctx, dst, buf, buf_size, packed); else scale16le(avctx, dst, buf, buf_size, packed); buf = dst; } else if (need_copy) { memcpy(frame->buf[0]->data, buf, buf_size); buf = frame->buf[0]->data; } if (avctx->codec_tag == MKTAG('A', 'V', '1', 'x') || avctx->codec_tag == MKTAG('A', 'V', 'u', 'p')) buf += buf_size - context->frame_size; len = context->frame_size - (avctx->pix_fmt==AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0); if (buf_size < len && ((avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0) || !need_copy)) { av_log(avctx, AV_LOG_ERROR, "Invalid buffer size, packet size %d < expected frame_size %d\n", buf_size, len); av_buffer_unref(&frame->buf[0]); return AVERROR(EINVAL); } if ((res = av_image_fill_arrays(frame->data, frame->linesize, buf, avctx->pix_fmt, avctx->width, avctx->height, 1)) < 0) { av_buffer_unref(&frame->buf[0]); return res; } if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); int ret; if (!context->palette) context->palette = av_buffer_alloc(AVPALETTE_SIZE); if (!context->palette) { av_buffer_unref(&frame->buf[0]); return AVERROR(ENOMEM); } ret = av_buffer_make_writable(&context->palette); if (ret < 0) { av_buffer_unref(&frame->buf[0]); return ret; } if (pal) { memcpy(context->palette->data, pal, AVPALETTE_SIZE); frame->palette_has_changed = 1; } else if (context->is_nut_pal8) { int vid_size = avctx->width * avctx->height; int pal_size = avpkt->size - vid_size; if (avpkt->size > vid_size && pal_size <= AVPALETTE_SIZE) { pal = avpkt->data + vid_size; memcpy(context->palette->data, pal, pal_size); frame->palette_has_changed = 1; } } } if ((avctx->pix_fmt==AV_PIX_FMT_RGB24 || avctx->pix_fmt==AV_PIX_FMT_BGR24 || avctx->pix_fmt==AV_PIX_FMT_GRAY8 || avctx->pix_fmt==AV_PIX_FMT_RGB555LE || avctx->pix_fmt==AV_PIX_FMT_RGB555BE || avctx->pix_fmt==AV_PIX_FMT_RGB565LE || avctx->pix_fmt==AV_PIX_FMT_MONOWHITE || avctx->pix_fmt==AV_PIX_FMT_MONOBLACK || avctx->pix_fmt==AV_PIX_FMT_PAL8) && FFALIGN(frame->linesize[0], linesize_align) * avctx->height <= buf_size) frame->linesize[0] = FFALIGN(frame->linesize[0], linesize_align); if (avctx->pix_fmt == AV_PIX_FMT_NV12 && avctx->codec_tag == MKTAG('N', 'V', '1', '2') && FFALIGN(frame->linesize[0], linesize_align) * avctx->height + FFALIGN(frame->linesize[1], linesize_align) * ((avctx->height + 1) / 2) <= buf_size) { int la0 = FFALIGN(frame->linesize[0], linesize_align); frame->data[1] += (la0 - frame->linesize[0]) * avctx->height; frame->linesize[0] = la0; frame->linesize[1] = FFALIGN(frame->linesize[1], linesize_align); } if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) || (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) { frame->buf[1] = av_buffer_ref(context->palette); if (!frame->buf[1]) { av_buffer_unref(&frame->buf[0]); return AVERROR(ENOMEM); } frame->data[1] = frame->buf[1]->data; } if (avctx->pix_fmt == AV_PIX_FMT_BGR24 && ((frame->linesize[0] + 3) & ~3) * avctx->height <= buf_size) frame->linesize[0] = (frame->linesize[0] + 3) & ~3; if (context->flip) flip(avctx, frame); if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2') || avctx->codec_tag == MKTAG('Y', 'V', '1', '6') || avctx->codec_tag == MKTAG('Y', 'V', '2', '4') || avctx->codec_tag == MKTAG('Y', 'V', 'U', '9')) FFSWAP(uint8_t *, frame->data[1], frame->data[2]); if (avctx->codec_tag == AV_RL32("I420") && (avctx->width+1)*(avctx->height+1) * 3/2 == buf_size) { frame->data[1] = frame->data[1] + (avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height; frame->data[2] = frame->data[2] + ((avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height)*5/4; } if (avctx->codec_tag == AV_RL32("yuv2") && avctx->pix_fmt == AV_PIX_FMT_YUYV422) { int x, y; uint8_t *line = frame->data[0]; for (y = 0; y < avctx->height; y++) { for (x = 0; x < avctx->width; x++) line[2 * x + 1] ^= 0x80; line += frame->linesize[0]; } } if (avctx->codec_tag == AV_RL32("b64a") && avctx->pix_fmt == AV_PIX_FMT_RGBA64BE) { uint8_t *dst = frame->data[0]; uint64_t v; int x; for (x = 0; x >> 3 < avctx->width * avctx->height; x += 8) { v = AV_RB64(&dst[x]); AV_WB64(&dst[x], v << 16 | v >> 48); } } if (avctx->field_order > AV_FIELD_PROGRESSIVE) { frame->interlaced_frame = 1; if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB) frame->top_field_first = 1; } *got_frame = 1; return buf_size; }
[ "MKSCALE16(scale16be, AV_RB16, AV_WB16)\nMKSCALE16(scale16le, AV_RL16, AV_WL16)\nstatic int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,\nAVPacket *avpkt)\n{", "const AVPixFmtDescriptor *desc;", "RawVideoContext *context = avctx->priv_data;", "const uint8_t *buf = avpkt->data;", "int buf_size = avpkt->size;", "int linesize_align = 4;", "int stride;", "int res, len;", "int need_copy;", "AVFrame *frame = data;", "if (avctx->width <= 0) {", "av_log(avctx, AV_LOG_ERROR, \"width is not set\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (avctx->height <= 0) {", "av_log(avctx, AV_LOG_ERROR, \"height is not set\\n\");", "return AVERROR_INVALIDDATA;", "}", "if (context->is_nut_mono)\nstride = avctx->width / 8 + (avctx->width & 7 ? 1 : 0);", "else if (context->is_nut_pal8)\nstride = avctx->width;", "else\nstride = avpkt->size / avctx->height;", "av_log(avctx, AV_LOG_DEBUG, \"PACKET SIZE: %d, STRIDE: %d\\n\", avpkt->size, stride);", "if (stride == 0 || avpkt->size < stride * avctx->height) {", "av_log(avctx, AV_LOG_ERROR, \"Packet too small (%d)\\n\", avpkt->size);", "return AVERROR_INVALIDDATA;", "}", "desc = av_pix_fmt_desc_get(avctx->pix_fmt);", "if ((avctx->bits_per_coded_sample == 8 || avctx->bits_per_coded_sample == 4 ||\navctx->bits_per_coded_sample == 2 || avctx->bits_per_coded_sample == 1 ||\n(avctx->bits_per_coded_sample == 0 && (context->is_nut_pal8 || context->is_mono)) ) &&\n(context->is_mono || context->is_pal8) &&\n(!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' ') ||\ncontext->is_nut_mono || context->is_nut_pal8)) {", "context->is_1_2_4_8_bpp = 1;", "if (context->is_mono) {", "int row_bytes = avctx->width / 8 + (avctx->width & 7 ? 1 : 0);", "context->frame_size = av_image_get_buffer_size(avctx->pix_fmt,\nFFALIGN(row_bytes, 16) * 8,\navctx->height, 1);", "} else", "context->frame_size = av_image_get_buffer_size(avctx->pix_fmt,\nFFALIGN(avctx->width, 16),\navctx->height, 1);", "} else {", "context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16;", "context->frame_size = av_image_get_buffer_size(avctx->pix_fmt, avctx->width,\navctx->height, 1);", "}", "if (context->frame_size < 0)\nreturn context->frame_size;", "need_copy = !avpkt->buf || context->is_1_2_4_8_bpp || context->is_yuv2 || context->is_lt_16bpp;", "frame->pict_type = AV_PICTURE_TYPE_I;", "frame->key_frame = 1;", "res = ff_decode_frame_props(avctx, frame);", "if (res < 0)\nreturn res;", "av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos);", "av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration);", "if (context->tff >= 0) {", "frame->interlaced_frame = 1;", "frame->top_field_first = context->tff;", "}", "if ((res = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)\nreturn res;", "if (need_copy)\nframe->buf[0] = av_buffer_alloc(FFMAX(context->frame_size, buf_size));", "else\nframe->buf[0] = av_buffer_ref(avpkt->buf);", "if (!frame->buf[0])\nreturn AVERROR(ENOMEM);", "if (context->is_1_2_4_8_bpp) {", "int i, j, row_pix = 0;", "uint8_t *dst = frame->buf[0]->data;", "buf_size = context->frame_size - (context->is_pal8 ? AVPALETTE_SIZE : 0);", "if (avctx->bits_per_coded_sample == 8 || context->is_nut_pal8 || context->is_mono) {", "int pix_per_byte = context->is_mono ? 8 : 1;", "for (i = 0, j = 0; j < buf_size && i<avpkt->size; i++, j++) {", "dst[j] = buf[i];", "row_pix += pix_per_byte;", "if (row_pix >= avctx->width) {", "i += stride - (i % stride) - 1;", "j += 16 - (j % 16) - 1;", "row_pix = 0;", "}", "}", "} else if (avctx->bits_per_coded_sample == 4) {", "for (i = 0, j = 0; 2 * j + 1 < buf_size && i<avpkt->size; i++, j++) {", "dst[2 * j + 0] = buf[i] >> 4;", "dst[2 * j + 1] = buf[i] & 15;", "row_pix += 2;", "if (row_pix >= avctx->width) {", "i += stride - (i % stride) - 1;", "j += 8 - (j % 8) - 1;", "row_pix = 0;", "}", "}", "} else if (avctx->bits_per_coded_sample == 2) {", "for (i = 0, j = 0; 4 * j + 3 < buf_size && i<avpkt->size; i++, j++) {", "dst[4 * j + 0] = buf[i] >> 6;", "dst[4 * j + 1] = buf[i] >> 4 & 3;", "dst[4 * j + 2] = buf[i] >> 2 & 3;", "dst[4 * j + 3] = buf[i] & 3;", "row_pix += 4;", "if (row_pix >= avctx->width) {", "i += stride - (i % stride) - 1;", "j += 4 - (j % 4) - 1;", "row_pix = 0;", "}", "}", "} else {", "av_assert0(avctx->bits_per_coded_sample == 1);", "for (i = 0, j = 0; 8 * j + 7 < buf_size && i<avpkt->size; i++, j++) {", "dst[8 * j + 0] = buf[i] >> 7;", "dst[8 * j + 1] = buf[i] >> 6 & 1;", "dst[8 * j + 2] = buf[i] >> 5 & 1;", "dst[8 * j + 3] = buf[i] >> 4 & 1;", "dst[8 * j + 4] = buf[i] >> 3 & 1;", "dst[8 * j + 5] = buf[i] >> 2 & 1;", "dst[8 * j + 6] = buf[i] >> 1 & 1;", "dst[8 * j + 7] = buf[i] & 1;", "row_pix += 8;", "if (row_pix >= avctx->width) {", "i += stride - (i % stride) - 1;", "j += 2 - (j % 2) - 1;", "row_pix = 0;", "}", "}", "}", "linesize_align = 16;", "buf = dst;", "} else if (context->is_lt_16bpp) {", "uint8_t *dst = frame->buf[0]->data;", "int packed = (avctx->codec_tag & 0xFFFFFF) == MKTAG('B','I','T', 0);", "int swap = avctx->codec_tag >> 24;", "if (packed && swap) {", "av_fast_padded_malloc(&context->bitstream_buf, &context->bitstream_buf_size, buf_size);", "if (!context->bitstream_buf)\nreturn AVERROR(ENOMEM);", "if (swap == 16)\ncontext->bbdsp.bswap16_buf(context->bitstream_buf, (const uint16_t*)buf, buf_size / 2);", "else if (swap == 32)\ncontext->bbdsp.bswap_buf(context->bitstream_buf, (const uint32_t*)buf, buf_size / 4);", "else\nreturn AVERROR_INVALIDDATA;", "buf = context->bitstream_buf;", "}", "if (desc->flags & AV_PIX_FMT_FLAG_BE)\nscale16be(avctx, dst, buf, buf_size, packed);", "else\nscale16le(avctx, dst, buf, buf_size, packed);", "buf = dst;", "} else if (need_copy) {", "memcpy(frame->buf[0]->data, buf, buf_size);", "buf = frame->buf[0]->data;", "}", "if (avctx->codec_tag == MKTAG('A', 'V', '1', 'x') ||\navctx->codec_tag == MKTAG('A', 'V', 'u', 'p'))\nbuf += buf_size - context->frame_size;", "len = context->frame_size - (avctx->pix_fmt==AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0);", "if (buf_size < len && ((avctx->codec_tag & 0xFFFFFF) != MKTAG('B','I','T', 0) || !need_copy)) {", "av_log(avctx, AV_LOG_ERROR, \"Invalid buffer size, packet size %d < expected frame_size %d\\n\", buf_size, len);", "av_buffer_unref(&frame->buf[0]);", "return AVERROR(EINVAL);", "}", "if ((res = av_image_fill_arrays(frame->data, frame->linesize,\nbuf, avctx->pix_fmt,\navctx->width, avctx->height, 1)) < 0) {", "av_buffer_unref(&frame->buf[0]);", "return res;", "}", "if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {", "const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE,\nNULL);", "int ret;", "if (!context->palette)\ncontext->palette = av_buffer_alloc(AVPALETTE_SIZE);", "if (!context->palette) {", "av_buffer_unref(&frame->buf[0]);", "return AVERROR(ENOMEM);", "}", "ret = av_buffer_make_writable(&context->palette);", "if (ret < 0) {", "av_buffer_unref(&frame->buf[0]);", "return ret;", "}", "if (pal) {", "memcpy(context->palette->data, pal, AVPALETTE_SIZE);", "frame->palette_has_changed = 1;", "} else if (context->is_nut_pal8) {", "int vid_size = avctx->width * avctx->height;", "int pal_size = avpkt->size - vid_size;", "if (avpkt->size > vid_size && pal_size <= AVPALETTE_SIZE) {", "pal = avpkt->data + vid_size;", "memcpy(context->palette->data, pal, pal_size);", "frame->palette_has_changed = 1;", "}", "}", "}", "if ((avctx->pix_fmt==AV_PIX_FMT_RGB24 ||\navctx->pix_fmt==AV_PIX_FMT_BGR24 ||\navctx->pix_fmt==AV_PIX_FMT_GRAY8 ||\navctx->pix_fmt==AV_PIX_FMT_RGB555LE ||\navctx->pix_fmt==AV_PIX_FMT_RGB555BE ||\navctx->pix_fmt==AV_PIX_FMT_RGB565LE ||\navctx->pix_fmt==AV_PIX_FMT_MONOWHITE ||\navctx->pix_fmt==AV_PIX_FMT_MONOBLACK ||\navctx->pix_fmt==AV_PIX_FMT_PAL8) &&\nFFALIGN(frame->linesize[0], linesize_align) * avctx->height <= buf_size)\nframe->linesize[0] = FFALIGN(frame->linesize[0], linesize_align);", "if (avctx->pix_fmt == AV_PIX_FMT_NV12 && avctx->codec_tag == MKTAG('N', 'V', '1', '2') &&\nFFALIGN(frame->linesize[0], linesize_align) * avctx->height +\nFFALIGN(frame->linesize[1], linesize_align) * ((avctx->height + 1) / 2) <= buf_size) {", "int la0 = FFALIGN(frame->linesize[0], linesize_align);", "frame->data[1] += (la0 - frame->linesize[0]) * avctx->height;", "frame->linesize[0] = la0;", "frame->linesize[1] = FFALIGN(frame->linesize[1], linesize_align);", "}", "if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) ||\n(desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) {", "frame->buf[1] = av_buffer_ref(context->palette);", "if (!frame->buf[1]) {", "av_buffer_unref(&frame->buf[0]);", "return AVERROR(ENOMEM);", "}", "frame->data[1] = frame->buf[1]->data;", "}", "if (avctx->pix_fmt == AV_PIX_FMT_BGR24 &&\n((frame->linesize[0] + 3) & ~3) * avctx->height <= buf_size)\nframe->linesize[0] = (frame->linesize[0] + 3) & ~3;", "if (context->flip)\nflip(avctx, frame);", "if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2') ||\navctx->codec_tag == MKTAG('Y', 'V', '1', '6') ||\navctx->codec_tag == MKTAG('Y', 'V', '2', '4') ||\navctx->codec_tag == MKTAG('Y', 'V', 'U', '9'))\nFFSWAP(uint8_t *, frame->data[1], frame->data[2]);", "if (avctx->codec_tag == AV_RL32(\"I420\") && (avctx->width+1)*(avctx->height+1) * 3/2 == buf_size) {", "frame->data[1] = frame->data[1] + (avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height;", "frame->data[2] = frame->data[2] + ((avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height)*5/4;", "}", "if (avctx->codec_tag == AV_RL32(\"yuv2\") &&\navctx->pix_fmt == AV_PIX_FMT_YUYV422) {", "int x, y;", "uint8_t *line = frame->data[0];", "for (y = 0; y < avctx->height; y++) {", "for (x = 0; x < avctx->width; x++)", "line[2 * x + 1] ^= 0x80;", "line += frame->linesize[0];", "}", "}", "if (avctx->codec_tag == AV_RL32(\"b64a\") &&\navctx->pix_fmt == AV_PIX_FMT_RGBA64BE) {", "uint8_t *dst = frame->data[0];", "uint64_t v;", "int x;", "for (x = 0; x >> 3 < avctx->width * avctx->height; x += 8) {", "v = AV_RB64(&dst[x]);", "AV_WB64(&dst[x], v << 16 | v >> 48);", "}", "}", "if (avctx->field_order > AV_FIELD_PROGRESSIVE) {", "frame->interlaced_frame = 1;", "if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB)\nframe->top_field_first = 1;", "}", "*got_frame = 1;", "return buf_size;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 7, 9, 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 53, 55 ], [ 57, 59 ], [ 61, 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 81 ], [ 85, 87, 89, 91, 93, 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103, 105, 107 ], [ 109 ], [ 111, 113, 115 ], [ 117 ], [ 119 ], [ 121, 123 ], [ 125 ], [ 127, 129 ], [ 133 ], [ 137 ], [ 139 ], [ 143 ], [ 145, 147 ], [ 151 ], [ 153 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 167, 169 ], [ 173, 175 ], [ 177, 179 ], [ 181, 183 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ], [ 241 ], [ 243 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 259 ], [ 261 ], [ 263 ], [ 265 ], [ 267 ], [ 269 ], [ 271 ], [ 273 ], [ 275 ], [ 277 ], [ 279 ], [ 281 ], [ 283 ], [ 285 ], [ 287 ], [ 289 ], [ 291 ], [ 293 ], [ 295 ], [ 297 ], [ 299 ], [ 301 ], [ 303 ], [ 305 ], [ 307 ], [ 309 ], [ 311 ], [ 313 ], [ 315 ], [ 319 ], [ 321 ], [ 323, 325 ], [ 327, 329 ], [ 331, 333 ], [ 335, 337 ], [ 339 ], [ 341 ], [ 345, 347 ], [ 349, 351 ], [ 355 ], [ 357 ], [ 359 ], [ 361 ], [ 363 ], [ 367, 369, 371 ], [ 375 ], [ 377 ], [ 379 ], [ 381 ], [ 383 ], [ 385 ], [ 389, 391, 393 ], [ 395 ], [ 397 ], [ 399 ], [ 403 ], [ 405, 407 ], [ 409 ], [ 411, 413 ], [ 415 ], [ 417 ], [ 419 ], [ 421 ], [ 423 ], [ 425 ], [ 427 ], [ 429 ], [ 431 ], [ 435 ], [ 437 ], [ 439 ], [ 441 ], [ 443 ], [ 445 ], [ 449 ], [ 451 ], [ 453 ], [ 455 ], [ 457 ], [ 459 ], [ 461 ], [ 465, 467, 469, 471, 473, 475, 477, 479, 481, 483, 485 ], [ 489, 491, 493 ], [ 495 ], [ 497 ], [ 499 ], [ 501 ], [ 503 ], [ 507, 509 ], [ 511 ], [ 513 ], [ 515 ], [ 517 ], [ 519 ], [ 521 ], [ 523 ], [ 527, 529, 531 ], [ 535, 537 ], [ 541, 543, 545, 547, 549 ], [ 553 ], [ 555 ], [ 557 ], [ 559 ], [ 563, 565 ], [ 567 ], [ 569 ], [ 571 ], [ 573 ], [ 575 ], [ 577 ], [ 579 ], [ 581 ], [ 585, 587 ], [ 589 ], [ 591 ], [ 593 ], [ 595 ], [ 597 ], [ 599 ], [ 601 ], [ 603 ], [ 607 ], [ 609 ], [ 611, 613 ], [ 615 ], [ 619 ], [ 621 ], [ 623 ] ]
5,891
static void opt_qmin(const char *arg) { video_qmin = atoi(arg); if (video_qmin < 0 || video_qmin > 31) { fprintf(stderr, "qmin must be >= 1 and <= 31\n"); exit(1); } }
false
FFmpeg
6e0d8c06c7af61859e8d7bc2351a607d8abeab75
static void opt_qmin(const char *arg) { video_qmin = atoi(arg); if (video_qmin < 0 || video_qmin > 31) { fprintf(stderr, "qmin must be >= 1 and <= 31\n"); exit(1); } }
{ "code": [], "line_no": [] }
static void FUNC_0(const char *VAR_0) { video_qmin = atoi(VAR_0); if (video_qmin < 0 || video_qmin > 31) { fprintf(stderr, "qmin must be >= 1 and <= 31\n"); exit(1); } }
[ "static void FUNC_0(const char *VAR_0)\n{", "video_qmin = atoi(VAR_0);", "if (video_qmin < 0 ||\nvideo_qmin > 31) {", "fprintf(stderr, \"qmin must be >= 1 and <= 31\\n\");", "exit(1);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ] ]
5,892
void migrate_decompress_threads_join(void) { int i, thread_count; quit_decomp_thread = true; thread_count = migrate_decompress_threads(); for (i = 0; i < thread_count; i++) { qemu_mutex_lock(&decomp_param[i].mutex); qemu_cond_signal(&decomp_param[i].cond); qemu_mutex_unlock(&decomp_param[i].mutex); } for (i = 0; i < thread_count; i++) { qemu_thread_join(decompress_threads + i); qemu_mutex_destroy(&decomp_param[i].mutex); qemu_cond_destroy(&decomp_param[i].cond); g_free(decomp_param[i].compbuf); } g_free(decompress_threads); g_free(decomp_param); decompress_threads = NULL; decomp_param = NULL; }
false
qemu
90e56fb46d0a7add88ed463efa4e723a6238f692
void migrate_decompress_threads_join(void) { int i, thread_count; quit_decomp_thread = true; thread_count = migrate_decompress_threads(); for (i = 0; i < thread_count; i++) { qemu_mutex_lock(&decomp_param[i].mutex); qemu_cond_signal(&decomp_param[i].cond); qemu_mutex_unlock(&decomp_param[i].mutex); } for (i = 0; i < thread_count; i++) { qemu_thread_join(decompress_threads + i); qemu_mutex_destroy(&decomp_param[i].mutex); qemu_cond_destroy(&decomp_param[i].cond); g_free(decomp_param[i].compbuf); } g_free(decompress_threads); g_free(decomp_param); decompress_threads = NULL; decomp_param = NULL; }
{ "code": [], "line_no": [] }
void FUNC_0(void) { int VAR_0, VAR_1; quit_decomp_thread = true; VAR_1 = migrate_decompress_threads(); for (VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) { qemu_mutex_lock(&decomp_param[VAR_0].mutex); qemu_cond_signal(&decomp_param[VAR_0].cond); qemu_mutex_unlock(&decomp_param[VAR_0].mutex); } for (VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) { qemu_thread_join(decompress_threads + VAR_0); qemu_mutex_destroy(&decomp_param[VAR_0].mutex); qemu_cond_destroy(&decomp_param[VAR_0].cond); g_free(decomp_param[VAR_0].compbuf); } g_free(decompress_threads); g_free(decomp_param); decompress_threads = NULL; decomp_param = NULL; }
[ "void FUNC_0(void)\n{", "int VAR_0, VAR_1;", "quit_decomp_thread = true;", "VAR_1 = migrate_decompress_threads();", "for (VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) {", "qemu_mutex_lock(&decomp_param[VAR_0].mutex);", "qemu_cond_signal(&decomp_param[VAR_0].cond);", "qemu_mutex_unlock(&decomp_param[VAR_0].mutex);", "}", "for (VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) {", "qemu_thread_join(decompress_threads + VAR_0);", "qemu_mutex_destroy(&decomp_param[VAR_0].mutex);", "qemu_cond_destroy(&decomp_param[VAR_0].cond);", "g_free(decomp_param[VAR_0].compbuf);", "}", "g_free(decompress_threads);", "g_free(decomp_param);", "decompress_threads = NULL;", "decomp_param = NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ] ]
5,893
ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs) { BlockDriver *drv = bs->drv; if (drv && drv->bdrv_get_specific_info) { return drv->bdrv_get_specific_info(bs); } return NULL; }
false
qemu
61007b316cd71ee7333ff7a0a749a8949527575f
ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs) { BlockDriver *drv = bs->drv; if (drv && drv->bdrv_get_specific_info) { return drv->bdrv_get_specific_info(bs); } return NULL; }
{ "code": [], "line_no": [] }
ImageInfoSpecific *FUNC_0(BlockDriverState *bs) { BlockDriver *drv = bs->drv; if (drv && drv->FUNC_0) { return drv->FUNC_0(bs); } return NULL; }
[ "ImageInfoSpecific *FUNC_0(BlockDriverState *bs)\n{", "BlockDriver *drv = bs->drv;", "if (drv && drv->FUNC_0) {", "return drv->FUNC_0(bs);", "}", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ] ]
5,894
do_gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf, TCGv jr) { gen_update_cc_op(s); /* If several instructions disable interrupts, only the first does it. */ if (inhibit && !(s->flags & HF_INHIBIT_IRQ_MASK)) { gen_set_hflag(s, HF_INHIBIT_IRQ_MASK); } else { gen_reset_hflag(s, HF_INHIBIT_IRQ_MASK); } if (s->tb->flags & HF_RF_MASK) { gen_helper_reset_rf(cpu_env); } if (s->singlestep_enabled) { gen_helper_debug(cpu_env); } else if (recheck_tf) { gen_helper_rechecking_single_step(cpu_env); tcg_gen_exit_tb(0); } else if (s->tf) { gen_helper_single_step(cpu_env); } else if (!TCGV_IS_UNUSED(jr)) { TCGv vaddr = tcg_temp_new(); tcg_gen_add_tl(vaddr, jr, cpu_seg_base[R_CS]); tcg_gen_lookup_and_goto_ptr(vaddr); tcg_temp_free(vaddr); } else { tcg_gen_exit_tb(0); } s->is_jmp = DISAS_TB_JUMP; }
false
qemu
1e39d97af086d525cd0408eaa5d19783ea165906
do_gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf, TCGv jr) { gen_update_cc_op(s); if (inhibit && !(s->flags & HF_INHIBIT_IRQ_MASK)) { gen_set_hflag(s, HF_INHIBIT_IRQ_MASK); } else { gen_reset_hflag(s, HF_INHIBIT_IRQ_MASK); } if (s->tb->flags & HF_RF_MASK) { gen_helper_reset_rf(cpu_env); } if (s->singlestep_enabled) { gen_helper_debug(cpu_env); } else if (recheck_tf) { gen_helper_rechecking_single_step(cpu_env); tcg_gen_exit_tb(0); } else if (s->tf) { gen_helper_single_step(cpu_env); } else if (!TCGV_IS_UNUSED(jr)) { TCGv vaddr = tcg_temp_new(); tcg_gen_add_tl(vaddr, jr, cpu_seg_base[R_CS]); tcg_gen_lookup_and_goto_ptr(vaddr); tcg_temp_free(vaddr); } else { tcg_gen_exit_tb(0); } s->is_jmp = DISAS_TB_JUMP; }
{ "code": [], "line_no": [] }
FUNC_0(DisasContext *VAR_0, bool VAR_1, bool VAR_2, TCGv VAR_3) { gen_update_cc_op(VAR_0); if (VAR_1 && !(VAR_0->flags & HF_INHIBIT_IRQ_MASK)) { gen_set_hflag(VAR_0, HF_INHIBIT_IRQ_MASK); } else { gen_reset_hflag(VAR_0, HF_INHIBIT_IRQ_MASK); } if (VAR_0->tb->flags & HF_RF_MASK) { gen_helper_reset_rf(cpu_env); } if (VAR_0->singlestep_enabled) { gen_helper_debug(cpu_env); } else if (VAR_2) { gen_helper_rechecking_single_step(cpu_env); tcg_gen_exit_tb(0); } else if (VAR_0->tf) { gen_helper_single_step(cpu_env); } else if (!TCGV_IS_UNUSED(VAR_3)) { TCGv vaddr = tcg_temp_new(); tcg_gen_add_tl(vaddr, VAR_3, cpu_seg_base[R_CS]); tcg_gen_lookup_and_goto_ptr(vaddr); tcg_temp_free(vaddr); } else { tcg_gen_exit_tb(0); } VAR_0->is_jmp = DISAS_TB_JUMP; }
[ "FUNC_0(DisasContext *VAR_0, bool VAR_1, bool VAR_2, TCGv VAR_3)\n{", "gen_update_cc_op(VAR_0);", "if (VAR_1 && !(VAR_0->flags & HF_INHIBIT_IRQ_MASK)) {", "gen_set_hflag(VAR_0, HF_INHIBIT_IRQ_MASK);", "} else {", "gen_reset_hflag(VAR_0, HF_INHIBIT_IRQ_MASK);", "}", "if (VAR_0->tb->flags & HF_RF_MASK) {", "gen_helper_reset_rf(cpu_env);", "}", "if (VAR_0->singlestep_enabled) {", "gen_helper_debug(cpu_env);", "} else if (VAR_2) {", "gen_helper_rechecking_single_step(cpu_env);", "tcg_gen_exit_tb(0);", "} else if (VAR_0->tf) {", "gen_helper_single_step(cpu_env);", "} else if (!TCGV_IS_UNUSED(VAR_3)) {", "TCGv vaddr = tcg_temp_new();", "tcg_gen_add_tl(vaddr, VAR_3, cpu_seg_base[R_CS]);", "tcg_gen_lookup_and_goto_ptr(vaddr);", "tcg_temp_free(vaddr);", "} else {", "tcg_gen_exit_tb(0);", "}", "VAR_0->is_jmp = DISAS_TB_JUMP;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ] ]
5,895
SocketAddressLegacy *socket_local_address(int fd, Error **errp) { struct sockaddr_storage ss; socklen_t sslen = sizeof(ss); if (getsockname(fd, (struct sockaddr *)&ss, &sslen) < 0) { error_setg_errno(errp, errno, "%s", "Unable to query local socket address"); return NULL; } return socket_sockaddr_to_address(&ss, sslen, errp); }
false
qemu
bd269ebc82fbaa5fe7ce5bc7c1770ac8acecd884
SocketAddressLegacy *socket_local_address(int fd, Error **errp) { struct sockaddr_storage ss; socklen_t sslen = sizeof(ss); if (getsockname(fd, (struct sockaddr *)&ss, &sslen) < 0) { error_setg_errno(errp, errno, "%s", "Unable to query local socket address"); return NULL; } return socket_sockaddr_to_address(&ss, sslen, errp); }
{ "code": [], "line_no": [] }
SocketAddressLegacy *FUNC_0(int fd, Error **errp) { struct sockaddr_storage VAR_0; socklen_t sslen = sizeof(VAR_0); if (getsockname(fd, (struct sockaddr *)&VAR_0, &sslen) < 0) { error_setg_errno(errp, errno, "%s", "Unable to query local socket address"); return NULL; } return socket_sockaddr_to_address(&VAR_0, sslen, errp); }
[ "SocketAddressLegacy *FUNC_0(int fd, Error **errp)\n{", "struct sockaddr_storage VAR_0;", "socklen_t sslen = sizeof(VAR_0);", "if (getsockname(fd, (struct sockaddr *)&VAR_0, &sslen) < 0) {", "error_setg_errno(errp, errno, \"%s\",\n\"Unable to query local socket address\");", "return NULL;", "}", "return socket_sockaddr_to_address(&VAR_0, sslen, errp);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ] ]
5,896
static void machine_numa_finish_init(MachineState *machine) { int i; bool default_mapping; GString *s = g_string_new(NULL); MachineClass *mc = MACHINE_GET_CLASS(machine); const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids(machine); assert(nb_numa_nodes); for (i = 0; i < possible_cpus->len; i++) { if (possible_cpus->cpus[i].props.has_node_id) { break; } } default_mapping = (i == possible_cpus->len); for (i = 0; i < possible_cpus->len; i++) { const CPUArchId *cpu_slot = &possible_cpus->cpus[i]; if (!cpu_slot->props.has_node_id) { if (default_mapping) { /* fetch default mapping from board and enable it */ CpuInstanceProperties props = cpu_slot->props; props.has_node_id = true; machine_set_cpu_numa_node(machine, &props, &error_fatal); } else { /* record slots with not set mapping, * TODO: make it hard error in future */ char *cpu_str = cpu_slot_to_string(cpu_slot); g_string_append_printf(s, "%sCPU %d [%s]", s->len ? ", " : "", i, cpu_str); g_free(cpu_str); } } } if (s->len && !qtest_enabled()) { error_report("warning: CPU(s) not present in any NUMA nodes: %s", s->str); error_report("warning: All CPU(s) up to maxcpus should be described " "in NUMA config, ability to start up with partial NUMA " "mappings is obsoleted and will be removed in future"); } g_string_free(s, true); }
false
qemu
d41f3e750d2c06c613cb1b8db7724f0fbc0a2b14
static void machine_numa_finish_init(MachineState *machine) { int i; bool default_mapping; GString *s = g_string_new(NULL); MachineClass *mc = MACHINE_GET_CLASS(machine); const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids(machine); assert(nb_numa_nodes); for (i = 0; i < possible_cpus->len; i++) { if (possible_cpus->cpus[i].props.has_node_id) { break; } } default_mapping = (i == possible_cpus->len); for (i = 0; i < possible_cpus->len; i++) { const CPUArchId *cpu_slot = &possible_cpus->cpus[i]; if (!cpu_slot->props.has_node_id) { if (default_mapping) { CpuInstanceProperties props = cpu_slot->props; props.has_node_id = true; machine_set_cpu_numa_node(machine, &props, &error_fatal); } else { char *cpu_str = cpu_slot_to_string(cpu_slot); g_string_append_printf(s, "%sCPU %d [%s]", s->len ? ", " : "", i, cpu_str); g_free(cpu_str); } } } if (s->len && !qtest_enabled()) { error_report("warning: CPU(s) not present in any NUMA nodes: %s", s->str); error_report("warning: All CPU(s) up to maxcpus should be described " "in NUMA config, ability to start up with partial NUMA " "mappings is obsoleted and will be removed in future"); } g_string_free(s, true); }
{ "code": [], "line_no": [] }
static void FUNC_0(MachineState *VAR_0) { int VAR_1; bool default_mapping; GString *s = g_string_new(NULL); MachineClass *mc = MACHINE_GET_CLASS(VAR_0); const CPUArchIdList *VAR_2 = mc->possible_cpu_arch_ids(VAR_0); assert(nb_numa_nodes); for (VAR_1 = 0; VAR_1 < VAR_2->len; VAR_1++) { if (VAR_2->cpus[VAR_1].props.has_node_id) { break; } } default_mapping = (VAR_1 == VAR_2->len); for (VAR_1 = 0; VAR_1 < VAR_2->len; VAR_1++) { const CPUArchId *cpu_slot = &VAR_2->cpus[VAR_1]; if (!cpu_slot->props.has_node_id) { if (default_mapping) { CpuInstanceProperties props = cpu_slot->props; props.has_node_id = true; machine_set_cpu_numa_node(VAR_0, &props, &error_fatal); } else { char *cpu_str = cpu_slot_to_string(cpu_slot); g_string_append_printf(s, "%sCPU %d [%s]", s->len ? ", " : "", VAR_1, cpu_str); g_free(cpu_str); } } } if (s->len && !qtest_enabled()) { error_report("warning: CPU(s) not present in any NUMA nodes: %s", s->str); error_report("warning: All CPU(s) up to maxcpus should be described " "in NUMA config, ability to start up with partial NUMA " "mappings is obsoleted and will be removed in future"); } g_string_free(s, true); }
[ "static void FUNC_0(MachineState *VAR_0)\n{", "int VAR_1;", "bool default_mapping;", "GString *s = g_string_new(NULL);", "MachineClass *mc = MACHINE_GET_CLASS(VAR_0);", "const CPUArchIdList *VAR_2 = mc->possible_cpu_arch_ids(VAR_0);", "assert(nb_numa_nodes);", "for (VAR_1 = 0; VAR_1 < VAR_2->len; VAR_1++) {", "if (VAR_2->cpus[VAR_1].props.has_node_id) {", "break;", "}", "}", "default_mapping = (VAR_1 == VAR_2->len);", "for (VAR_1 = 0; VAR_1 < VAR_2->len; VAR_1++) {", "const CPUArchId *cpu_slot = &VAR_2->cpus[VAR_1];", "if (!cpu_slot->props.has_node_id) {", "if (default_mapping) {", "CpuInstanceProperties props = cpu_slot->props;", "props.has_node_id = true;", "machine_set_cpu_numa_node(VAR_0, &props, &error_fatal);", "} else {", "char *cpu_str = cpu_slot_to_string(cpu_slot);", "g_string_append_printf(s, \"%sCPU %d [%s]\",\ns->len ? \", \" : \"\", VAR_1, cpu_str);", "g_free(cpu_str);", "}", "}", "}", "if (s->len && !qtest_enabled()) {", "error_report(\"warning: CPU(s) not present in any NUMA nodes: %s\",\ns->str);", "error_report(\"warning: All CPU(s) up to maxcpus should be described \"\n\"in NUMA config, ability to start up with partial NUMA \"\n\"mappings is obsoleted and will be removed in future\");", "}", "g_string_free(s, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 57 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73, 75 ], [ 77, 79, 81 ], [ 83 ], [ 85 ], [ 87 ] ]
5,897
void qmp_block_dirty_bitmap_clear(const char *node, const char *name, Error **errp) { AioContext *aio_context; BdrvDirtyBitmap *bitmap; BlockDriverState *bs; bitmap = block_dirty_bitmap_lookup(node, name, &bs, &aio_context, errp); if (!bitmap || !bs) { return; } if (bdrv_dirty_bitmap_frozen(bitmap)) { error_setg(errp, "Bitmap '%s' is currently frozen and cannot be modified", name); goto out; } else if (!bdrv_dirty_bitmap_enabled(bitmap)) { error_setg(errp, "Bitmap '%s' is currently disabled and cannot be cleared", name); goto out; } bdrv_clear_dirty_bitmap(bitmap, NULL); out: aio_context_release(aio_context); }
false
qemu
2119882c7eb7e2c612b24fc0c8d86f5887d6f1c3
void qmp_block_dirty_bitmap_clear(const char *node, const char *name, Error **errp) { AioContext *aio_context; BdrvDirtyBitmap *bitmap; BlockDriverState *bs; bitmap = block_dirty_bitmap_lookup(node, name, &bs, &aio_context, errp); if (!bitmap || !bs) { return; } if (bdrv_dirty_bitmap_frozen(bitmap)) { error_setg(errp, "Bitmap '%s' is currently frozen and cannot be modified", name); goto out; } else if (!bdrv_dirty_bitmap_enabled(bitmap)) { error_setg(errp, "Bitmap '%s' is currently disabled and cannot be cleared", name); goto out; } bdrv_clear_dirty_bitmap(bitmap, NULL); out: aio_context_release(aio_context); }
{ "code": [], "line_no": [] }
void FUNC_0(const char *VAR_0, const char *VAR_1, Error **VAR_2) { AioContext *aio_context; BdrvDirtyBitmap *bitmap; BlockDriverState *bs; bitmap = block_dirty_bitmap_lookup(VAR_0, VAR_1, &bs, &aio_context, VAR_2); if (!bitmap || !bs) { return; } if (bdrv_dirty_bitmap_frozen(bitmap)) { error_setg(VAR_2, "Bitmap '%s' is currently frozen and cannot be modified", VAR_1); goto out; } else if (!bdrv_dirty_bitmap_enabled(bitmap)) { error_setg(VAR_2, "Bitmap '%s' is currently disabled and cannot be cleared", VAR_1); goto out; } bdrv_clear_dirty_bitmap(bitmap, NULL); out: aio_context_release(aio_context); }
[ "void FUNC_0(const char *VAR_0, const char *VAR_1,\nError **VAR_2)\n{", "AioContext *aio_context;", "BdrvDirtyBitmap *bitmap;", "BlockDriverState *bs;", "bitmap = block_dirty_bitmap_lookup(VAR_0, VAR_1, &bs, &aio_context, VAR_2);", "if (!bitmap || !bs) {", "return;", "}", "if (bdrv_dirty_bitmap_frozen(bitmap)) {", "error_setg(VAR_2,\n\"Bitmap '%s' is currently frozen and cannot be modified\",\nVAR_1);", "goto out;", "} else if (!bdrv_dirty_bitmap_enabled(bitmap)) {", "error_setg(VAR_2,\n\"Bitmap '%s' is currently disabled and cannot be cleared\",\nVAR_1);", "goto out;", "}", "bdrv_clear_dirty_bitmap(bitmap, NULL);", "out:\naio_context_release(aio_context);", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27, 29, 31 ], [ 33 ], [ 35 ], [ 37, 39, 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53, 55 ], [ 57 ] ]
5,898
FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port, target_phys_addr_t ctl_addr, target_phys_addr_t data_addr) { DeviceState *dev; SysBusDevice *d; FWCfgState *s; dev = qdev_create(NULL, "fw_cfg"); qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port); qdev_prop_set_uint32(dev, "data_iobase", data_port); qdev_init_nofail(dev); d = sysbus_from_qdev(dev); s = DO_UPCAST(FWCfgState, busdev.qdev, dev); if (ctl_addr) { sysbus_mmio_map(d, 0, ctl_addr); } if (data_addr) { sysbus_mmio_map(d, 1, data_addr); } fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (uint8_t *)"QEMU", 4); fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16); fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC)); fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); fw_cfg_add_i16(s, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu); fw_cfg_bootsplash(s); fw_cfg_reboot(s); s->machine_ready.notify = fw_cfg_machine_ready; qemu_add_machine_init_done_notifier(&s->machine_ready); return s; }
false
qemu
a8170e5e97ad17ca169c64ba87ae2f53850dab4c
FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port, target_phys_addr_t ctl_addr, target_phys_addr_t data_addr) { DeviceState *dev; SysBusDevice *d; FWCfgState *s; dev = qdev_create(NULL, "fw_cfg"); qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port); qdev_prop_set_uint32(dev, "data_iobase", data_port); qdev_init_nofail(dev); d = sysbus_from_qdev(dev); s = DO_UPCAST(FWCfgState, busdev.qdev, dev); if (ctl_addr) { sysbus_mmio_map(d, 0, ctl_addr); } if (data_addr) { sysbus_mmio_map(d, 1, data_addr); } fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (uint8_t *)"QEMU", 4); fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16); fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC)); fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); fw_cfg_add_i16(s, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu); fw_cfg_bootsplash(s); fw_cfg_reboot(s); s->machine_ready.notify = fw_cfg_machine_ready; qemu_add_machine_init_done_notifier(&s->machine_ready); return s; }
{ "code": [], "line_no": [] }
FWCfgState *FUNC_0(uint32_t ctl_port, uint32_t data_port, target_phys_addr_t ctl_addr, target_phys_addr_t data_addr) { DeviceState *dev; SysBusDevice *d; FWCfgState *s; dev = qdev_create(NULL, "fw_cfg"); qdev_prop_set_uint32(dev, "ctl_iobase", ctl_port); qdev_prop_set_uint32(dev, "data_iobase", data_port); qdev_init_nofail(dev); d = sysbus_from_qdev(dev); s = DO_UPCAST(FWCfgState, busdev.qdev, dev); if (ctl_addr) { sysbus_mmio_map(d, 0, ctl_addr); } if (data_addr) { sysbus_mmio_map(d, 1, data_addr); } fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (uint8_t *)"QEMU", 4); fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16); fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC)); fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); fw_cfg_add_i16(s, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu); fw_cfg_bootsplash(s); fw_cfg_reboot(s); s->machine_ready.notify = fw_cfg_machine_ready; qemu_add_machine_init_done_notifier(&s->machine_ready); return s; }
[ "FWCfgState *FUNC_0(uint32_t ctl_port, uint32_t data_port,\ntarget_phys_addr_t ctl_addr, target_phys_addr_t data_addr)\n{", "DeviceState *dev;", "SysBusDevice *d;", "FWCfgState *s;", "dev = qdev_create(NULL, \"fw_cfg\");", "qdev_prop_set_uint32(dev, \"ctl_iobase\", ctl_port);", "qdev_prop_set_uint32(dev, \"data_iobase\", data_port);", "qdev_init_nofail(dev);", "d = sysbus_from_qdev(dev);", "s = DO_UPCAST(FWCfgState, busdev.qdev, dev);", "if (ctl_addr) {", "sysbus_mmio_map(d, 0, ctl_addr);", "}", "if (data_addr) {", "sysbus_mmio_map(d, 1, data_addr);", "}", "fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (uint8_t *)\"QEMU\", 4);", "fw_cfg_add_bytes(s, FW_CFG_UUID, qemu_uuid, 16);", "fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)(display_type == DT_NOGRAPHIC));", "fw_cfg_add_i16(s, FW_CFG_NB_CPUS, (uint16_t)smp_cpus);", "fw_cfg_add_i16(s, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);", "fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu);", "fw_cfg_bootsplash(s);", "fw_cfg_reboot(s);", "s->machine_ready.notify = fw_cfg_machine_ready;", "qemu_add_machine_init_done_notifier(&s->machine_ready);", "return s;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ] ]
5,900
static void boston_flash_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { }
true
qemu
2d896b454a0e19ec4c1ddbb0e0b65b7e54fcedf3
static void boston_flash_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { }
{ "code": [ "static void boston_flash_write(void *opaque, hwaddr addr,", " uint64_t val, unsigned size)" ], "line_no": [ 1, 3 ] }
static void FUNC_0(void *VAR_0, hwaddr VAR_1, uint64_t VAR_2, unsigned VAR_3) { }
[ "static void FUNC_0(void *VAR_0, hwaddr VAR_1,\nuint64_t VAR_2, unsigned VAR_3)\n{", "}" ]
[ 1, 0 ]
[ [ 1, 3, 5 ], [ 7 ] ]
5,901
static void revert_cdlms(WmallDecodeCtx *s, int ch, int coef_begin, int coef_end) { int icoef, pred, ilms, num_lms, residue, input; num_lms = s->cdlms_ttl[ch]; for (ilms = num_lms - 1; ilms >= 0; ilms--) { for (icoef = coef_begin; icoef < coef_end; icoef++) { pred = 1 << (s->cdlms[ch][ilms].scaling - 1); residue = s->channel_residues[ch][icoef]; pred += s->dsp.scalarproduct_and_madd_int16(s->cdlms[ch][ilms].coefs, s->cdlms[ch][ilms].lms_prevvalues + s->cdlms[ch][ilms].recent, s->cdlms[ch][ilms].lms_updates + s->cdlms[ch][ilms].recent, s->cdlms[ch][ilms].order, WMASIGN(residue)); input = residue + (pred >> s->cdlms[ch][ilms].scaling); lms_update(s, ch, ilms, input); s->channel_residues[ch][icoef] = input; } } }
true
FFmpeg
49bf712a892901bd6a2e8815d085487180894d8c
static void revert_cdlms(WmallDecodeCtx *s, int ch, int coef_begin, int coef_end) { int icoef, pred, ilms, num_lms, residue, input; num_lms = s->cdlms_ttl[ch]; for (ilms = num_lms - 1; ilms >= 0; ilms--) { for (icoef = coef_begin; icoef < coef_end; icoef++) { pred = 1 << (s->cdlms[ch][ilms].scaling - 1); residue = s->channel_residues[ch][icoef]; pred += s->dsp.scalarproduct_and_madd_int16(s->cdlms[ch][ilms].coefs, s->cdlms[ch][ilms].lms_prevvalues + s->cdlms[ch][ilms].recent, s->cdlms[ch][ilms].lms_updates + s->cdlms[ch][ilms].recent, s->cdlms[ch][ilms].order, WMASIGN(residue)); input = residue + (pred >> s->cdlms[ch][ilms].scaling); lms_update(s, ch, ilms, input); s->channel_residues[ch][icoef] = input; } } }
{ "code": [], "line_no": [] }
static void FUNC_0(WmallDecodeCtx *VAR_0, int VAR_1, int VAR_2, int VAR_3) { int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9; VAR_7 = VAR_0->cdlms_ttl[VAR_1]; for (VAR_6 = VAR_7 - 1; VAR_6 >= 0; VAR_6--) { for (VAR_4 = VAR_2; VAR_4 < VAR_3; VAR_4++) { VAR_5 = 1 << (VAR_0->cdlms[VAR_1][VAR_6].scaling - 1); VAR_8 = VAR_0->channel_residues[VAR_1][VAR_4]; VAR_5 += VAR_0->dsp.scalarproduct_and_madd_int16(VAR_0->cdlms[VAR_1][VAR_6].coefs, VAR_0->cdlms[VAR_1][VAR_6].lms_prevvalues + VAR_0->cdlms[VAR_1][VAR_6].recent, VAR_0->cdlms[VAR_1][VAR_6].lms_updates + VAR_0->cdlms[VAR_1][VAR_6].recent, VAR_0->cdlms[VAR_1][VAR_6].order, WMASIGN(VAR_8)); VAR_9 = VAR_8 + (VAR_5 >> VAR_0->cdlms[VAR_1][VAR_6].scaling); lms_update(VAR_0, VAR_1, VAR_6, VAR_9); VAR_0->channel_residues[VAR_1][VAR_4] = VAR_9; } } }
[ "static void FUNC_0(WmallDecodeCtx *VAR_0, int VAR_1,\nint VAR_2, int VAR_3)\n{", "int VAR_4, VAR_5, VAR_6, VAR_7, VAR_8, VAR_9;", "VAR_7 = VAR_0->cdlms_ttl[VAR_1];", "for (VAR_6 = VAR_7 - 1; VAR_6 >= 0; VAR_6--) {", "for (VAR_4 = VAR_2; VAR_4 < VAR_3; VAR_4++) {", "VAR_5 = 1 << (VAR_0->cdlms[VAR_1][VAR_6].scaling - 1);", "VAR_8 = VAR_0->channel_residues[VAR_1][VAR_4];", "VAR_5 += VAR_0->dsp.scalarproduct_and_madd_int16(VAR_0->cdlms[VAR_1][VAR_6].coefs,\nVAR_0->cdlms[VAR_1][VAR_6].lms_prevvalues\n+ VAR_0->cdlms[VAR_1][VAR_6].recent,\nVAR_0->cdlms[VAR_1][VAR_6].lms_updates\n+ VAR_0->cdlms[VAR_1][VAR_6].recent,\nVAR_0->cdlms[VAR_1][VAR_6].order,\nWMASIGN(VAR_8));", "VAR_9 = VAR_8 + (VAR_5 >> VAR_0->cdlms[VAR_1][VAR_6].scaling);", "lms_update(VAR_0, VAR_1, VAR_6, VAR_9);", "VAR_0->channel_residues[VAR_1][VAR_4] = VAR_9;", "}", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21, 23, 25, 27, 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 46 ] ]
5,902
static void utf8_string(void) { /* * FIXME Current behavior for invalid UTF-8 sequences is * incorrect. This test expects current, incorrect results. * They're all marked "bug:" below, and are to be replaced by * correct ones as the bugs get fixed. * * The JSON parser rejects some invalid sequences, but accepts * others without correcting the problem. * * We should either reject all invalid sequences, or minimize * overlong sequences and replace all other invalid sequences by a * suitable replacement character. A common choice for * replacement is U+FFFD. * * Problem: we can't easily deal with embedded U+0000. Parsing * the JSON string "this \\u0000" is fun" yields "this \0 is fun", * which gets misinterpreted as NUL-terminated "this ". We should * consider using overlong encoding \xC0\x80 for U+0000 ("modified * UTF-8"). * * Most test cases are scraped from Markus Kuhn's UTF-8 decoder * capability and stress test at * http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt */ static const struct { const char *json_in; const char *utf8_out; const char *json_out; /* defaults to @json_in */ const char *utf8_in; /* defaults to @utf8_out */ } test_cases[] = { /* * Bug markers used here: * - bug: not corrected * JSON parser fails to correct invalid sequence(s) * - bug: rejected * JSON parser rejects invalid sequence(s) * We may choose to define this as feature * - bug: want "..." * JSON parser produces incorrect result, this is the * correct one, assuming replacement character U+FFFF * We may choose to reject instead of replace */ /* 1 Some correct UTF-8 text */ { /* a bit of German */ "\"Falsches \xC3\x9C" "ben von Xylophonmusik qu\xC3\xA4lt" " jeden gr\xC3\xB6\xC3\x9F" "eren Zwerg.\"", "Falsches \xC3\x9C" "ben von Xylophonmusik qu\xC3\xA4lt" " jeden gr\xC3\xB6\xC3\x9F" "eren Zwerg.", "\"Falsches \\u00DCben von Xylophonmusik qu\\u00E4lt" " jeden gr\\u00F6\\u00DFeren Zwerg.\"", }, { /* a bit of Greek */ "\"\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5\"", "\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5", "\"\\u03BA\\u1F79\\u03C3\\u03BC\\u03B5\"", }, /* 2 Boundary condition test cases */ /* 2.1 First possible sequence of a certain length */ /* 2.1.1 1 byte U+0000 */ { "\"\\u0000\"", "", /* bug: want overlong "\xC0\x80" */ "\"\\u0000\"", "\xC0\x80", }, /* 2.1.2 2 bytes U+0080 */ { "\"\xC2\x80\"", "\xC2\x80", "\"\\u0080\"", }, /* 2.1.3 3 bytes U+0800 */ { "\"\xE0\xA0\x80\"", "\xE0\xA0\x80", "\"\\u0800\"", }, /* 2.1.4 4 bytes U+10000 */ { "\"\xF0\x90\x80\x80\"", "\xF0\x90\x80\x80", "\"\\uD800\\uDC00\"", }, /* 2.1.5 5 bytes U+200000 */ { "\"\xF8\x88\x80\x80\x80\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xF8\x88\x80\x80\x80", }, /* 2.1.6 6 bytes U+4000000 */ { "\"\xFC\x84\x80\x80\x80\x80\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xFC\x84\x80\x80\x80\x80", }, /* 2.2 Last possible sequence of a certain length */ /* 2.2.1 1 byte U+007F */ { "\"\x7F\"", "\x7F", "\"\\u007F\"", }, /* 2.2.2 2 bytes U+07FF */ { "\"\xDF\xBF\"", "\xDF\xBF", "\"\\u07FF\"", }, /* * 2.2.3 3 bytes U+FFFC * The last possible sequence is actually U+FFFF. But that's * a noncharacter, and already covered by its own test case * under 5.3. Same for U+FFFE. U+FFFD is the last character * in the BMP, and covered under 2.3. Because of U+FFFD's * special role as replacement character, it's worth testing * U+FFFC here. */ { "\"\xEF\xBF\xBC\"", "\xEF\xBF\xBC", "\"\\uFFFC\"", }, /* 2.2.4 4 bytes U+1FFFFF */ { "\"\xF7\xBF\xBF\xBF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xF7\xBF\xBF\xBF", }, /* 2.2.5 5 bytes U+3FFFFFF */ { "\"\xFB\xBF\xBF\xBF\xBF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xFB\xBF\xBF\xBF\xBF", }, /* 2.2.6 6 bytes U+7FFFFFFF */ { "\"\xFD\xBF\xBF\xBF\xBF\xBF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xFD\xBF\xBF\xBF\xBF\xBF", }, /* 2.3 Other boundary conditions */ { /* last one before surrogate range: U+D7FF */ "\"\xED\x9F\xBF\"", "\xED\x9F\xBF", "\"\\uD7FF\"", }, { /* first one after surrogate range: U+E000 */ "\"\xEE\x80\x80\"", "\xEE\x80\x80", "\"\\uE000\"", }, { /* last one in BMP: U+FFFD */ "\"\xEF\xBF\xBD\"", "\xEF\xBF\xBD", "\"\\uFFFD\"", }, { /* last one in last plane: U+10FFFD */ "\"\xF4\x8F\xBF\xBD\"", "\xF4\x8F\xBF\xBD", "\"\\uDBFF\\uDFFD\"" }, { /* first one beyond Unicode range: U+110000 */ "\"\xF4\x90\x80\x80\"", "\xF4\x90\x80\x80", "\"\\uFFFD\"", }, /* 3 Malformed sequences */ /* 3.1 Unexpected continuation bytes */ /* 3.1.1 First continuation byte */ { "\"\x80\"", "\x80", /* bug: not corrected */ "\"\\uFFFD\"", }, /* 3.1.2 Last continuation byte */ { "\"\xBF\"", "\xBF", /* bug: not corrected */ "\"\\uFFFD\"", }, /* 3.1.3 2 continuation bytes */ { "\"\x80\xBF\"", "\x80\xBF", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\"", }, /* 3.1.4 3 continuation bytes */ { "\"\x80\xBF\x80\"", "\x80\xBF\x80", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\\uFFFD\"", }, /* 3.1.5 4 continuation bytes */ { "\"\x80\xBF\x80\xBF\"", "\x80\xBF\x80\xBF", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, /* 3.1.6 5 continuation bytes */ { "\"\x80\xBF\x80\xBF\x80\"", "\x80\xBF\x80\xBF\x80", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, /* 3.1.7 6 continuation bytes */ { "\"\x80\xBF\x80\xBF\x80\xBF\"", "\x80\xBF\x80\xBF\x80\xBF", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, /* 3.1.8 7 continuation bytes */ { "\"\x80\xBF\x80\xBF\x80\xBF\x80\"", "\x80\xBF\x80\xBF\x80\xBF\x80", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, /* 3.1.9 Sequence of all 64 possible continuation bytes */ { "\"\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F" "\x90\x91\x92\x93\x94\x95\x96\x97" "\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F" "\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7" "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF" "\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7" "\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\"", /* bug: not corrected */ "\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F" "\x90\x91\x92\x93\x94\x95\x96\x97" "\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F" "\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7" "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF" "\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7" "\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"" }, /* 3.2 Lonely start characters */ /* 3.2.1 All 32 first bytes of 2-byte sequences, followed by space */ { "\"\xC0 \xC1 \xC2 \xC3 \xC4 \xC5 \xC6 \xC7 " "\xC8 \xC9 \xCA \xCB \xCC \xCD \xCE \xCF " "\xD0 \xD1 \xD2 \xD3 \xD4 \xD5 \xD6 \xD7 " "\xD8 \xD9 \xDA \xDB \xDC \xDD \xDE \xDF \"", NULL, /* bug: rejected */ "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", "\xC0 \xC1 \xC2 \xC3 \xC4 \xC5 \xC6 \xC7 " "\xC8 \xC9 \xCA \xCB \xCC \xCD \xCE \xCF " "\xD0 \xD1 \xD2 \xD3 \xD4 \xD5 \xD6 \xD7 " "\xD8 \xD9 \xDA \xDB \xDC \xDD \xDE \xDF ", }, /* 3.2.2 All 16 first bytes of 3-byte sequences, followed by space */ { "\"\xE0 \xE1 \xE2 \xE3 \xE4 \xE5 \xE6 \xE7 " "\xE8 \xE9 \xEA \xEB \xEC \xED \xEE \xEF \"", /* bug: not corrected */ "\xE0 \xE1 \xE2 \xE3 \xE4 \xE5 \xE6 \xE7 " "\xE8 \xE9 \xEA \xEB \xEC \xED \xEE \xEF ", "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", }, /* 3.2.3 All 8 first bytes of 4-byte sequences, followed by space */ { "\"\xF0 \xF1 \xF2 \xF3 \xF4 \xF5 \xF6 \xF7 \"", NULL, /* bug: rejected */ "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", "\xF0 \xF1 \xF2 \xF3 \xF4 \xF5 \xF6 \xF7 ", }, /* 3.2.4 All 4 first bytes of 5-byte sequences, followed by space */ { "\"\xF8 \xF9 \xFA \xFB \"", NULL, /* bug: rejected */ "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", "\xF8 \xF9 \xFA \xFB ", }, /* 3.2.5 All 2 first bytes of 6-byte sequences, followed by space */ { "\"\xFC \xFD \"", NULL, /* bug: rejected */ "\"\\uFFFD \\uFFFD \"", "\xFC \xFD ", }, /* 3.3 Sequences with last continuation byte missing */ /* 3.3.1 2-byte sequence with last byte missing (U+0000) */ { "\"\xC0\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xC0", }, /* 3.3.2 3-byte sequence with last byte missing (U+0000) */ { "\"\xE0\x80\"", "\xE0\x80", /* bug: not corrected */ "\"\\uFFFD\"", }, /* 3.3.3 4-byte sequence with last byte missing (U+0000) */ { "\"\xF0\x80\x80\"", "\xF0\x80\x80", /* bug: not corrected */ "\"\\uFFFD\"", }, /* 3.3.4 5-byte sequence with last byte missing (U+0000) */ { "\"\xF8\x80\x80\x80\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xF8\x80\x80\x80", }, /* 3.3.5 6-byte sequence with last byte missing (U+0000) */ { "\"\xFC\x80\x80\x80\x80\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xFC\x80\x80\x80\x80", }, /* 3.3.6 2-byte sequence with last byte missing (U+07FF) */ { "\"\xDF\"", "\xDF", /* bug: not corrected */ "\"\\uFFFD\"", }, /* 3.3.7 3-byte sequence with last byte missing (U+FFFF) */ { "\"\xEF\xBF\"", "\xEF\xBF", /* bug: not corrected */ "\"\\uFFFD\"", }, /* 3.3.8 4-byte sequence with last byte missing (U+1FFFFF) */ { "\"\xF7\xBF\xBF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xF7\xBF\xBF", }, /* 3.3.9 5-byte sequence with last byte missing (U+3FFFFFF) */ { "\"\xFB\xBF\xBF\xBF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xFB\xBF\xBF\xBF", }, /* 3.3.10 6-byte sequence with last byte missing (U+7FFFFFFF) */ { "\"\xFD\xBF\xBF\xBF\xBF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xFD\xBF\xBF\xBF\xBF", }, /* 3.4 Concatenation of incomplete sequences */ { "\"\xC0\xE0\x80\xF0\x80\x80\xF8\x80\x80\x80\xFC\x80\x80\x80\x80" "\xDF\xEF\xBF\xF7\xBF\xBF\xFB\xBF\xBF\xBF\xFD\xBF\xBF\xBF\xBF\"", NULL, /* bug: rejected */ "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", "\xC0\xE0\x80\xF0\x80\x80\xF8\x80\x80\x80\xFC\x80\x80\x80\x80" "\xDF\xEF\xBF\xF7\xBF\xBF\xFB\xBF\xBF\xBF\xFD\xBF\xBF\xBF\xBF", }, /* 3.5 Impossible bytes */ { "\"\xFE\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xFE", }, { "\"\xFF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xFF", }, { "\"\xFE\xFE\xFF\xFF\"", NULL, /* bug: rejected */ "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", "\xFE\xFE\xFF\xFF", }, /* 4 Overlong sequences */ /* 4.1 Overlong '/' */ { "\"\xC0\xAF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xC0\xAF", }, { "\"\xE0\x80\xAF\"", "\xE0\x80\xAF", /* bug: not corrected */ "\"\\uFFFD\"", }, { "\"\xF0\x80\x80\xAF\"", "\xF0\x80\x80\xAF", /* bug: not corrected */ "\"\\uFFFD\"", }, { "\"\xF8\x80\x80\x80\xAF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xF8\x80\x80\x80\xAF", }, { "\"\xFC\x80\x80\x80\x80\xAF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xFC\x80\x80\x80\x80\xAF", }, /* * 4.2 Maximum overlong sequences * Highest Unicode value that is still resulting in an * overlong sequence if represented with the given number of * bytes. This is a boundary test for safe UTF-8 decoders. */ { /* \U+007F */ "\"\xC1\xBF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xC1\xBF", }, { /* \U+07FF */ "\"\xE0\x9F\xBF\"", "\xE0\x9F\xBF", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* * \U+FFFC * The actual maximum would be U+FFFF, but that's a * noncharacter. Testing U+FFFC seems more useful. See * also 2.2.3 */ "\"\xF0\x8F\xBF\xBC\"", "\xF0\x8F\xBF\xBC", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* \U+1FFFFF */ "\"\xF8\x87\xBF\xBF\xBF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xF8\x87\xBF\xBF\xBF", }, { /* \U+3FFFFFF */ "\"\xFC\x83\xBF\xBF\xBF\xBF\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xFC\x83\xBF\xBF\xBF\xBF", }, /* 4.3 Overlong representation of the NUL character */ { /* \U+0000 */ "\"\xC0\x80\"", NULL, /* bug: rejected */ "\"\\u0000\"", "\xC0\x80", }, { /* \U+0000 */ "\"\xE0\x80\x80\"", "\xE0\x80\x80", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* \U+0000 */ "\"\xF0\x80\x80\x80\"", "\xF0\x80\x80\x80", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* \U+0000 */ "\"\xF8\x80\x80\x80\x80\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xF8\x80\x80\x80\x80", }, { /* \U+0000 */ "\"\xFC\x80\x80\x80\x80\x80\"", NULL, /* bug: rejected */ "\"\\uFFFD\"", "\xFC\x80\x80\x80\x80\x80", }, /* 5 Illegal code positions */ /* 5.1 Single UTF-16 surrogates */ { /* \U+D800 */ "\"\xED\xA0\x80\"", "\xED\xA0\x80", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* \U+DB7F */ "\"\xED\xAD\xBF\"", "\xED\xAD\xBF", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* \U+DB80 */ "\"\xED\xAE\x80\"", "\xED\xAE\x80", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* \U+DBFF */ "\"\xED\xAF\xBF\"", "\xED\xAF\xBF", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* \U+DC00 */ "\"\xED\xB0\x80\"", "\xED\xB0\x80", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* \U+DF80 */ "\"\xED\xBE\x80\"", "\xED\xBE\x80", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* \U+DFFF */ "\"\xED\xBF\xBF\"", "\xED\xBF\xBF", /* bug: not corrected */ "\"\\uFFFD\"", }, /* 5.2 Paired UTF-16 surrogates */ { /* \U+D800\U+DC00 */ "\"\xED\xA0\x80\xED\xB0\x80\"", "\xED\xA0\x80\xED\xB0\x80", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\"", }, { /* \U+D800\U+DFFF */ "\"\xED\xA0\x80\xED\xBF\xBF\"", "\xED\xA0\x80\xED\xBF\xBF", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\"", }, { /* \U+DB7F\U+DC00 */ "\"\xED\xAD\xBF\xED\xB0\x80\"", "\xED\xAD\xBF\xED\xB0\x80", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\"", }, { /* \U+DB7F\U+DFFF */ "\"\xED\xAD\xBF\xED\xBF\xBF\"", "\xED\xAD\xBF\xED\xBF\xBF", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\"", }, { /* \U+DB80\U+DC00 */ "\"\xED\xAE\x80\xED\xB0\x80\"", "\xED\xAE\x80\xED\xB0\x80", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\"", }, { /* \U+DB80\U+DFFF */ "\"\xED\xAE\x80\xED\xBF\xBF\"", "\xED\xAE\x80\xED\xBF\xBF", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\"", }, { /* \U+DBFF\U+DC00 */ "\"\xED\xAF\xBF\xED\xB0\x80\"", "\xED\xAF\xBF\xED\xB0\x80", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\"", }, { /* \U+DBFF\U+DFFF */ "\"\xED\xAF\xBF\xED\xBF\xBF\"", "\xED\xAF\xBF\xED\xBF\xBF", /* bug: not corrected */ "\"\\uFFFD\\uFFFD\"", }, /* 5.3 Other illegal code positions */ /* BMP noncharacters */ { /* \U+FFFE */ "\"\xEF\xBF\xBE\"", "\xEF\xBF\xBE", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* \U+FFFF */ "\"\xEF\xBF\xBF\"", "\xEF\xBF\xBF", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* U+FDD0 */ "\"\xEF\xB7\x90\"", "\xEF\xB7\x90", /* bug: not corrected */ "\"\\uFFFD\"", }, { /* U+FDEF */ "\"\xEF\xB7\xAF\"", "\xEF\xB7\xAF", /* bug: not corrected */ "\"\\uFFFD\"", }, /* Plane 1 .. 16 noncharacters */ { /* U+1FFFE U+1FFFF U+2FFFE U+2FFFF ... U+10FFFE U+10FFFF */ "\"\xF0\x9F\xBF\xBE\xF0\x9F\xBF\xBF" "\xF0\xAF\xBF\xBE\xF0\xAF\xBF\xBF" "\xF0\xBF\xBF\xBE\xF0\xBF\xBF\xBF" "\xF1\x8F\xBF\xBE\xF1\x8F\xBF\xBF" "\xF1\x9F\xBF\xBE\xF1\x9F\xBF\xBF" "\xF1\xAF\xBF\xBE\xF1\xAF\xBF\xBF" "\xF1\xBF\xBF\xBE\xF1\xBF\xBF\xBF" "\xF2\x8F\xBF\xBE\xF2\x8F\xBF\xBF" "\xF2\x9F\xBF\xBE\xF2\x9F\xBF\xBF" "\xF2\xAF\xBF\xBE\xF2\xAF\xBF\xBF" "\xF2\xBF\xBF\xBE\xF2\xBF\xBF\xBF" "\xF3\x8F\xBF\xBE\xF3\x8F\xBF\xBF" "\xF3\x9F\xBF\xBE\xF3\x9F\xBF\xBF" "\xF3\xAF\xBF\xBE\xF3\xAF\xBF\xBF" "\xF3\xBF\xBF\xBE\xF3\xBF\xBF\xBF" "\xF4\x8F\xBF\xBE\xF4\x8F\xBF\xBF\"", /* bug: not corrected */ "\xF0\x9F\xBF\xBE\xF0\x9F\xBF\xBF" "\xF0\xAF\xBF\xBE\xF0\xAF\xBF\xBF" "\xF0\xBF\xBF\xBE\xF0\xBF\xBF\xBF" "\xF1\x8F\xBF\xBE\xF1\x8F\xBF\xBF" "\xF1\x9F\xBF\xBE\xF1\x9F\xBF\xBF" "\xF1\xAF\xBF\xBE\xF1\xAF\xBF\xBF" "\xF1\xBF\xBF\xBE\xF1\xBF\xBF\xBF" "\xF2\x8F\xBF\xBE\xF2\x8F\xBF\xBF" "\xF2\x9F\xBF\xBE\xF2\x9F\xBF\xBF" "\xF2\xAF\xBF\xBE\xF2\xAF\xBF\xBF" "\xF2\xBF\xBF\xBE\xF2\xBF\xBF\xBF" "\xF3\x8F\xBF\xBE\xF3\x8F\xBF\xBF" "\xF3\x9F\xBF\xBE\xF3\x9F\xBF\xBF" "\xF3\xAF\xBF\xBE\xF3\xAF\xBF\xBF" "\xF3\xBF\xBF\xBE\xF3\xBF\xBF\xBF" "\xF4\x8F\xBF\xBE\xF4\x8F\xBF\xBF", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, {} }; int i; QObject *obj; QString *str; const char *json_in, *utf8_out, *utf8_in, *json_out; for (i = 0; test_cases[i].json_in; i++) { json_in = test_cases[i].json_in; utf8_out = test_cases[i].utf8_out; utf8_in = test_cases[i].utf8_in ?: test_cases[i].utf8_out; json_out = test_cases[i].json_out ?: test_cases[i].json_in; obj = qobject_from_json(json_in, NULL); if (utf8_out) { str = qobject_to_qstring(obj); g_assert(str); g_assert_cmpstr(qstring_get_str(str), ==, utf8_out); } else { g_assert(!obj); } qobject_decref(obj); obj = QOBJECT(qstring_from_str(utf8_in)); str = qobject_to_json(obj); if (json_out) { g_assert(str); g_assert_cmpstr(qstring_get_str(str), ==, json_out); } else { g_assert(!str); } QDECREF(str); qobject_decref(obj); /* * Disabled, because qobject_from_json() is buggy, and I can't * be bothered to add the expected incorrect results. * FIXME Enable once these bugs have been fixed. */ if (0 && json_out != json_in) { obj = qobject_from_json(json_out, NULL); str = qobject_to_qstring(obj); g_assert(str); g_assert_cmpstr(qstring_get_str(str), ==, utf8_out); } } }
true
qemu
aec4b054ea36c53c8b887da99f20010133b84378
static void utf8_string(void) { static const struct { const char *json_in; const char *utf8_out; const char *json_out; const char *utf8_in; } test_cases[] = { { "\"Falsches \xC3\x9C" "ben von Xylophonmusik qu\xC3\xA4lt" " jeden gr\xC3\xB6\xC3\x9F" "eren Zwerg.\"", "Falsches \xC3\x9C" "ben von Xylophonmusik qu\xC3\xA4lt" " jeden gr\xC3\xB6\xC3\x9F" "eren Zwerg.", "\"Falsches \\u00DCben von Xylophonmusik qu\\u00E4lt" " jeden gr\\u00F6\\u00DFeren Zwerg.\"", }, { "\"\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5\"", "\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5", "\"\\u03BA\\u1F79\\u03C3\\u03BC\\u03B5\"", }, { "\"\\u0000\"", "", "\"\\u0000\"", "\xC0\x80", }, { "\"\xC2\x80\"", "\xC2\x80", "\"\\u0080\"", }, { "\"\xE0\xA0\x80\"", "\xE0\xA0\x80", "\"\\u0800\"", }, { "\"\xF0\x90\x80\x80\"", "\xF0\x90\x80\x80", "\"\\uD800\\uDC00\"", }, { "\"\xF8\x88\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xF8\x88\x80\x80\x80", }, { "\"\xFC\x84\x80\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xFC\x84\x80\x80\x80\x80", }, { "\"\x7F\"", "\x7F", "\"\\u007F\"", }, { "\"\xDF\xBF\"", "\xDF\xBF", "\"\\u07FF\"", }, { "\"\xEF\xBF\xBC\"", "\xEF\xBF\xBC", "\"\\uFFFC\"", }, { "\"\xF7\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xF7\xBF\xBF\xBF", }, { "\"\xFB\xBF\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xFB\xBF\xBF\xBF\xBF", }, { "\"\xFD\xBF\xBF\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xFD\xBF\xBF\xBF\xBF\xBF", }, { "\"\xED\x9F\xBF\"", "\xED\x9F\xBF", "\"\\uD7FF\"", }, { "\"\xEE\x80\x80\"", "\xEE\x80\x80", "\"\\uE000\"", }, { "\"\xEF\xBF\xBD\"", "\xEF\xBF\xBD", "\"\\uFFFD\"", }, { "\"\xF4\x8F\xBF\xBD\"", "\xF4\x8F\xBF\xBD", "\"\\uDBFF\\uDFFD\"" }, { "\"\xF4\x90\x80\x80\"", "\xF4\x90\x80\x80", "\"\\uFFFD\"", }, { "\"\x80\"", "\x80", "\"\\uFFFD\"", }, { "\"\xBF\"", "\xBF", "\"\\uFFFD\"", }, { "\"\x80\xBF\"", "\x80\xBF", "\"\\uFFFD\\uFFFD\"", }, { "\"\x80\xBF\x80\"", "\x80\xBF\x80", "\"\\uFFFD\\uFFFD\\uFFFD\"", }, { "\"\x80\xBF\x80\xBF\"", "\x80\xBF\x80\xBF", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, { "\"\x80\xBF\x80\xBF\x80\"", "\x80\xBF\x80\xBF\x80", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, { "\"\x80\xBF\x80\xBF\x80\xBF\"", "\x80\xBF\x80\xBF\x80\xBF", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, { "\"\x80\xBF\x80\xBF\x80\xBF\x80\"", "\x80\xBF\x80\xBF\x80\xBF\x80", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, { "\"\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F" "\x90\x91\x92\x93\x94\x95\x96\x97" "\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F" "\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7" "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF" "\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7" "\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\"", "\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F" "\x90\x91\x92\x93\x94\x95\x96\x97" "\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F" "\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7" "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF" "\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7" "\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"" }, { "\"\xC0 \xC1 \xC2 \xC3 \xC4 \xC5 \xC6 \xC7 " "\xC8 \xC9 \xCA \xCB \xCC \xCD \xCE \xCF " "\xD0 \xD1 \xD2 \xD3 \xD4 \xD5 \xD6 \xD7 " "\xD8 \xD9 \xDA \xDB \xDC \xDD \xDE \xDF \"", NULL, "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", "\xC0 \xC1 \xC2 \xC3 \xC4 \xC5 \xC6 \xC7 " "\xC8 \xC9 \xCA \xCB \xCC \xCD \xCE \xCF " "\xD0 \xD1 \xD2 \xD3 \xD4 \xD5 \xD6 \xD7 " "\xD8 \xD9 \xDA \xDB \xDC \xDD \xDE \xDF ", }, { "\"\xE0 \xE1 \xE2 \xE3 \xE4 \xE5 \xE6 \xE7 " "\xE8 \xE9 \xEA \xEB \xEC \xED \xEE \xEF \"", "\xE0 \xE1 \xE2 \xE3 \xE4 \xE5 \xE6 \xE7 " "\xE8 \xE9 \xEA \xEB \xEC \xED \xEE \xEF ", "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", }, { "\"\xF0 \xF1 \xF2 \xF3 \xF4 \xF5 \xF6 \xF7 \"", NULL, "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", "\xF0 \xF1 \xF2 \xF3 \xF4 \xF5 \xF6 \xF7 ", }, { "\"\xF8 \xF9 \xFA \xFB \"", NULL, "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", "\xF8 \xF9 \xFA \xFB ", }, { "\"\xFC \xFD \"", NULL, "\"\\uFFFD \\uFFFD \"", "\xFC \xFD ", }, { "\"\xC0\"", NULL, "\"\\uFFFD\"", "\xC0", }, { "\"\xE0\x80\"", "\xE0\x80", "\"\\uFFFD\"", }, { "\"\xF0\x80\x80\"", "\xF0\x80\x80", "\"\\uFFFD\"", }, { "\"\xF8\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xF8\x80\x80\x80", }, { "\"\xFC\x80\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xFC\x80\x80\x80\x80", }, { "\"\xDF\"", "\xDF", "\"\\uFFFD\"", }, { "\"\xEF\xBF\"", "\xEF\xBF", "\"\\uFFFD\"", }, { "\"\xF7\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xF7\xBF\xBF", }, { "\"\xFB\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xFB\xBF\xBF\xBF", }, { "\"\xFD\xBF\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xFD\xBF\xBF\xBF\xBF", }, { "\"\xC0\xE0\x80\xF0\x80\x80\xF8\x80\x80\x80\xFC\x80\x80\x80\x80" "\xDF\xEF\xBF\xF7\xBF\xBF\xFB\xBF\xBF\xBF\xFD\xBF\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", "\xC0\xE0\x80\xF0\x80\x80\xF8\x80\x80\x80\xFC\x80\x80\x80\x80" "\xDF\xEF\xBF\xF7\xBF\xBF\xFB\xBF\xBF\xBF\xFD\xBF\xBF\xBF\xBF", }, { "\"\xFE\"", NULL, "\"\\uFFFD\"", "\xFE", }, { "\"\xFF\"", NULL, "\"\\uFFFD\"", "\xFF", }, { "\"\xFE\xFE\xFF\xFF\"", NULL, "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", "\xFE\xFE\xFF\xFF", }, { "\"\xC0\xAF\"", NULL, "\"\\uFFFD\"", "\xC0\xAF", }, { "\"\xE0\x80\xAF\"", "\xE0\x80\xAF", "\"\\uFFFD\"", }, { "\"\xF0\x80\x80\xAF\"", "\xF0\x80\x80\xAF", "\"\\uFFFD\"", }, { "\"\xF8\x80\x80\x80\xAF\"", NULL, "\"\\uFFFD\"", "\xF8\x80\x80\x80\xAF", }, { "\"\xFC\x80\x80\x80\x80\xAF\"", NULL, "\"\\uFFFD\"", "\xFC\x80\x80\x80\x80\xAF", }, { "\"\xC1\xBF\"", NULL, "\"\\uFFFD\"", "\xC1\xBF", }, { "\"\xE0\x9F\xBF\"", "\xE0\x9F\xBF", "\"\\uFFFD\"", }, { "\"\xF0\x8F\xBF\xBC\"", "\xF0\x8F\xBF\xBC", "\"\\uFFFD\"", }, { "\"\xF8\x87\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xF8\x87\xBF\xBF\xBF", }, { "\"\xFC\x83\xBF\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xFC\x83\xBF\xBF\xBF\xBF", }, { "\"\xC0\x80\"", NULL, "\"\\u0000\"", "\xC0\x80", }, { "\"\xE0\x80\x80\"", "\xE0\x80\x80", "\"\\uFFFD\"", }, { "\"\xF0\x80\x80\x80\"", "\xF0\x80\x80\x80", "\"\\uFFFD\"", }, { "\"\xF8\x80\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xF8\x80\x80\x80\x80", }, { "\"\xFC\x80\x80\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xFC\x80\x80\x80\x80\x80", }, { "\"\xED\xA0\x80\"", "\xED\xA0\x80", "\"\\uFFFD\"", }, { "\"\xED\xAD\xBF\"", "\xED\xAD\xBF", "\"\\uFFFD\"", }, { "\"\xED\xAE\x80\"", "\xED\xAE\x80", "\"\\uFFFD\"", }, { "\"\xED\xAF\xBF\"", "\xED\xAF\xBF", "\"\\uFFFD\"", }, { "\"\xED\xB0\x80\"", "\xED\xB0\x80", "\"\\uFFFD\"", }, { "\"\xED\xBE\x80\"", "\xED\xBE\x80", "\"\\uFFFD\"", }, { "\"\xED\xBF\xBF\"", "\xED\xBF\xBF", "\"\\uFFFD\"", }, { "\"\xED\xA0\x80\xED\xB0\x80\"", "\xED\xA0\x80\xED\xB0\x80", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xA0\x80\xED\xBF\xBF\"", "\xED\xA0\x80\xED\xBF\xBF", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAD\xBF\xED\xB0\x80\"", "\xED\xAD\xBF\xED\xB0\x80", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAD\xBF\xED\xBF\xBF\"", "\xED\xAD\xBF\xED\xBF\xBF", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAE\x80\xED\xB0\x80\"", "\xED\xAE\x80\xED\xB0\x80", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAE\x80\xED\xBF\xBF\"", "\xED\xAE\x80\xED\xBF\xBF", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAF\xBF\xED\xB0\x80\"", "\xED\xAF\xBF\xED\xB0\x80", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAF\xBF\xED\xBF\xBF\"", "\xED\xAF\xBF\xED\xBF\xBF", "\"\\uFFFD\\uFFFD\"", }, { "\"\xEF\xBF\xBE\"", "\xEF\xBF\xBE", "\"\\uFFFD\"", }, { "\"\xEF\xBF\xBF\"", "\xEF\xBF\xBF", "\"\\uFFFD\"", }, { "\"\xEF\xB7\x90\"", "\xEF\xB7\x90", "\"\\uFFFD\"", }, { "\"\xEF\xB7\xAF\"", "\xEF\xB7\xAF", "\"\\uFFFD\"", }, { "\"\xF0\x9F\xBF\xBE\xF0\x9F\xBF\xBF" "\xF0\xAF\xBF\xBE\xF0\xAF\xBF\xBF" "\xF0\xBF\xBF\xBE\xF0\xBF\xBF\xBF" "\xF1\x8F\xBF\xBE\xF1\x8F\xBF\xBF" "\xF1\x9F\xBF\xBE\xF1\x9F\xBF\xBF" "\xF1\xAF\xBF\xBE\xF1\xAF\xBF\xBF" "\xF1\xBF\xBF\xBE\xF1\xBF\xBF\xBF" "\xF2\x8F\xBF\xBE\xF2\x8F\xBF\xBF" "\xF2\x9F\xBF\xBE\xF2\x9F\xBF\xBF" "\xF2\xAF\xBF\xBE\xF2\xAF\xBF\xBF" "\xF2\xBF\xBF\xBE\xF2\xBF\xBF\xBF" "\xF3\x8F\xBF\xBE\xF3\x8F\xBF\xBF" "\xF3\x9F\xBF\xBE\xF3\x9F\xBF\xBF" "\xF3\xAF\xBF\xBE\xF3\xAF\xBF\xBF" "\xF3\xBF\xBF\xBE\xF3\xBF\xBF\xBF" "\xF4\x8F\xBF\xBE\xF4\x8F\xBF\xBF\"", "\xF0\x9F\xBF\xBE\xF0\x9F\xBF\xBF" "\xF0\xAF\xBF\xBE\xF0\xAF\xBF\xBF" "\xF0\xBF\xBF\xBE\xF0\xBF\xBF\xBF" "\xF1\x8F\xBF\xBE\xF1\x8F\xBF\xBF" "\xF1\x9F\xBF\xBE\xF1\x9F\xBF\xBF" "\xF1\xAF\xBF\xBE\xF1\xAF\xBF\xBF" "\xF1\xBF\xBF\xBE\xF1\xBF\xBF\xBF" "\xF2\x8F\xBF\xBE\xF2\x8F\xBF\xBF" "\xF2\x9F\xBF\xBE\xF2\x9F\xBF\xBF" "\xF2\xAF\xBF\xBE\xF2\xAF\xBF\xBF" "\xF2\xBF\xBF\xBE\xF2\xBF\xBF\xBF" "\xF3\x8F\xBF\xBE\xF3\x8F\xBF\xBF" "\xF3\x9F\xBF\xBE\xF3\x9F\xBF\xBF" "\xF3\xAF\xBF\xBE\xF3\xAF\xBF\xBF" "\xF3\xBF\xBF\xBE\xF3\xBF\xBF\xBF" "\xF4\x8F\xBF\xBE\xF4\x8F\xBF\xBF", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, {} }; int i; QObject *obj; QString *str; const char *json_in, *utf8_out, *utf8_in, *json_out; for (i = 0; test_cases[i].json_in; i++) { json_in = test_cases[i].json_in; utf8_out = test_cases[i].utf8_out; utf8_in = test_cases[i].utf8_in ?: test_cases[i].utf8_out; json_out = test_cases[i].json_out ?: test_cases[i].json_in; obj = qobject_from_json(json_in, NULL); if (utf8_out) { str = qobject_to_qstring(obj); g_assert(str); g_assert_cmpstr(qstring_get_str(str), ==, utf8_out); } else { g_assert(!obj); } qobject_decref(obj); obj = QOBJECT(qstring_from_str(utf8_in)); str = qobject_to_json(obj); if (json_out) { g_assert(str); g_assert_cmpstr(qstring_get_str(str), ==, json_out); } else { g_assert(!str); } QDECREF(str); qobject_decref(obj); if (0 && json_out != json_in) { obj = qobject_from_json(json_out, NULL); str = qobject_to_qstring(obj); g_assert(str); g_assert_cmpstr(qstring_get_str(str), ==, utf8_out); } } }
{ "code": [ " obj = qobject_from_json(json_in, NULL);", " obj = qobject_from_json(json_out, NULL);" ], "line_no": [ 1369, 1423 ] }
static void FUNC_0(void) { static const struct { const char *VAR_2; const char *VAR_3; const char *VAR_5; const char *VAR_4; } VAR_0[] = { { "\"Falsches \xC3\x9C" "ben von Xylophonmusik qu\xC3\xA4lt" " jeden gr\xC3\xB6\xC3\x9F" "eren Zwerg.\"", "Falsches \xC3\x9C" "ben von Xylophonmusik qu\xC3\xA4lt" " jeden gr\xC3\xB6\xC3\x9F" "eren Zwerg.", "\"Falsches \\u00DCben von Xylophonmusik qu\\u00E4lt" " jeden gr\\u00F6\\u00DFeren Zwerg.\"", }, { "\"\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5\"", "\xCE\xBA\xE1\xBD\xB9\xCF\x83\xCE\xBC\xCE\xB5", "\"\\u03BA\\u1F79\\u03C3\\u03BC\\u03B5\"", }, { "\"\\u0000\"", "", "\"\\u0000\"", "\xC0\x80", }, { "\"\xC2\x80\"", "\xC2\x80", "\"\\u0080\"", }, { "\"\xE0\xA0\x80\"", "\xE0\xA0\x80", "\"\\u0800\"", }, { "\"\xF0\x90\x80\x80\"", "\xF0\x90\x80\x80", "\"\\uD800\\uDC00\"", }, { "\"\xF8\x88\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xF8\x88\x80\x80\x80", }, { "\"\xFC\x84\x80\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xFC\x84\x80\x80\x80\x80", }, { "\"\x7F\"", "\x7F", "\"\\u007F\"", }, { "\"\xDF\xBF\"", "\xDF\xBF", "\"\\u07FF\"", }, { "\"\xEF\xBF\xBC\"", "\xEF\xBF\xBC", "\"\\uFFFC\"", }, { "\"\xF7\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xF7\xBF\xBF\xBF", }, { "\"\xFB\xBF\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xFB\xBF\xBF\xBF\xBF", }, { "\"\xFD\xBF\xBF\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xFD\xBF\xBF\xBF\xBF\xBF", }, { "\"\xED\x9F\xBF\"", "\xED\x9F\xBF", "\"\\uD7FF\"", }, { "\"\xEE\x80\x80\"", "\xEE\x80\x80", "\"\\uE000\"", }, { "\"\xEF\xBF\xBD\"", "\xEF\xBF\xBD", "\"\\uFFFD\"", }, { "\"\xF4\x8F\xBF\xBD\"", "\xF4\x8F\xBF\xBD", "\"\\uDBFF\\uDFFD\"" }, { "\"\xF4\x90\x80\x80\"", "\xF4\x90\x80\x80", "\"\\uFFFD\"", }, { "\"\x80\"", "\x80", "\"\\uFFFD\"", }, { "\"\xBF\"", "\xBF", "\"\\uFFFD\"", }, { "\"\x80\xBF\"", "\x80\xBF", "\"\\uFFFD\\uFFFD\"", }, { "\"\x80\xBF\x80\"", "\x80\xBF\x80", "\"\\uFFFD\\uFFFD\\uFFFD\"", }, { "\"\x80\xBF\x80\xBF\"", "\x80\xBF\x80\xBF", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, { "\"\x80\xBF\x80\xBF\x80\"", "\x80\xBF\x80\xBF\x80", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, { "\"\x80\xBF\x80\xBF\x80\xBF\"", "\x80\xBF\x80\xBF\x80\xBF", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, { "\"\x80\xBF\x80\xBF\x80\xBF\x80\"", "\x80\xBF\x80\xBF\x80\xBF\x80", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, { "\"\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F" "\x90\x91\x92\x93\x94\x95\x96\x97" "\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F" "\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7" "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF" "\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7" "\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\"", "\x80\x81\x82\x83\x84\x85\x86\x87" "\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F" "\x90\x91\x92\x93\x94\x95\x96\x97" "\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F" "\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7" "\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF" "\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7" "\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"" }, { "\"\xC0 \xC1 \xC2 \xC3 \xC4 \xC5 \xC6 \xC7 " "\xC8 \xC9 \xCA \xCB \xCC \xCD \xCE \xCF " "\xD0 \xD1 \xD2 \xD3 \xD4 \xD5 \xD6 \xD7 " "\xD8 \xD9 \xDA \xDB \xDC \xDD \xDE \xDF \"", NULL, "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", "\xC0 \xC1 \xC2 \xC3 \xC4 \xC5 \xC6 \xC7 " "\xC8 \xC9 \xCA \xCB \xCC \xCD \xCE \xCF " "\xD0 \xD1 \xD2 \xD3 \xD4 \xD5 \xD6 \xD7 " "\xD8 \xD9 \xDA \xDB \xDC \xDD \xDE \xDF ", }, { "\"\xE0 \xE1 \xE2 \xE3 \xE4 \xE5 \xE6 \xE7 " "\xE8 \xE9 \xEA \xEB \xEC \xED \xEE \xEF \"", "\xE0 \xE1 \xE2 \xE3 \xE4 \xE5 \xE6 \xE7 " "\xE8 \xE9 \xEA \xEB \xEC \xED \xEE \xEF ", "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD " "\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", }, { "\"\xF0 \xF1 \xF2 \xF3 \xF4 \xF5 \xF6 \xF7 \"", NULL, "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", "\xF0 \xF1 \xF2 \xF3 \xF4 \xF5 \xF6 \xF7 ", }, { "\"\xF8 \xF9 \xFA \xFB \"", NULL, "\"\\uFFFD \\uFFFD \\uFFFD \\uFFFD \"", "\xF8 \xF9 \xFA \xFB ", }, { "\"\xFC \xFD \"", NULL, "\"\\uFFFD \\uFFFD \"", "\xFC \xFD ", }, { "\"\xC0\"", NULL, "\"\\uFFFD\"", "\xC0", }, { "\"\xE0\x80\"", "\xE0\x80", "\"\\uFFFD\"", }, { "\"\xF0\x80\x80\"", "\xF0\x80\x80", "\"\\uFFFD\"", }, { "\"\xF8\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xF8\x80\x80\x80", }, { "\"\xFC\x80\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xFC\x80\x80\x80\x80", }, { "\"\xDF\"", "\xDF", "\"\\uFFFD\"", }, { "\"\xEF\xBF\"", "\xEF\xBF", "\"\\uFFFD\"", }, { "\"\xF7\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xF7\xBF\xBF", }, { "\"\xFB\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xFB\xBF\xBF\xBF", }, { "\"\xFD\xBF\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xFD\xBF\xBF\xBF\xBF", }, { "\"\xC0\xE0\x80\xF0\x80\x80\xF8\x80\x80\x80\xFC\x80\x80\x80\x80" "\xDF\xEF\xBF\xF7\xBF\xBF\xFB\xBF\xBF\xBF\xFD\xBF\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", "\xC0\xE0\x80\xF0\x80\x80\xF8\x80\x80\x80\xFC\x80\x80\x80\x80" "\xDF\xEF\xBF\xF7\xBF\xBF\xFB\xBF\xBF\xBF\xFD\xBF\xBF\xBF\xBF", }, { "\"\xFE\"", NULL, "\"\\uFFFD\"", "\xFE", }, { "\"\xFF\"", NULL, "\"\\uFFFD\"", "\xFF", }, { "\"\xFE\xFE\xFF\xFF\"", NULL, "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", "\xFE\xFE\xFF\xFF", }, { "\"\xC0\xAF\"", NULL, "\"\\uFFFD\"", "\xC0\xAF", }, { "\"\xE0\x80\xAF\"", "\xE0\x80\xAF", "\"\\uFFFD\"", }, { "\"\xF0\x80\x80\xAF\"", "\xF0\x80\x80\xAF", "\"\\uFFFD\"", }, { "\"\xF8\x80\x80\x80\xAF\"", NULL, "\"\\uFFFD\"", "\xF8\x80\x80\x80\xAF", }, { "\"\xFC\x80\x80\x80\x80\xAF\"", NULL, "\"\\uFFFD\"", "\xFC\x80\x80\x80\x80\xAF", }, { "\"\xC1\xBF\"", NULL, "\"\\uFFFD\"", "\xC1\xBF", }, { "\"\xE0\x9F\xBF\"", "\xE0\x9F\xBF", "\"\\uFFFD\"", }, { "\"\xF0\x8F\xBF\xBC\"", "\xF0\x8F\xBF\xBC", "\"\\uFFFD\"", }, { "\"\xF8\x87\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xF8\x87\xBF\xBF\xBF", }, { "\"\xFC\x83\xBF\xBF\xBF\xBF\"", NULL, "\"\\uFFFD\"", "\xFC\x83\xBF\xBF\xBF\xBF", }, { "\"\xC0\x80\"", NULL, "\"\\u0000\"", "\xC0\x80", }, { "\"\xE0\x80\x80\"", "\xE0\x80\x80", "\"\\uFFFD\"", }, { "\"\xF0\x80\x80\x80\"", "\xF0\x80\x80\x80", "\"\\uFFFD\"", }, { "\"\xF8\x80\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xF8\x80\x80\x80\x80", }, { "\"\xFC\x80\x80\x80\x80\x80\"", NULL, "\"\\uFFFD\"", "\xFC\x80\x80\x80\x80\x80", }, { "\"\xED\xA0\x80\"", "\xED\xA0\x80", "\"\\uFFFD\"", }, { "\"\xED\xAD\xBF\"", "\xED\xAD\xBF", "\"\\uFFFD\"", }, { "\"\xED\xAE\x80\"", "\xED\xAE\x80", "\"\\uFFFD\"", }, { "\"\xED\xAF\xBF\"", "\xED\xAF\xBF", "\"\\uFFFD\"", }, { "\"\xED\xB0\x80\"", "\xED\xB0\x80", "\"\\uFFFD\"", }, { "\"\xED\xBE\x80\"", "\xED\xBE\x80", "\"\\uFFFD\"", }, { "\"\xED\xBF\xBF\"", "\xED\xBF\xBF", "\"\\uFFFD\"", }, { "\"\xED\xA0\x80\xED\xB0\x80\"", "\xED\xA0\x80\xED\xB0\x80", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xA0\x80\xED\xBF\xBF\"", "\xED\xA0\x80\xED\xBF\xBF", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAD\xBF\xED\xB0\x80\"", "\xED\xAD\xBF\xED\xB0\x80", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAD\xBF\xED\xBF\xBF\"", "\xED\xAD\xBF\xED\xBF\xBF", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAE\x80\xED\xB0\x80\"", "\xED\xAE\x80\xED\xB0\x80", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAE\x80\xED\xBF\xBF\"", "\xED\xAE\x80\xED\xBF\xBF", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAF\xBF\xED\xB0\x80\"", "\xED\xAF\xBF\xED\xB0\x80", "\"\\uFFFD\\uFFFD\"", }, { "\"\xED\xAF\xBF\xED\xBF\xBF\"", "\xED\xAF\xBF\xED\xBF\xBF", "\"\\uFFFD\\uFFFD\"", }, { "\"\xEF\xBF\xBE\"", "\xEF\xBF\xBE", "\"\\uFFFD\"", }, { "\"\xEF\xBF\xBF\"", "\xEF\xBF\xBF", "\"\\uFFFD\"", }, { "\"\xEF\xB7\x90\"", "\xEF\xB7\x90", "\"\\uFFFD\"", }, { "\"\xEF\xB7\xAF\"", "\xEF\xB7\xAF", "\"\\uFFFD\"", }, { "\"\xF0\x9F\xBF\xBE\xF0\x9F\xBF\xBF" "\xF0\xAF\xBF\xBE\xF0\xAF\xBF\xBF" "\xF0\xBF\xBF\xBE\xF0\xBF\xBF\xBF" "\xF1\x8F\xBF\xBE\xF1\x8F\xBF\xBF" "\xF1\x9F\xBF\xBE\xF1\x9F\xBF\xBF" "\xF1\xAF\xBF\xBE\xF1\xAF\xBF\xBF" "\xF1\xBF\xBF\xBE\xF1\xBF\xBF\xBF" "\xF2\x8F\xBF\xBE\xF2\x8F\xBF\xBF" "\xF2\x9F\xBF\xBE\xF2\x9F\xBF\xBF" "\xF2\xAF\xBF\xBE\xF2\xAF\xBF\xBF" "\xF2\xBF\xBF\xBE\xF2\xBF\xBF\xBF" "\xF3\x8F\xBF\xBE\xF3\x8F\xBF\xBF" "\xF3\x9F\xBF\xBE\xF3\x9F\xBF\xBF" "\xF3\xAF\xBF\xBE\xF3\xAF\xBF\xBF" "\xF3\xBF\xBF\xBE\xF3\xBF\xBF\xBF" "\xF4\x8F\xBF\xBE\xF4\x8F\xBF\xBF\"", "\xF0\x9F\xBF\xBE\xF0\x9F\xBF\xBF" "\xF0\xAF\xBF\xBE\xF0\xAF\xBF\xBF" "\xF0\xBF\xBF\xBE\xF0\xBF\xBF\xBF" "\xF1\x8F\xBF\xBE\xF1\x8F\xBF\xBF" "\xF1\x9F\xBF\xBE\xF1\x9F\xBF\xBF" "\xF1\xAF\xBF\xBE\xF1\xAF\xBF\xBF" "\xF1\xBF\xBF\xBE\xF1\xBF\xBF\xBF" "\xF2\x8F\xBF\xBE\xF2\x8F\xBF\xBF" "\xF2\x9F\xBF\xBE\xF2\x9F\xBF\xBF" "\xF2\xAF\xBF\xBE\xF2\xAF\xBF\xBF" "\xF2\xBF\xBF\xBE\xF2\xBF\xBF\xBF" "\xF3\x8F\xBF\xBE\xF3\x8F\xBF\xBF" "\xF3\x9F\xBF\xBE\xF3\x9F\xBF\xBF" "\xF3\xAF\xBF\xBE\xF3\xAF\xBF\xBF" "\xF3\xBF\xBF\xBE\xF3\xBF\xBF\xBF" "\xF4\x8F\xBF\xBE\xF4\x8F\xBF\xBF", "\"\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD" "\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\\uFFFD\"", }, {} }; int VAR_1; QObject *obj; QString *str; const char *VAR_2, *VAR_3, *VAR_4, *VAR_5; for (VAR_1 = 0; VAR_0[VAR_1].VAR_2; VAR_1++) { VAR_2 = VAR_0[VAR_1].VAR_2; VAR_3 = VAR_0[VAR_1].VAR_3; VAR_4 = VAR_0[VAR_1].VAR_4 ?: VAR_0[VAR_1].VAR_3; VAR_5 = VAR_0[VAR_1].VAR_5 ?: VAR_0[VAR_1].VAR_2; obj = qobject_from_json(VAR_2, NULL); if (VAR_3) { str = qobject_to_qstring(obj); g_assert(str); g_assert_cmpstr(qstring_get_str(str), ==, VAR_3); } else { g_assert(!obj); } qobject_decref(obj); obj = QOBJECT(qstring_from_str(VAR_4)); str = qobject_to_json(obj); if (VAR_5) { g_assert(str); g_assert_cmpstr(qstring_get_str(str), ==, VAR_5); } else { g_assert(!str); } QDECREF(str); qobject_decref(obj); if (0 && VAR_5 != VAR_2) { obj = qobject_from_json(VAR_5, NULL); str = qobject_to_qstring(obj); g_assert(str); g_assert_cmpstr(qstring_get_str(str), ==, VAR_3); } } }
[ "static void FUNC_0(void)\n{", "static const struct {", "const char *VAR_2;", "const char *VAR_3;", "const char *VAR_5;", "const char *VAR_4;", "} VAR_0[] = {", "{", "\"\\\"Falsches \\xC3\\x9C\" \"ben von Xylophonmusik qu\\xC3\\xA4lt\"\n\" jeden gr\\xC3\\xB6\\xC3\\x9F\" \"eren Zwerg.\\\"\",\n\"Falsches \\xC3\\x9C\" \"ben von Xylophonmusik qu\\xC3\\xA4lt\"\n\" jeden gr\\xC3\\xB6\\xC3\\x9F\" \"eren Zwerg.\",\n\"\\\"Falsches \\\\u00DCben von Xylophonmusik qu\\\\u00E4lt\"\n\" jeden gr\\\\u00F6\\\\u00DFeren Zwerg.\\\"\",\n},", "{", "\"\\\"\\xCE\\xBA\\xE1\\xBD\\xB9\\xCF\\x83\\xCE\\xBC\\xCE\\xB5\\\"\",\n\"\\xCE\\xBA\\xE1\\xBD\\xB9\\xCF\\x83\\xCE\\xBC\\xCE\\xB5\",\n\"\\\"\\\\u03BA\\\\u1F79\\\\u03C3\\\\u03BC\\\\u03B5\\\"\",\n},", "{", "\"\\\"\\\\u0000\\\"\",\n\"\",\n\"\\\"\\\\u0000\\\"\",\n\"\\xC0\\x80\",\n},", "{", "\"\\\"\\xC2\\x80\\\"\",\n\"\\xC2\\x80\",\n\"\\\"\\\\u0080\\\"\",\n},", "{", "\"\\\"\\xE0\\xA0\\x80\\\"\",\n\"\\xE0\\xA0\\x80\",\n\"\\\"\\\\u0800\\\"\",\n},", "{", "\"\\\"\\xF0\\x90\\x80\\x80\\\"\",\n\"\\xF0\\x90\\x80\\x80\",\n\"\\\"\\\\uD800\\\\uDC00\\\"\",\n},", "{", "\"\\\"\\xF8\\x88\\x80\\x80\\x80\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xF8\\x88\\x80\\x80\\x80\",\n},", "{", "\"\\\"\\xFC\\x84\\x80\\x80\\x80\\x80\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xFC\\x84\\x80\\x80\\x80\\x80\",\n},", "{", "\"\\\"\\x7F\\\"\",\n\"\\x7F\",\n\"\\\"\\\\u007F\\\"\",\n},", "{", "\"\\\"\\xDF\\xBF\\\"\",\n\"\\xDF\\xBF\",\n\"\\\"\\\\u07FF\\\"\",\n},", "{", "\"\\\"\\xEF\\xBF\\xBC\\\"\",\n\"\\xEF\\xBF\\xBC\",\n\"\\\"\\\\uFFFC\\\"\",\n},", "{", "\"\\\"\\xF7\\xBF\\xBF\\xBF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xF7\\xBF\\xBF\\xBF\",\n},", "{", "\"\\\"\\xFB\\xBF\\xBF\\xBF\\xBF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xFB\\xBF\\xBF\\xBF\\xBF\",\n},", "{", "\"\\\"\\xFD\\xBF\\xBF\\xBF\\xBF\\xBF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xFD\\xBF\\xBF\\xBF\\xBF\\xBF\",\n},", "{", "\"\\\"\\xED\\x9F\\xBF\\\"\",\n\"\\xED\\x9F\\xBF\",\n\"\\\"\\\\uD7FF\\\"\",\n},", "{", "\"\\\"\\xEE\\x80\\x80\\\"\",\n\"\\xEE\\x80\\x80\",\n\"\\\"\\\\uE000\\\"\",\n},", "{", "\"\\\"\\xEF\\xBF\\xBD\\\"\",\n\"\\xEF\\xBF\\xBD\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xF4\\x8F\\xBF\\xBD\\\"\",\n\"\\xF4\\x8F\\xBF\\xBD\",\n\"\\\"\\\\uDBFF\\\\uDFFD\\\"\"\n},", "{", "\"\\\"\\xF4\\x90\\x80\\x80\\\"\",\n\"\\xF4\\x90\\x80\\x80\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\x80\\\"\",\n\"\\x80\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xBF\\\"\",\n\"\\xBF\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\x80\\xBF\\\"\",\n\"\\x80\\xBF\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\x80\\xBF\\x80\\\"\",\n\"\\x80\\xBF\\x80\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\x80\\xBF\\x80\\xBF\\\"\",\n\"\\x80\\xBF\\x80\\xBF\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\x80\\xBF\\x80\\xBF\\x80\\\"\",\n\"\\x80\\xBF\\x80\\xBF\\x80\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\x80\\xBF\\x80\\xBF\\x80\\xBF\\\"\",\n\"\\x80\\xBF\\x80\\xBF\\x80\\xBF\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\x80\\xBF\\x80\\xBF\\x80\\xBF\\x80\\\"\",\n\"\\x80\\xBF\\x80\\xBF\\x80\\xBF\\x80\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\"\n\"\\x88\\x89\\x8A\\x8B\\x8C\\x8D\\x8E\\x8F\"\n\"\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\"\n\"\\x98\\x99\\x9A\\x9B\\x9C\\x9D\\x9E\\x9F\"\n\"\\xA0\\xA1\\xA2\\xA3\\xA4\\xA5\\xA6\\xA7\"\n\"\\xA8\\xA9\\xAA\\xAB\\xAC\\xAD\\xAE\\xAF\"\n\"\\xB0\\xB1\\xB2\\xB3\\xB4\\xB5\\xB6\\xB7\"\n\"\\xB8\\xB9\\xBA\\xBB\\xBC\\xBD\\xBE\\xBF\\\"\",\n\"\\x80\\x81\\x82\\x83\\x84\\x85\\x86\\x87\"\n\"\\x88\\x89\\x8A\\x8B\\x8C\\x8D\\x8E\\x8F\"\n\"\\x90\\x91\\x92\\x93\\x94\\x95\\x96\\x97\"\n\"\\x98\\x99\\x9A\\x9B\\x9C\\x9D\\x9E\\x9F\"\n\"\\xA0\\xA1\\xA2\\xA3\\xA4\\xA5\\xA6\\xA7\"\n\"\\xA8\\xA9\\xAA\\xAB\\xAC\\xAD\\xAE\\xAF\"\n\"\\xB0\\xB1\\xB2\\xB3\\xB4\\xB5\\xB6\\xB7\"\n\"\\xB8\\xB9\\xBA\\xBB\\xBC\\xBD\\xBE\\xBF\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\"\n\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\"\n\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\"\n\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\"\n\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\"\n\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\"\n\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\"\n\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\"\"\n},", "{", "\"\\\"\\xC0 \\xC1 \\xC2 \\xC3 \\xC4 \\xC5 \\xC6 \\xC7 \"\n\"\\xC8 \\xC9 \\xCA \\xCB \\xCC \\xCD \\xCE \\xCF \"\n\"\\xD0 \\xD1 \\xD2 \\xD3 \\xD4 \\xD5 \\xD6 \\xD7 \"\n\"\\xD8 \\xD9 \\xDA \\xDB \\xDC \\xDD \\xDE \\xDF \\\"\",\nNULL,\n\"\\\"\\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \"\n\"\\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \"\n\"\\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \"\n\"\\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\"\",\n\"\\xC0 \\xC1 \\xC2 \\xC3 \\xC4 \\xC5 \\xC6 \\xC7 \"\n\"\\xC8 \\xC9 \\xCA \\xCB \\xCC \\xCD \\xCE \\xCF \"\n\"\\xD0 \\xD1 \\xD2 \\xD3 \\xD4 \\xD5 \\xD6 \\xD7 \"\n\"\\xD8 \\xD9 \\xDA \\xDB \\xDC \\xDD \\xDE \\xDF \",\n},", "{", "\"\\\"\\xE0 \\xE1 \\xE2 \\xE3 \\xE4 \\xE5 \\xE6 \\xE7 \"\n\"\\xE8 \\xE9 \\xEA \\xEB \\xEC \\xED \\xEE \\xEF \\\"\",\n\"\\xE0 \\xE1 \\xE2 \\xE3 \\xE4 \\xE5 \\xE6 \\xE7 \"\n\"\\xE8 \\xE9 \\xEA \\xEB \\xEC \\xED \\xEE \\xEF \",\n\"\\\"\\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \"\n\"\\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\"\",\n},", "{", "\"\\\"\\xF0 \\xF1 \\xF2 \\xF3 \\xF4 \\xF5 \\xF6 \\xF7 \\\"\",\nNULL,\n\"\\\"\\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\"\",\n\"\\xF0 \\xF1 \\xF2 \\xF3 \\xF4 \\xF5 \\xF6 \\xF7 \",\n},", "{", "\"\\\"\\xF8 \\xF9 \\xFA \\xFB \\\"\",\nNULL,\n\"\\\"\\\\uFFFD \\\\uFFFD \\\\uFFFD \\\\uFFFD \\\"\",\n\"\\xF8 \\xF9 \\xFA \\xFB \",\n},", "{", "\"\\\"\\xFC \\xFD \\\"\",\nNULL,\n\"\\\"\\\\uFFFD \\\\uFFFD \\\"\",\n\"\\xFC \\xFD \",\n},", "{", "\"\\\"\\xC0\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xC0\",\n},", "{", "\"\\\"\\xE0\\x80\\\"\",\n\"\\xE0\\x80\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xF0\\x80\\x80\\\"\",\n\"\\xF0\\x80\\x80\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xF8\\x80\\x80\\x80\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xF8\\x80\\x80\\x80\",\n},", "{", "\"\\\"\\xFC\\x80\\x80\\x80\\x80\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xFC\\x80\\x80\\x80\\x80\",\n},", "{", "\"\\\"\\xDF\\\"\",\n\"\\xDF\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xEF\\xBF\\\"\",\n\"\\xEF\\xBF\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xF7\\xBF\\xBF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xF7\\xBF\\xBF\",\n},", "{", "\"\\\"\\xFB\\xBF\\xBF\\xBF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xFB\\xBF\\xBF\\xBF\",\n},", "{", "\"\\\"\\xFD\\xBF\\xBF\\xBF\\xBF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xFD\\xBF\\xBF\\xBF\\xBF\",\n},", "{", "\"\\\"\\xC0\\xE0\\x80\\xF0\\x80\\x80\\xF8\\x80\\x80\\x80\\xFC\\x80\\x80\\x80\\x80\"\n\"\\xDF\\xEF\\xBF\\xF7\\xBF\\xBF\\xFB\\xBF\\xBF\\xBF\\xFD\\xBF\\xBF\\xBF\\xBF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\"\n\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\"\",\n\"\\xC0\\xE0\\x80\\xF0\\x80\\x80\\xF8\\x80\\x80\\x80\\xFC\\x80\\x80\\x80\\x80\"\n\"\\xDF\\xEF\\xBF\\xF7\\xBF\\xBF\\xFB\\xBF\\xBF\\xBF\\xFD\\xBF\\xBF\\xBF\\xBF\",\n},", "{", "\"\\\"\\xFE\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xFE\",\n},", "{", "\"\\\"\\xFF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xFF\",\n},", "{", "\"\\\"\\xFE\\xFE\\xFF\\xFF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\"\",\n\"\\xFE\\xFE\\xFF\\xFF\",\n},", "{", "\"\\\"\\xC0\\xAF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xC0\\xAF\",\n},", "{", "\"\\\"\\xE0\\x80\\xAF\\\"\",\n\"\\xE0\\x80\\xAF\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xF0\\x80\\x80\\xAF\\\"\",\n\"\\xF0\\x80\\x80\\xAF\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xF8\\x80\\x80\\x80\\xAF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xF8\\x80\\x80\\x80\\xAF\",\n},", "{", "\"\\\"\\xFC\\x80\\x80\\x80\\x80\\xAF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xFC\\x80\\x80\\x80\\x80\\xAF\",\n},", "{", "\"\\\"\\xC1\\xBF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xC1\\xBF\",\n},", "{", "\"\\\"\\xE0\\x9F\\xBF\\\"\",\n\"\\xE0\\x9F\\xBF\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xF0\\x8F\\xBF\\xBC\\\"\",\n\"\\xF0\\x8F\\xBF\\xBC\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xF8\\x87\\xBF\\xBF\\xBF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xF8\\x87\\xBF\\xBF\\xBF\",\n},", "{", "\"\\\"\\xFC\\x83\\xBF\\xBF\\xBF\\xBF\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xFC\\x83\\xBF\\xBF\\xBF\\xBF\",\n},", "{", "\"\\\"\\xC0\\x80\\\"\",\nNULL,\n\"\\\"\\\\u0000\\\"\",\n\"\\xC0\\x80\",\n},", "{", "\"\\\"\\xE0\\x80\\x80\\\"\",\n\"\\xE0\\x80\\x80\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xF0\\x80\\x80\\x80\\\"\",\n\"\\xF0\\x80\\x80\\x80\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xF8\\x80\\x80\\x80\\x80\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xF8\\x80\\x80\\x80\\x80\",\n},", "{", "\"\\\"\\xFC\\x80\\x80\\x80\\x80\\x80\\\"\",\nNULL,\n\"\\\"\\\\uFFFD\\\"\",\n\"\\xFC\\x80\\x80\\x80\\x80\\x80\",\n},", "{", "\"\\\"\\xED\\xA0\\x80\\\"\",\n\"\\xED\\xA0\\x80\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xAD\\xBF\\\"\",\n\"\\xED\\xAD\\xBF\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xAE\\x80\\\"\",\n\"\\xED\\xAE\\x80\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xAF\\xBF\\\"\",\n\"\\xED\\xAF\\xBF\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xB0\\x80\\\"\",\n\"\\xED\\xB0\\x80\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xBE\\x80\\\"\",\n\"\\xED\\xBE\\x80\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xBF\\xBF\\\"\",\n\"\\xED\\xBF\\xBF\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xA0\\x80\\xED\\xB0\\x80\\\"\",\n\"\\xED\\xA0\\x80\\xED\\xB0\\x80\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xA0\\x80\\xED\\xBF\\xBF\\\"\",\n\"\\xED\\xA0\\x80\\xED\\xBF\\xBF\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xAD\\xBF\\xED\\xB0\\x80\\\"\",\n\"\\xED\\xAD\\xBF\\xED\\xB0\\x80\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xAD\\xBF\\xED\\xBF\\xBF\\\"\",\n\"\\xED\\xAD\\xBF\\xED\\xBF\\xBF\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xAE\\x80\\xED\\xB0\\x80\\\"\",\n\"\\xED\\xAE\\x80\\xED\\xB0\\x80\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xAE\\x80\\xED\\xBF\\xBF\\\"\",\n\"\\xED\\xAE\\x80\\xED\\xBF\\xBF\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xAF\\xBF\\xED\\xB0\\x80\\\"\",\n\"\\xED\\xAF\\xBF\\xED\\xB0\\x80\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xED\\xAF\\xBF\\xED\\xBF\\xBF\\\"\",\n\"\\xED\\xAF\\xBF\\xED\\xBF\\xBF\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xEF\\xBF\\xBE\\\"\",\n\"\\xEF\\xBF\\xBE\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xEF\\xBF\\xBF\\\"\",\n\"\\xEF\\xBF\\xBF\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xEF\\xB7\\x90\\\"\",\n\"\\xEF\\xB7\\x90\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xEF\\xB7\\xAF\\\"\",\n\"\\xEF\\xB7\\xAF\",\n\"\\\"\\\\uFFFD\\\"\",\n},", "{", "\"\\\"\\xF0\\x9F\\xBF\\xBE\\xF0\\x9F\\xBF\\xBF\"\n\"\\xF0\\xAF\\xBF\\xBE\\xF0\\xAF\\xBF\\xBF\"\n\"\\xF0\\xBF\\xBF\\xBE\\xF0\\xBF\\xBF\\xBF\"\n\"\\xF1\\x8F\\xBF\\xBE\\xF1\\x8F\\xBF\\xBF\"\n\"\\xF1\\x9F\\xBF\\xBE\\xF1\\x9F\\xBF\\xBF\"\n\"\\xF1\\xAF\\xBF\\xBE\\xF1\\xAF\\xBF\\xBF\"\n\"\\xF1\\xBF\\xBF\\xBE\\xF1\\xBF\\xBF\\xBF\"\n\"\\xF2\\x8F\\xBF\\xBE\\xF2\\x8F\\xBF\\xBF\"\n\"\\xF2\\x9F\\xBF\\xBE\\xF2\\x9F\\xBF\\xBF\"\n\"\\xF2\\xAF\\xBF\\xBE\\xF2\\xAF\\xBF\\xBF\"\n\"\\xF2\\xBF\\xBF\\xBE\\xF2\\xBF\\xBF\\xBF\"\n\"\\xF3\\x8F\\xBF\\xBE\\xF3\\x8F\\xBF\\xBF\"\n\"\\xF3\\x9F\\xBF\\xBE\\xF3\\x9F\\xBF\\xBF\"\n\"\\xF3\\xAF\\xBF\\xBE\\xF3\\xAF\\xBF\\xBF\"\n\"\\xF3\\xBF\\xBF\\xBE\\xF3\\xBF\\xBF\\xBF\"\n\"\\xF4\\x8F\\xBF\\xBE\\xF4\\x8F\\xBF\\xBF\\\"\",\n\"\\xF0\\x9F\\xBF\\xBE\\xF0\\x9F\\xBF\\xBF\"\n\"\\xF0\\xAF\\xBF\\xBE\\xF0\\xAF\\xBF\\xBF\"\n\"\\xF0\\xBF\\xBF\\xBE\\xF0\\xBF\\xBF\\xBF\"\n\"\\xF1\\x8F\\xBF\\xBE\\xF1\\x8F\\xBF\\xBF\"\n\"\\xF1\\x9F\\xBF\\xBE\\xF1\\x9F\\xBF\\xBF\"\n\"\\xF1\\xAF\\xBF\\xBE\\xF1\\xAF\\xBF\\xBF\"\n\"\\xF1\\xBF\\xBF\\xBE\\xF1\\xBF\\xBF\\xBF\"\n\"\\xF2\\x8F\\xBF\\xBE\\xF2\\x8F\\xBF\\xBF\"\n\"\\xF2\\x9F\\xBF\\xBE\\xF2\\x9F\\xBF\\xBF\"\n\"\\xF2\\xAF\\xBF\\xBE\\xF2\\xAF\\xBF\\xBF\"\n\"\\xF2\\xBF\\xBF\\xBE\\xF2\\xBF\\xBF\\xBF\"\n\"\\xF3\\x8F\\xBF\\xBE\\xF3\\x8F\\xBF\\xBF\"\n\"\\xF3\\x9F\\xBF\\xBE\\xF3\\x9F\\xBF\\xBF\"\n\"\\xF3\\xAF\\xBF\\xBE\\xF3\\xAF\\xBF\\xBF\"\n\"\\xF3\\xBF\\xBF\\xBE\\xF3\\xBF\\xBF\\xBF\"\n\"\\xF4\\x8F\\xBF\\xBE\\xF4\\x8F\\xBF\\xBF\",\n\"\\\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\"\n\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\"\n\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\"\n\"\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\\uFFFD\\\"\",\n},", "{}", "};", "int VAR_1;", "QObject *obj;", "QString *str;", "const char *VAR_2, *VAR_3, *VAR_4, *VAR_5;", "for (VAR_1 = 0; VAR_0[VAR_1].VAR_2; VAR_1++) {", "VAR_2 = VAR_0[VAR_1].VAR_2;", "VAR_3 = VAR_0[VAR_1].VAR_3;", "VAR_4 = VAR_0[VAR_1].VAR_4 ?: VAR_0[VAR_1].VAR_3;", "VAR_5 = VAR_0[VAR_1].VAR_5 ?: VAR_0[VAR_1].VAR_2;", "obj = qobject_from_json(VAR_2, NULL);", "if (VAR_3) {", "str = qobject_to_qstring(obj);", "g_assert(str);", "g_assert_cmpstr(qstring_get_str(str), ==, VAR_3);", "} else {", "g_assert(!obj);", "}", "qobject_decref(obj);", "obj = QOBJECT(qstring_from_str(VAR_4));", "str = qobject_to_json(obj);", "if (VAR_5) {", "g_assert(str);", "g_assert_cmpstr(qstring_get_str(str), ==, VAR_5);", "} else {", "g_assert(!str);", "}", "QDECREF(str);", "qobject_decref(obj);", "if (0 && VAR_5 != VAR_2) {", "obj = qobject_from_json(VAR_5, NULL);", "str = qobject_to_qstring(obj);", "g_assert(str);", "g_assert_cmpstr(qstring_get_str(str), ==, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 93 ], [ 97, 99, 101, 103, 105, 107, 109 ], [ 111 ], [ 115, 117, 119, 121 ], [ 129 ], [ 131, 133, 135, 137, 139 ], [ 143 ], [ 145, 147, 149, 151 ], [ 155 ], [ 157, 159, 161, 163 ], [ 167 ], [ 169, 171, 173, 175 ], [ 179 ], [ 181, 183, 185, 187, 189 ], [ 193 ], [ 195, 197, 199, 201, 203 ], [ 209 ], [ 211, 213, 215, 217 ], [ 221 ], [ 223, 225, 227, 229 ], [ 249 ], [ 251, 253, 255, 257 ], [ 261 ], [ 263, 265, 267, 269, 271 ], [ 275 ], [ 277, 279, 281, 283, 285 ], [ 289 ], [ 291, 293, 295, 297, 299 ], [ 303 ], [ 307, 309, 311, 313 ], [ 315 ], [ 319, 321, 323, 325 ], [ 327 ], [ 331, 333, 335, 337 ], [ 339 ], [ 343, 345, 347, 349 ], [ 351 ], [ 355, 357, 359, 361 ], [ 369 ], [ 371, 373, 375, 377 ], [ 381 ], [ 383, 385, 387, 389 ], [ 393 ], [ 395, 397, 399, 401 ], [ 405 ], [ 407, 409, 411, 413 ], [ 417 ], [ 419, 421, 423, 425 ], [ 429 ], [ 431, 433, 435, 437 ], [ 441 ], [ 443, 445, 447, 449 ], [ 453 ], [ 455, 457, 459, 461 ], [ 465 ], [ 467, 469, 471, 473, 475, 477, 479, 481, 485, 487, 489, 491, 493, 495, 497, 499, 501, 503, 505, 507, 509, 511, 513, 515, 517 ], [ 523 ], [ 525, 527, 529, 531, 533, 535, 537, 539, 541, 543, 545, 547, 549, 551 ], [ 555 ], [ 557, 559, 563, 565, 567, 569, 571 ], [ 575 ], [ 577, 579, 581, 583, 585 ], [ 589 ], [ 591, 593, 595, 597, 599 ], [ 603 ], [ 605, 607, 609, 611, 613 ], [ 619 ], [ 621, 623, 625, 627, 629 ], [ 633 ], [ 635, 637, 639, 641 ], [ 645 ], [ 647, 649, 651, 653 ], [ 657 ], [ 659, 661, 663, 665, 667 ], [ 671 ], [ 673, 675, 677, 679, 681 ], [ 685 ], [ 687, 689, 691, 693 ], [ 697 ], [ 699, 701, 703, 705 ], [ 709 ], [ 711, 713, 715, 717, 719 ], [ 723 ], [ 725, 727, 729, 731, 733 ], [ 737 ], [ 739, 741, 743, 745, 747 ], [ 751 ], [ 753, 755, 757, 759, 761, 763, 765, 767 ], [ 771 ], [ 773, 775, 777, 779, 781 ], [ 783 ], [ 785, 787, 789, 791, 793 ], [ 795 ], [ 797, 799, 801, 803, 805 ], [ 811 ], [ 813, 815, 817, 819, 821 ], [ 823 ], [ 825, 827, 829, 831 ], [ 833 ], [ 835, 837, 839, 841 ], [ 843 ], [ 845, 847, 849, 851, 853 ], [ 855 ], [ 857, 859, 861, 863, 865 ], [ 879 ], [ 883, 885, 887, 889, 891 ], [ 893 ], [ 897, 899, 901, 903 ], [ 905 ], [ 919, 921, 923, 925 ], [ 927 ], [ 931, 933, 935, 937, 939 ], [ 941 ], [ 945, 947, 949, 951, 953 ], [ 957 ], [ 961, 963, 965, 967, 969 ], [ 971 ], [ 975, 977, 979, 981 ], [ 983 ], [ 987, 989, 991, 993 ], [ 995 ], [ 999, 1001, 1003, 1005, 1007 ], [ 1009 ], [ 1013, 1015, 1017, 1019, 1021 ], [ 1027 ], [ 1031, 1033, 1035, 1037 ], [ 1039 ], [ 1043, 1045, 1047, 1049 ], [ 1051 ], [ 1055, 1057, 1059, 1061 ], [ 1063 ], [ 1067, 1069, 1071, 1073 ], [ 1075 ], [ 1079, 1081, 1083, 1085 ], [ 1087 ], [ 1091, 1093, 1095, 1097 ], [ 1099 ], [ 1103, 1105, 1107, 1109 ], [ 1113 ], [ 1117, 1119, 1121, 1123 ], [ 1125 ], [ 1129, 1131, 1133, 1135 ], [ 1137 ], [ 1141, 1143, 1145, 1147 ], [ 1149 ], [ 1153, 1155, 1157, 1159 ], [ 1161 ], [ 1165, 1167, 1169, 1171 ], [ 1173 ], [ 1177, 1179, 1181, 1183 ], [ 1185 ], [ 1189, 1191, 1193, 1195 ], [ 1197 ], [ 1201, 1203, 1205, 1207 ], [ 1213 ], [ 1217, 1219, 1221, 1223 ], [ 1225 ], [ 1229, 1231, 1233, 1235 ], [ 1237 ], [ 1241, 1243, 1245, 1247 ], [ 1249 ], [ 1253, 1255, 1257, 1259 ], [ 1263 ], [ 1267, 1269, 1271, 1273, 1275, 1277, 1279, 1281, 1283, 1285, 1287, 1289, 1291, 1293, 1295, 1297, 1301, 1303, 1305, 1307, 1309, 1311, 1313, 1315, 1317, 1319, 1321, 1323, 1325, 1327, 1329, 1331, 1333, 1335, 1337, 1339, 1341 ], [ 1343 ], [ 1345 ], [ 1347 ], [ 1349 ], [ 1351 ], [ 1353 ], [ 1357 ], [ 1359 ], [ 1361 ], [ 1363 ], [ 1365 ], [ 1369 ], [ 1371 ], [ 1373 ], [ 1375 ], [ 1377 ], [ 1379 ], [ 1381 ], [ 1383 ], [ 1385 ], [ 1389 ], [ 1391 ], [ 1393 ], [ 1395 ], [ 1397 ], [ 1399 ], [ 1401 ], [ 1403 ], [ 1405 ], [ 1407 ], [ 1421 ], [ 1423 ], [ 1425 ], [ 1427 ], [ 1429 ], [ 1431 ], [ 1433 ], [ 1435 ] ]
5,903
static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_t *pkt_pts, int64_t *pkt_dts) { AVFrame *decoded_frame, *filtered_frame = NULL; void *buffer_to_free = NULL; int i, ret = 0; float quality = 0; #if CONFIG_AVFILTER int frame_available = 1; #endif int duration=0; int64_t *best_effort_timestamp; AVRational *frame_sample_aspect; if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); else avcodec_get_frame_defaults(ist->decoded_frame); decoded_frame = ist->decoded_frame; pkt->pts = *pkt_pts; pkt->dts = *pkt_dts; *pkt_pts = AV_NOPTS_VALUE; if (pkt->duration) { duration = av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); } else if(ist->st->codec->time_base.num != 0) { int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; duration = ((int64_t)AV_TIME_BASE * ist->st->codec->time_base.num * ticks) / ist->st->codec->time_base.den; } if(*pkt_dts != AV_NOPTS_VALUE && duration) { *pkt_dts += duration; }else *pkt_dts = AV_NOPTS_VALUE; ret = avcodec_decode_video2(ist->st->codec, decoded_frame, got_output, pkt); if (ret < 0) return ret; quality = same_quant ? decoded_frame->quality : 0; if (!*got_output) { /* no picture yet */ return ret; } best_effort_timestamp= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "best_effort_timestamp"); if(*best_effort_timestamp != AV_NOPTS_VALUE) ist->next_pts = ist->pts = *best_effort_timestamp; ist->next_pts += duration; pkt->size = 0; pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free); #if CONFIG_AVFILTER frame_sample_aspect= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "sample_aspect_ratio"); for(i=0;i<nb_output_streams;i++) { OutputStream *ost = ost = &output_streams[i]; if(check_output_constraints(ist, ost)){ if (!frame_sample_aspect->num) *frame_sample_aspect = ist->st->sample_aspect_ratio; decoded_frame->pts = ist->pts; av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE); } } #endif rate_emu_sleep(ist); for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = &output_streams[i]; int frame_size; if (!check_output_constraints(ist, ost) || !ost->encoding_needed) continue; #if CONFIG_AVFILTER if (ost->input_video_filter) { frame_available = av_buffersink_poll_frame(ost->output_video_filter); } while (frame_available) { if (ost->output_video_filter) { AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base; if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0){ av_log(0, AV_LOG_WARNING, "AV Filter told us it has a frame available but failed to output one\n"); goto cont; } if (!ist->filtered_frame && !(ist->filtered_frame = avcodec_alloc_frame())) { av_free(buffer_to_free); return AVERROR(ENOMEM); } else avcodec_get_frame_defaults(ist->filtered_frame); filtered_frame = ist->filtered_frame; *filtered_frame= *decoded_frame; //for me_threshold if (ost->picref) { avfilter_fill_frame_from_video_buffer_ref(filtered_frame, ost->picref); ist->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q); } } if (ost->picref->video && !ost->frame_aspect_ratio) ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio; #else filtered_frame = decoded_frame; #endif do_video_out(output_files[ost->file_index].ctx, ost, ist, filtered_frame, &frame_size, same_quant ? quality : ost->st->codec->global_quality); if (vstats_filename && frame_size) do_video_stats(output_files[ost->file_index].ctx, ost, frame_size); #if CONFIG_AVFILTER cont: frame_available = ost->output_video_filter && av_buffersink_poll_frame(ost->output_video_filter); avfilter_unref_buffer(ost->picref); } #endif } av_free(buffer_to_free); return ret; }
true
FFmpeg
1f273c2bf22c49e5f668debf52c497dabee636c7
static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_t *pkt_pts, int64_t *pkt_dts) { AVFrame *decoded_frame, *filtered_frame = NULL; void *buffer_to_free = NULL; int i, ret = 0; float quality = 0; #if CONFIG_AVFILTER int frame_available = 1; #endif int duration=0; int64_t *best_effort_timestamp; AVRational *frame_sample_aspect; if (!ist->decoded_frame && !(ist->decoded_frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); else avcodec_get_frame_defaults(ist->decoded_frame); decoded_frame = ist->decoded_frame; pkt->pts = *pkt_pts; pkt->dts = *pkt_dts; *pkt_pts = AV_NOPTS_VALUE; if (pkt->duration) { duration = av_rescale_q(pkt->duration, ist->st->time_base, AV_TIME_BASE_Q); } else if(ist->st->codec->time_base.num != 0) { int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; duration = ((int64_t)AV_TIME_BASE * ist->st->codec->time_base.num * ticks) / ist->st->codec->time_base.den; } if(*pkt_dts != AV_NOPTS_VALUE && duration) { *pkt_dts += duration; }else *pkt_dts = AV_NOPTS_VALUE; ret = avcodec_decode_video2(ist->st->codec, decoded_frame, got_output, pkt); if (ret < 0) return ret; quality = same_quant ? decoded_frame->quality : 0; if (!*got_output) { return ret; } best_effort_timestamp= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "best_effort_timestamp"); if(*best_effort_timestamp != AV_NOPTS_VALUE) ist->next_pts = ist->pts = *best_effort_timestamp; ist->next_pts += duration; pkt->size = 0; pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free); #if CONFIG_AVFILTER frame_sample_aspect= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "sample_aspect_ratio"); for(i=0;i<nb_output_streams;i++) { OutputStream *ost = ost = &output_streams[i]; if(check_output_constraints(ist, ost)){ if (!frame_sample_aspect->num) *frame_sample_aspect = ist->st->sample_aspect_ratio; decoded_frame->pts = ist->pts; av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE); } } #endif rate_emu_sleep(ist); for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = &output_streams[i]; int frame_size; if (!check_output_constraints(ist, ost) || !ost->encoding_needed) continue; #if CONFIG_AVFILTER if (ost->input_video_filter) { frame_available = av_buffersink_poll_frame(ost->output_video_filter); } while (frame_available) { if (ost->output_video_filter) { AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base; if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0){ av_log(0, AV_LOG_WARNING, "AV Filter told us it has a frame available but failed to output one\n"); goto cont; } if (!ist->filtered_frame && !(ist->filtered_frame = avcodec_alloc_frame())) { av_free(buffer_to_free); return AVERROR(ENOMEM); } else avcodec_get_frame_defaults(ist->filtered_frame); filtered_frame = ist->filtered_frame; *filtered_frame= *decoded_frame; if (ost->picref) { avfilter_fill_frame_from_video_buffer_ref(filtered_frame, ost->picref); ist->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q); } } if (ost->picref->video && !ost->frame_aspect_ratio) ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio; #else filtered_frame = decoded_frame; #endif do_video_out(output_files[ost->file_index].ctx, ost, ist, filtered_frame, &frame_size, same_quant ? quality : ost->st->codec->global_quality); if (vstats_filename && frame_size) do_video_stats(output_files[ost->file_index].ctx, ost, frame_size); #if CONFIG_AVFILTER cont: frame_available = ost->output_video_filter && av_buffersink_poll_frame(ost->output_video_filter); avfilter_unref_buffer(ost->picref); } #endif } av_free(buffer_to_free); return ret; }
{ "code": [ " av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE);" ], "line_no": [ 131 ] }
static int FUNC_0(InputStream *VAR_0, AVPacket *VAR_1, int *VAR_2, int64_t *VAR_3, int64_t *VAR_4) { AVFrame *decoded_frame, *filtered_frame = NULL; void *VAR_5 = NULL; int VAR_6, VAR_7 = 0; float VAR_8 = 0; #if CONFIG_AVFILTER int frame_available = 1; #endif int VAR_9=0; int64_t *best_effort_timestamp; AVRational *frame_sample_aspect; if (!VAR_0->decoded_frame && !(VAR_0->decoded_frame = avcodec_alloc_frame())) return AVERROR(ENOMEM); else avcodec_get_frame_defaults(VAR_0->decoded_frame); decoded_frame = VAR_0->decoded_frame; VAR_1->pts = *VAR_3; VAR_1->dts = *VAR_4; *VAR_3 = AV_NOPTS_VALUE; if (VAR_1->VAR_9) { VAR_9 = av_rescale_q(VAR_1->VAR_9, VAR_0->st->time_base, AV_TIME_BASE_Q); } else if(VAR_0->st->codec->time_base.num != 0) { int VAR_10= VAR_0->st->parser ? VAR_0->st->parser->repeat_pict+1 : VAR_0->st->codec->ticks_per_frame; VAR_9 = ((int64_t)AV_TIME_BASE * VAR_0->st->codec->time_base.num * VAR_10) / VAR_0->st->codec->time_base.den; } if(*VAR_4 != AV_NOPTS_VALUE && VAR_9) { *VAR_4 += VAR_9; }else *VAR_4 = AV_NOPTS_VALUE; VAR_7 = avcodec_decode_video2(VAR_0->st->codec, decoded_frame, VAR_2, VAR_1); if (VAR_7 < 0) return VAR_7; VAR_8 = same_quant ? decoded_frame->VAR_8 : 0; if (!*VAR_2) { return VAR_7; } best_effort_timestamp= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "best_effort_timestamp"); if(*best_effort_timestamp != AV_NOPTS_VALUE) VAR_0->next_pts = VAR_0->pts = *best_effort_timestamp; VAR_0->next_pts += VAR_9; VAR_1->size = 0; pre_process_video_frame(VAR_0, (AVPicture *)decoded_frame, &VAR_5); #if CONFIG_AVFILTER frame_sample_aspect= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, "sample_aspect_ratio"); for(VAR_6=0;VAR_6<nb_output_streams;VAR_6++) { OutputStream *ost = ost = &output_streams[VAR_6]; if(check_output_constraints(VAR_0, ost)){ if (!frame_sample_aspect->num) *frame_sample_aspect = VAR_0->st->sample_aspect_ratio; decoded_frame->pts = VAR_0->pts; av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE); } } #endif rate_emu_sleep(VAR_0); for (VAR_6 = 0; VAR_6 < nb_output_streams; VAR_6++) { OutputStream *ost = &output_streams[VAR_6]; int frame_size; if (!check_output_constraints(VAR_0, ost) || !ost->encoding_needed) continue; #if CONFIG_AVFILTER if (ost->input_video_filter) { frame_available = av_buffersink_poll_frame(ost->output_video_filter); } while (frame_available) { if (ost->output_video_filter) { AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base; if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0){ av_log(0, AV_LOG_WARNING, "AV Filter told us it has a frame available but failed to output one\n"); goto cont; } if (!VAR_0->filtered_frame && !(VAR_0->filtered_frame = avcodec_alloc_frame())) { av_free(VAR_5); return AVERROR(ENOMEM); } else avcodec_get_frame_defaults(VAR_0->filtered_frame); filtered_frame = VAR_0->filtered_frame; *filtered_frame= *decoded_frame; if (ost->picref) { avfilter_fill_frame_from_video_buffer_ref(filtered_frame, ost->picref); VAR_0->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q); } } if (ost->picref->video && !ost->frame_aspect_ratio) ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio; #else filtered_frame = decoded_frame; #endif do_video_out(output_files[ost->file_index].ctx, ost, VAR_0, filtered_frame, &frame_size, same_quant ? VAR_8 : ost->st->codec->global_quality); if (vstats_filename && frame_size) do_video_stats(output_files[ost->file_index].ctx, ost, frame_size); #if CONFIG_AVFILTER cont: frame_available = ost->output_video_filter && av_buffersink_poll_frame(ost->output_video_filter); avfilter_unref_buffer(ost->picref); } #endif } av_free(VAR_5); return VAR_7; }
[ "static int FUNC_0(InputStream *VAR_0, AVPacket *VAR_1, int *VAR_2, int64_t *VAR_3, int64_t *VAR_4)\n{", "AVFrame *decoded_frame, *filtered_frame = NULL;", "void *VAR_5 = NULL;", "int VAR_6, VAR_7 = 0;", "float VAR_8 = 0;", "#if CONFIG_AVFILTER\nint frame_available = 1;", "#endif\nint VAR_9=0;", "int64_t *best_effort_timestamp;", "AVRational *frame_sample_aspect;", "if (!VAR_0->decoded_frame && !(VAR_0->decoded_frame = avcodec_alloc_frame()))\nreturn AVERROR(ENOMEM);", "else\navcodec_get_frame_defaults(VAR_0->decoded_frame);", "decoded_frame = VAR_0->decoded_frame;", "VAR_1->pts = *VAR_3;", "VAR_1->dts = *VAR_4;", "*VAR_3 = AV_NOPTS_VALUE;", "if (VAR_1->VAR_9) {", "VAR_9 = av_rescale_q(VAR_1->VAR_9, VAR_0->st->time_base, AV_TIME_BASE_Q);", "} else if(VAR_0->st->codec->time_base.num != 0) {", "int VAR_10= VAR_0->st->parser ? VAR_0->st->parser->repeat_pict+1 : VAR_0->st->codec->ticks_per_frame;", "VAR_9 = ((int64_t)AV_TIME_BASE *\nVAR_0->st->codec->time_base.num * VAR_10) /\nVAR_0->st->codec->time_base.den;", "}", "if(*VAR_4 != AV_NOPTS_VALUE && VAR_9) {", "*VAR_4 += VAR_9;", "}else", "*VAR_4 = AV_NOPTS_VALUE;", "VAR_7 = avcodec_decode_video2(VAR_0->st->codec,\ndecoded_frame, VAR_2, VAR_1);", "if (VAR_7 < 0)\nreturn VAR_7;", "VAR_8 = same_quant ? decoded_frame->VAR_8 : 0;", "if (!*VAR_2) {", "return VAR_7;", "}", "best_effort_timestamp= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, \"best_effort_timestamp\");", "if(*best_effort_timestamp != AV_NOPTS_VALUE)\nVAR_0->next_pts = VAR_0->pts = *best_effort_timestamp;", "VAR_0->next_pts += VAR_9;", "VAR_1->size = 0;", "pre_process_video_frame(VAR_0, (AVPicture *)decoded_frame, &VAR_5);", "#if CONFIG_AVFILTER\nframe_sample_aspect= av_opt_ptr(avcodec_get_frame_class(), decoded_frame, \"sample_aspect_ratio\");", "for(VAR_6=0;VAR_6<nb_output_streams;VAR_6++) {", "OutputStream *ost = ost = &output_streams[VAR_6];", "if(check_output_constraints(VAR_0, ost)){", "if (!frame_sample_aspect->num)\n*frame_sample_aspect = VAR_0->st->sample_aspect_ratio;", "decoded_frame->pts = VAR_0->pts;", "av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE);", "}", "}", "#endif\nrate_emu_sleep(VAR_0);", "for (VAR_6 = 0; VAR_6 < nb_output_streams; VAR_6++) {", "OutputStream *ost = &output_streams[VAR_6];", "int frame_size;", "if (!check_output_constraints(VAR_0, ost) || !ost->encoding_needed)\ncontinue;", "#if CONFIG_AVFILTER\nif (ost->input_video_filter) {", "frame_available = av_buffersink_poll_frame(ost->output_video_filter);", "}", "while (frame_available) {", "if (ost->output_video_filter) {", "AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base;", "if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0){", "av_log(0, AV_LOG_WARNING, \"AV Filter told us it has a frame available but failed to output one\\n\");", "goto cont;", "}", "if (!VAR_0->filtered_frame && !(VAR_0->filtered_frame = avcodec_alloc_frame())) {", "av_free(VAR_5);", "return AVERROR(ENOMEM);", "} else", "avcodec_get_frame_defaults(VAR_0->filtered_frame);", "filtered_frame = VAR_0->filtered_frame;", "*filtered_frame= *decoded_frame;", "if (ost->picref) {", "avfilter_fill_frame_from_video_buffer_ref(filtered_frame, ost->picref);", "VAR_0->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q);", "}", "}", "if (ost->picref->video && !ost->frame_aspect_ratio)\nost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio;", "#else\nfiltered_frame = decoded_frame;", "#endif\ndo_video_out(output_files[ost->file_index].ctx, ost, VAR_0, filtered_frame, &frame_size,\nsame_quant ? VAR_8 : ost->st->codec->global_quality);", "if (vstats_filename && frame_size)\ndo_video_stats(output_files[ost->file_index].ctx, ost, frame_size);", "#if CONFIG_AVFILTER\ncont:\nframe_available = ost->output_video_filter && av_buffersink_poll_frame(ost->output_video_filter);", "avfilter_unref_buffer(ost->picref);", "}", "#endif\n}", "av_free(VAR_5);", "return VAR_7;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17, 19 ], [ 21 ], [ 23 ], [ 27, 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53, 55, 57 ], [ 59 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73, 75 ], [ 77, 79 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 95 ], [ 97, 99 ], [ 103 ], [ 105 ], [ 109 ], [ 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123, 125 ], [ 127 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 141 ], [ 145 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 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, 217, 219 ], [ 221, 223 ], [ 225, 227, 229 ], [ 231 ], [ 233 ], [ 235, 237 ], [ 241 ], [ 243 ], [ 245 ] ]
5,904
SubchDev *css_create_sch(CssDevId bus_id, bool is_virtual, bool squash_mcss, Error **errp) { uint16_t schid = 0; SubchDev *sch; if (bus_id.valid) { if (is_virtual != (bus_id.cssid == VIRTUAL_CSSID)) { error_setg(errp, "cssid %hhx not valid for %s devices", bus_id.cssid, (is_virtual ? "virtual" : "non-virtual")); return NULL; } } if (bus_id.valid) { if (squash_mcss) { bus_id.cssid = channel_subsys.default_cssid; } else if (!channel_subsys.css[bus_id.cssid]) { css_create_css_image(bus_id.cssid, false); } if (!css_find_free_subch_for_devno(bus_id.cssid, bus_id.ssid, bus_id.devid, &schid, errp)) { return NULL; } } else if (squash_mcss || is_virtual) { bus_id.cssid = channel_subsys.default_cssid; if (!css_find_free_subch_and_devno(bus_id.cssid, &bus_id.ssid, &bus_id.devid, &schid, errp)) { return NULL; } } else { for (bus_id.cssid = 0; bus_id.cssid < MAX_CSSID; ++bus_id.cssid) { if (bus_id.cssid == VIRTUAL_CSSID) { continue; } if (!channel_subsys.css[bus_id.cssid]) { css_create_css_image(bus_id.cssid, false); } if (css_find_free_subch_and_devno(bus_id.cssid, &bus_id.ssid, &bus_id.devid, &schid, NULL)) { break; } if (bus_id.cssid == MAX_CSSID) { error_setg(errp, "Virtual channel subsystem is full!"); return NULL; } } } sch = g_new0(SubchDev, 1); sch->cssid = bus_id.cssid; sch->ssid = bus_id.ssid; sch->devno = bus_id.devid; sch->schid = schid; css_subch_assign(sch->cssid, sch->ssid, schid, sch->devno, sch); return sch; }
true
qemu
99577c492fb2916165ed9bc215f058877f0a4106
SubchDev *css_create_sch(CssDevId bus_id, bool is_virtual, bool squash_mcss, Error **errp) { uint16_t schid = 0; SubchDev *sch; if (bus_id.valid) { if (is_virtual != (bus_id.cssid == VIRTUAL_CSSID)) { error_setg(errp, "cssid %hhx not valid for %s devices", bus_id.cssid, (is_virtual ? "virtual" : "non-virtual")); return NULL; } } if (bus_id.valid) { if (squash_mcss) { bus_id.cssid = channel_subsys.default_cssid; } else if (!channel_subsys.css[bus_id.cssid]) { css_create_css_image(bus_id.cssid, false); } if (!css_find_free_subch_for_devno(bus_id.cssid, bus_id.ssid, bus_id.devid, &schid, errp)) { return NULL; } } else if (squash_mcss || is_virtual) { bus_id.cssid = channel_subsys.default_cssid; if (!css_find_free_subch_and_devno(bus_id.cssid, &bus_id.ssid, &bus_id.devid, &schid, errp)) { return NULL; } } else { for (bus_id.cssid = 0; bus_id.cssid < MAX_CSSID; ++bus_id.cssid) { if (bus_id.cssid == VIRTUAL_CSSID) { continue; } if (!channel_subsys.css[bus_id.cssid]) { css_create_css_image(bus_id.cssid, false); } if (css_find_free_subch_and_devno(bus_id.cssid, &bus_id.ssid, &bus_id.devid, &schid, NULL)) { break; } if (bus_id.cssid == MAX_CSSID) { error_setg(errp, "Virtual channel subsystem is full!"); return NULL; } } } sch = g_new0(SubchDev, 1); sch->cssid = bus_id.cssid; sch->ssid = bus_id.ssid; sch->devno = bus_id.devid; sch->schid = schid; css_subch_assign(sch->cssid, sch->ssid, schid, sch->devno, sch); return sch; }
{ "code": [ "SubchDev *css_create_sch(CssDevId bus_id, bool is_virtual, bool squash_mcss,", " Error **errp)", " if (bus_id.valid) {", " if (is_virtual != (bus_id.cssid == VIRTUAL_CSSID)) {", " error_setg(errp, \"cssid %hhx not valid for %s devices\",", " bus_id.cssid,", " (is_virtual ? \"virtual\" : \"non-virtual\"));", " return NULL;", " } else if (squash_mcss || is_virtual) {", " bus_id.cssid = channel_subsys.default_cssid;", " if (!css_find_free_subch_and_devno(bus_id.cssid, &bus_id.ssid,", " &bus_id.devid, &schid, errp)) {", " return NULL;", " for (bus_id.cssid = 0; bus_id.cssid < MAX_CSSID; ++bus_id.cssid) {", " if (bus_id.cssid == VIRTUAL_CSSID) {", " continue;", " if (bus_id.cssid == MAX_CSSID) {", "SubchDev *css_create_sch(CssDevId bus_id, bool is_virtual, bool squash_mcss," ], "line_no": [ 1, 3, 13, 15, 17, 19, 21, 23, 53, 55, 59, 61, 23, 69, 71, 73, 97, 1 ] }
SubchDev *FUNC_0(CssDevId bus_id, bool is_virtual, bool squash_mcss, Error **errp) { uint16_t schid = 0; SubchDev *sch; if (bus_id.valid) { if (is_virtual != (bus_id.cssid == VIRTUAL_CSSID)) { error_setg(errp, "cssid %hhx not valid for %s devices", bus_id.cssid, (is_virtual ? "virtual" : "non-virtual")); return NULL; } } if (bus_id.valid) { if (squash_mcss) { bus_id.cssid = channel_subsys.default_cssid; } else if (!channel_subsys.css[bus_id.cssid]) { css_create_css_image(bus_id.cssid, false); } if (!css_find_free_subch_for_devno(bus_id.cssid, bus_id.ssid, bus_id.devid, &schid, errp)) { return NULL; } } else if (squash_mcss || is_virtual) { bus_id.cssid = channel_subsys.default_cssid; if (!css_find_free_subch_and_devno(bus_id.cssid, &bus_id.ssid, &bus_id.devid, &schid, errp)) { return NULL; } } else { for (bus_id.cssid = 0; bus_id.cssid < MAX_CSSID; ++bus_id.cssid) { if (bus_id.cssid == VIRTUAL_CSSID) { continue; } if (!channel_subsys.css[bus_id.cssid]) { css_create_css_image(bus_id.cssid, false); } if (css_find_free_subch_and_devno(bus_id.cssid, &bus_id.ssid, &bus_id.devid, &schid, NULL)) { break; } if (bus_id.cssid == MAX_CSSID) { error_setg(errp, "Virtual channel subsystem is full!"); return NULL; } } } sch = g_new0(SubchDev, 1); sch->cssid = bus_id.cssid; sch->ssid = bus_id.ssid; sch->devno = bus_id.devid; sch->schid = schid; css_subch_assign(sch->cssid, sch->ssid, schid, sch->devno, sch); return sch; }
[ "SubchDev *FUNC_0(CssDevId bus_id, bool is_virtual, bool squash_mcss,\nError **errp)\n{", "uint16_t schid = 0;", "SubchDev *sch;", "if (bus_id.valid) {", "if (is_virtual != (bus_id.cssid == VIRTUAL_CSSID)) {", "error_setg(errp, \"cssid %hhx not valid for %s devices\",\nbus_id.cssid,\n(is_virtual ? \"virtual\" : \"non-virtual\"));", "return NULL;", "}", "}", "if (bus_id.valid) {", "if (squash_mcss) {", "bus_id.cssid = channel_subsys.default_cssid;", "} else if (!channel_subsys.css[bus_id.cssid]) {", "css_create_css_image(bus_id.cssid, false);", "}", "if (!css_find_free_subch_for_devno(bus_id.cssid, bus_id.ssid,\nbus_id.devid, &schid, errp)) {", "return NULL;", "}", "} else if (squash_mcss || is_virtual) {", "bus_id.cssid = channel_subsys.default_cssid;", "if (!css_find_free_subch_and_devno(bus_id.cssid, &bus_id.ssid,\n&bus_id.devid, &schid, errp)) {", "return NULL;", "}", "} else {", "for (bus_id.cssid = 0; bus_id.cssid < MAX_CSSID; ++bus_id.cssid) {", "if (bus_id.cssid == VIRTUAL_CSSID) {", "continue;", "}", "if (!channel_subsys.css[bus_id.cssid]) {", "css_create_css_image(bus_id.cssid, false);", "}", "if (css_find_free_subch_and_devno(bus_id.cssid, &bus_id.ssid,\n&bus_id.devid, &schid,\nNULL)) {", "break;", "}", "if (bus_id.cssid == MAX_CSSID) {", "error_setg(errp, \"Virtual channel subsystem is full!\");", "return NULL;", "}", "}", "}", "sch = g_new0(SubchDev, 1);", "sch->cssid = bus_id.cssid;", "sch->ssid = bus_id.ssid;", "sch->devno = bus_id.devid;", "sch->schid = schid;", "css_subch_assign(sch->cssid, sch->ssid, schid, sch->devno, sch);", "return sch;", "}" ]
[ 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 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 ], [ 13 ], [ 15 ], [ 17, 19, 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59, 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 87, 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ] ]
5,906
static int vdi_create(const char *filename, QemuOpts *opts, Error **errp) { int ret = 0; uint64_t bytes = 0; uint32_t blocks; size_t block_size = DEFAULT_CLUSTER_SIZE; uint32_t image_type = VDI_TYPE_DYNAMIC; VdiHeader header; size_t i; size_t bmap_size; int64_t offset = 0; Error *local_err = NULL; BlockDriverState *bs = NULL; uint32_t *bmap = NULL; logout("\n"); /* Read out options. */ bytes = qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0); #if defined(CONFIG_VDI_BLOCK_SIZE) /* TODO: Additional checks (SECTOR_SIZE * 2^n, ...). */ block_size = qemu_opt_get_size_del(opts, BLOCK_OPT_CLUSTER_SIZE, DEFAULT_CLUSTER_SIZE); #endif #if defined(CONFIG_VDI_STATIC_IMAGE) if (qemu_opt_get_bool_del(opts, BLOCK_OPT_STATIC, false)) { image_type = VDI_TYPE_STATIC; } #endif if (bytes > VDI_DISK_SIZE_MAX) { ret = -ENOTSUP; error_setg(errp, "Unsupported VDI image size (size is 0x%" PRIx64 ", max supported is 0x%" PRIx64 ")", bytes, VDI_DISK_SIZE_MAX); goto exit; } ret = bdrv_create_file(filename, opts, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto exit; } ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto exit; } /* We need enough blocks to store the given disk size, so always round up. */ blocks = (bytes + block_size - 1) / block_size; bmap_size = blocks * sizeof(uint32_t); bmap_size = ((bmap_size + SECTOR_SIZE - 1) & ~(SECTOR_SIZE -1)); memset(&header, 0, sizeof(header)); pstrcpy(header.text, sizeof(header.text), VDI_TEXT); header.signature = VDI_SIGNATURE; header.version = VDI_VERSION_1_1; header.header_size = 0x180; header.image_type = image_type; header.offset_bmap = 0x200; header.offset_data = 0x200 + bmap_size; header.sector_size = SECTOR_SIZE; header.disk_size = bytes; header.block_size = block_size; header.blocks_in_image = blocks; if (image_type == VDI_TYPE_STATIC) { header.blocks_allocated = blocks; } uuid_generate(header.uuid_image); uuid_generate(header.uuid_last_snap); /* There is no need to set header.uuid_link or header.uuid_parent here. */ #if defined(CONFIG_VDI_DEBUG) vdi_header_print(&header); #endif vdi_header_to_le(&header); ret = bdrv_pwrite_sync(bs, offset, &header, sizeof(header)); if (ret < 0) { error_setg(errp, "Error writing header to %s", filename); goto exit; } offset += sizeof(header); if (bmap_size > 0) { bmap = g_malloc0(bmap_size); for (i = 0; i < blocks; i++) { if (image_type == VDI_TYPE_STATIC) { bmap[i] = i; } else { bmap[i] = VDI_UNALLOCATED; } } ret = bdrv_pwrite_sync(bs, offset, bmap, bmap_size); if (ret < 0) { error_setg(errp, "Error writing bmap to %s", filename); goto exit; } offset += bmap_size; } if (image_type == VDI_TYPE_STATIC) { ret = bdrv_truncate(bs, offset + blocks * block_size); if (ret < 0) { error_setg(errp, "Failed to statically allocate %s", filename); goto exit; } } exit: bdrv_unref(bs); g_free(bmap); return ret; }
true
qemu
17cce735780f0ff6a2ef173c34614bd47acd56e5
static int vdi_create(const char *filename, QemuOpts *opts, Error **errp) { int ret = 0; uint64_t bytes = 0; uint32_t blocks; size_t block_size = DEFAULT_CLUSTER_SIZE; uint32_t image_type = VDI_TYPE_DYNAMIC; VdiHeader header; size_t i; size_t bmap_size; int64_t offset = 0; Error *local_err = NULL; BlockDriverState *bs = NULL; uint32_t *bmap = NULL; logout("\n"); bytes = qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0); #if defined(CONFIG_VDI_BLOCK_SIZE) block_size = qemu_opt_get_size_del(opts, BLOCK_OPT_CLUSTER_SIZE, DEFAULT_CLUSTER_SIZE); #endif #if defined(CONFIG_VDI_STATIC_IMAGE) if (qemu_opt_get_bool_del(opts, BLOCK_OPT_STATIC, false)) { image_type = VDI_TYPE_STATIC; } #endif if (bytes > VDI_DISK_SIZE_MAX) { ret = -ENOTSUP; error_setg(errp, "Unsupported VDI image size (size is 0x%" PRIx64 ", max supported is 0x%" PRIx64 ")", bytes, VDI_DISK_SIZE_MAX); goto exit; } ret = bdrv_create_file(filename, opts, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto exit; } ret = bdrv_open(&bs, filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto exit; } blocks = (bytes + block_size - 1) / block_size; bmap_size = blocks * sizeof(uint32_t); bmap_size = ((bmap_size + SECTOR_SIZE - 1) & ~(SECTOR_SIZE -1)); memset(&header, 0, sizeof(header)); pstrcpy(header.text, sizeof(header.text), VDI_TEXT); header.signature = VDI_SIGNATURE; header.version = VDI_VERSION_1_1; header.header_size = 0x180; header.image_type = image_type; header.offset_bmap = 0x200; header.offset_data = 0x200 + bmap_size; header.sector_size = SECTOR_SIZE; header.disk_size = bytes; header.block_size = block_size; header.blocks_in_image = blocks; if (image_type == VDI_TYPE_STATIC) { header.blocks_allocated = blocks; } uuid_generate(header.uuid_image); uuid_generate(header.uuid_last_snap); #if defined(CONFIG_VDI_DEBUG) vdi_header_print(&header); #endif vdi_header_to_le(&header); ret = bdrv_pwrite_sync(bs, offset, &header, sizeof(header)); if (ret < 0) { error_setg(errp, "Error writing header to %s", filename); goto exit; } offset += sizeof(header); if (bmap_size > 0) { bmap = g_malloc0(bmap_size); for (i = 0; i < blocks; i++) { if (image_type == VDI_TYPE_STATIC) { bmap[i] = i; } else { bmap[i] = VDI_UNALLOCATED; } } ret = bdrv_pwrite_sync(bs, offset, bmap, bmap_size); if (ret < 0) { error_setg(errp, "Error writing bmap to %s", filename); goto exit; } offset += bmap_size; } if (image_type == VDI_TYPE_STATIC) { ret = bdrv_truncate(bs, offset + blocks * block_size); if (ret < 0) { error_setg(errp, "Failed to statically allocate %s", filename); goto exit; } } exit: bdrv_unref(bs); g_free(bmap); return ret; }
{ "code": [ " bmap = g_malloc0(bmap_size);" ], "line_no": [ 177 ] }
static int FUNC_0(const char *VAR_0, QemuOpts *VAR_1, Error **VAR_2) { int VAR_3 = 0; uint64_t bytes = 0; uint32_t blocks; size_t block_size = DEFAULT_CLUSTER_SIZE; uint32_t image_type = VDI_TYPE_DYNAMIC; VdiHeader header; size_t i; size_t bmap_size; int64_t offset = 0; Error *local_err = NULL; BlockDriverState *bs = NULL; uint32_t *bmap = NULL; logout("\n"); bytes = qemu_opt_get_size_del(VAR_1, BLOCK_OPT_SIZE, 0); #if defined(CONFIG_VDI_BLOCK_SIZE) block_size = qemu_opt_get_size_del(VAR_1, BLOCK_OPT_CLUSTER_SIZE, DEFAULT_CLUSTER_SIZE); #endif #if defined(CONFIG_VDI_STATIC_IMAGE) if (qemu_opt_get_bool_del(VAR_1, BLOCK_OPT_STATIC, false)) { image_type = VDI_TYPE_STATIC; } #endif if (bytes > VDI_DISK_SIZE_MAX) { VAR_3 = -ENOTSUP; error_setg(VAR_2, "Unsupported VDI image size (size is 0x%" PRIx64 ", max supported is 0x%" PRIx64 ")", bytes, VDI_DISK_SIZE_MAX); goto exit; } VAR_3 = bdrv_create_file(VAR_0, VAR_1, &local_err); if (VAR_3 < 0) { error_propagate(VAR_2, local_err); goto exit; } VAR_3 = bdrv_open(&bs, VAR_0, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL, NULL, &local_err); if (VAR_3 < 0) { error_propagate(VAR_2, local_err); goto exit; } blocks = (bytes + block_size - 1) / block_size; bmap_size = blocks * sizeof(uint32_t); bmap_size = ((bmap_size + SECTOR_SIZE - 1) & ~(SECTOR_SIZE -1)); memset(&header, 0, sizeof(header)); pstrcpy(header.text, sizeof(header.text), VDI_TEXT); header.signature = VDI_SIGNATURE; header.version = VDI_VERSION_1_1; header.header_size = 0x180; header.image_type = image_type; header.offset_bmap = 0x200; header.offset_data = 0x200 + bmap_size; header.sector_size = SECTOR_SIZE; header.disk_size = bytes; header.block_size = block_size; header.blocks_in_image = blocks; if (image_type == VDI_TYPE_STATIC) { header.blocks_allocated = blocks; } uuid_generate(header.uuid_image); uuid_generate(header.uuid_last_snap); #if defined(CONFIG_VDI_DEBUG) vdi_header_print(&header); #endif vdi_header_to_le(&header); VAR_3 = bdrv_pwrite_sync(bs, offset, &header, sizeof(header)); if (VAR_3 < 0) { error_setg(VAR_2, "Error writing header to %s", VAR_0); goto exit; } offset += sizeof(header); if (bmap_size > 0) { bmap = g_malloc0(bmap_size); for (i = 0; i < blocks; i++) { if (image_type == VDI_TYPE_STATIC) { bmap[i] = i; } else { bmap[i] = VDI_UNALLOCATED; } } VAR_3 = bdrv_pwrite_sync(bs, offset, bmap, bmap_size); if (VAR_3 < 0) { error_setg(VAR_2, "Error writing bmap to %s", VAR_0); goto exit; } offset += bmap_size; } if (image_type == VDI_TYPE_STATIC) { VAR_3 = bdrv_truncate(bs, offset + blocks * block_size); if (VAR_3 < 0) { error_setg(VAR_2, "Failed to statically allocate %s", VAR_0); goto exit; } } exit: bdrv_unref(bs); g_free(bmap); return VAR_3; }
[ "static int FUNC_0(const char *VAR_0, QemuOpts *VAR_1, Error **VAR_2)\n{", "int VAR_3 = 0;", "uint64_t bytes = 0;", "uint32_t blocks;", "size_t block_size = DEFAULT_CLUSTER_SIZE;", "uint32_t image_type = VDI_TYPE_DYNAMIC;", "VdiHeader header;", "size_t i;", "size_t bmap_size;", "int64_t offset = 0;", "Error *local_err = NULL;", "BlockDriverState *bs = NULL;", "uint32_t *bmap = NULL;", "logout(\"\\n\");", "bytes = qemu_opt_get_size_del(VAR_1, BLOCK_OPT_SIZE, 0);", "#if defined(CONFIG_VDI_BLOCK_SIZE)\nblock_size = qemu_opt_get_size_del(VAR_1,\nBLOCK_OPT_CLUSTER_SIZE,\nDEFAULT_CLUSTER_SIZE);", "#endif\n#if defined(CONFIG_VDI_STATIC_IMAGE)\nif (qemu_opt_get_bool_del(VAR_1, BLOCK_OPT_STATIC, false)) {", "image_type = VDI_TYPE_STATIC;", "}", "#endif\nif (bytes > VDI_DISK_SIZE_MAX) {", "VAR_3 = -ENOTSUP;", "error_setg(VAR_2, \"Unsupported VDI image size (size is 0x%\" PRIx64\n\", max supported is 0x%\" PRIx64 \")\",\nbytes, VDI_DISK_SIZE_MAX);", "goto exit;", "}", "VAR_3 = bdrv_create_file(VAR_0, VAR_1, &local_err);", "if (VAR_3 < 0) {", "error_propagate(VAR_2, local_err);", "goto exit;", "}", "VAR_3 = bdrv_open(&bs, VAR_0, NULL, NULL, BDRV_O_RDWR | BDRV_O_PROTOCOL,\nNULL, &local_err);", "if (VAR_3 < 0) {", "error_propagate(VAR_2, local_err);", "goto exit;", "}", "blocks = (bytes + block_size - 1) / block_size;", "bmap_size = blocks * sizeof(uint32_t);", "bmap_size = ((bmap_size + SECTOR_SIZE - 1) & ~(SECTOR_SIZE -1));", "memset(&header, 0, sizeof(header));", "pstrcpy(header.text, sizeof(header.text), VDI_TEXT);", "header.signature = VDI_SIGNATURE;", "header.version = VDI_VERSION_1_1;", "header.header_size = 0x180;", "header.image_type = image_type;", "header.offset_bmap = 0x200;", "header.offset_data = 0x200 + bmap_size;", "header.sector_size = SECTOR_SIZE;", "header.disk_size = bytes;", "header.block_size = block_size;", "header.blocks_in_image = blocks;", "if (image_type == VDI_TYPE_STATIC) {", "header.blocks_allocated = blocks;", "}", "uuid_generate(header.uuid_image);", "uuid_generate(header.uuid_last_snap);", "#if defined(CONFIG_VDI_DEBUG)\nvdi_header_print(&header);", "#endif\nvdi_header_to_le(&header);", "VAR_3 = bdrv_pwrite_sync(bs, offset, &header, sizeof(header));", "if (VAR_3 < 0) {", "error_setg(VAR_2, \"Error writing header to %s\", VAR_0);", "goto exit;", "}", "offset += sizeof(header);", "if (bmap_size > 0) {", "bmap = g_malloc0(bmap_size);", "for (i = 0; i < blocks; i++) {", "if (image_type == VDI_TYPE_STATIC) {", "bmap[i] = i;", "} else {", "bmap[i] = VDI_UNALLOCATED;", "}", "}", "VAR_3 = bdrv_pwrite_sync(bs, offset, bmap, bmap_size);", "if (VAR_3 < 0) {", "error_setg(VAR_2, \"Error writing bmap to %s\", VAR_0);", "goto exit;", "}", "offset += bmap_size;", "}", "if (image_type == VDI_TYPE_STATIC) {", "VAR_3 = bdrv_truncate(bs, offset + blocks * block_size);", "if (VAR_3 < 0) {", "error_setg(VAR_2, \"Failed to statically allocate %s\", VAR_0);", "goto exit;", "}", "}", "exit:\nbdrv_unref(bs);", "g_free(bmap);", "return 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 31 ], [ 37 ], [ 39, 43, 45, 47 ], [ 49, 51, 53 ], [ 55 ], [ 57 ], [ 59, 63 ], [ 65 ], [ 67, 69, 71 ], [ 73 ], [ 75 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89, 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 107 ], [ 111 ], [ 113 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137 ], [ 139 ], [ 141 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 153, 155 ], [ 157, 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ], [ 213 ], [ 215 ], [ 217 ], [ 219 ], [ 221 ], [ 225, 227 ], [ 229 ], [ 231 ], [ 233 ] ]
5,907
static int brpix_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { BRPixContext *s = avctx->priv_data; AVFrame *frame_out = data; int ret; GetByteContext gb; unsigned int bytes_pp; unsigned int magic[4]; unsigned int chunk_type; unsigned int data_len; BRPixHeader hdr; bytestream2_init(&gb, avpkt->data, avpkt->size); magic[0] = bytestream2_get_be32(&gb); magic[1] = bytestream2_get_be32(&gb); magic[2] = bytestream2_get_be32(&gb); magic[3] = bytestream2_get_be32(&gb); if (magic[0] != 0x12 || magic[1] != 0x8 || magic[2] != 0x2 || magic[3] != 0x2) { av_log(avctx, AV_LOG_ERROR, "Not a BRender PIX file\n"); return AVERROR_INVALIDDATA; chunk_type = bytestream2_get_be32(&gb); if (chunk_type != 0x3 && chunk_type != 0x3d) { av_log(avctx, AV_LOG_ERROR, "Invalid chunk type %d\n", chunk_type); return AVERROR_INVALIDDATA; ret = brpix_decode_header(&hdr, &gb); if (!ret) { av_log(avctx, AV_LOG_ERROR, "Invalid header length\n"); return AVERROR_INVALIDDATA; switch (hdr.format) { case 3: avctx->pix_fmt = AV_PIX_FMT_PAL8; bytes_pp = 1; break; case 4: avctx->pix_fmt = AV_PIX_FMT_RGB555BE; bytes_pp = 2; break; case 5: avctx->pix_fmt = AV_PIX_FMT_RGB565BE; bytes_pp = 2; break; case 6: avctx->pix_fmt = AV_PIX_FMT_RGB24; bytes_pp = 3; break; case 7: avctx->pix_fmt = AV_PIX_FMT_0RGB; bytes_pp = 4; break; case 18: avctx->pix_fmt = AV_PIX_FMT_GRAY8A; bytes_pp = 2; break; default: av_log(avctx, AV_LOG_ERROR, "Format %d is not supported\n", hdr.format); return AVERROR_PATCHWELCOME; if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); if (av_image_check_size(hdr.width, hdr.height, 0, avctx) < 0) return AVERROR_INVALIDDATA; if (hdr.width != avctx->width || hdr.height != avctx->height) avcodec_set_dimensions(avctx, hdr.width, hdr.height); if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; chunk_type = bytestream2_get_be32(&gb); if (avctx->pix_fmt == AV_PIX_FMT_PAL8 && (chunk_type == 0x3 || chunk_type == 0x3d)) { BRPixHeader palhdr; ret = brpix_decode_header(&palhdr, &gb); if (!ret) { av_log(avctx, AV_LOG_ERROR, "Invalid palette header length\n"); return AVERROR_INVALIDDATA; if (palhdr.format != 7) { av_log(avctx, AV_LOG_ERROR, "Palette is not in 0RGB format\n"); return AVERROR_INVALIDDATA; chunk_type = bytestream2_get_be32(&gb); data_len = bytestream2_get_be32(&gb); bytestream2_skip(&gb, 8); if (chunk_type != 0x21 || data_len != 1032 || bytestream2_get_bytes_left(&gb) < 1032) { av_log(avctx, AV_LOG_ERROR, "Invalid palette data\n"); return AVERROR_INVALIDDATA; // convert 0RGB to machine endian format (ARGB32) bytestream2_skipu(&gb, 1); *pal_out++ = (0xFFU << 24) | bytestream2_get_be24u(&gb); bytestream2_skip(&gb, 8); chunk_type = bytestream2_get_be32(&gb); data_len = bytestream2_get_be32(&gb); bytestream2_skip(&gb, 8); // read the image data to the buffer { unsigned int bytes_per_scanline = bytes_pp * hdr.width; unsigned int bytes_left = bytestream2_get_bytes_left(&gb); if (chunk_type != 0x21 || data_len != bytes_left || bytes_left / bytes_per_scanline < hdr.height) { av_log(avctx, AV_LOG_ERROR, "Invalid image data\n"); return AVERROR_INVALIDDATA; av_image_copy_plane(s->frame.data[0], s->frame.linesize[0], avpkt->data + bytestream2_tell(&gb), bytes_per_scanline, bytes_per_scanline, hdr.height); *frame_out = s->frame; *got_frame = 1; return avpkt->size;
true
FFmpeg
551d8b58ebc03114d4231df92e366ffb7bf7ff62
static int brpix_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { BRPixContext *s = avctx->priv_data; AVFrame *frame_out = data; int ret; GetByteContext gb; unsigned int bytes_pp; unsigned int magic[4]; unsigned int chunk_type; unsigned int data_len; BRPixHeader hdr; bytestream2_init(&gb, avpkt->data, avpkt->size); magic[0] = bytestream2_get_be32(&gb); magic[1] = bytestream2_get_be32(&gb); magic[2] = bytestream2_get_be32(&gb); magic[3] = bytestream2_get_be32(&gb); if (magic[0] != 0x12 || magic[1] != 0x8 || magic[2] != 0x2 || magic[3] != 0x2) { av_log(avctx, AV_LOG_ERROR, "Not a BRender PIX file\n"); return AVERROR_INVALIDDATA; chunk_type = bytestream2_get_be32(&gb); if (chunk_type != 0x3 && chunk_type != 0x3d) { av_log(avctx, AV_LOG_ERROR, "Invalid chunk type %d\n", chunk_type); return AVERROR_INVALIDDATA; ret = brpix_decode_header(&hdr, &gb); if (!ret) { av_log(avctx, AV_LOG_ERROR, "Invalid header length\n"); return AVERROR_INVALIDDATA; switch (hdr.format) { case 3: avctx->pix_fmt = AV_PIX_FMT_PAL8; bytes_pp = 1; break; case 4: avctx->pix_fmt = AV_PIX_FMT_RGB555BE; bytes_pp = 2; break; case 5: avctx->pix_fmt = AV_PIX_FMT_RGB565BE; bytes_pp = 2; break; case 6: avctx->pix_fmt = AV_PIX_FMT_RGB24; bytes_pp = 3; break; case 7: avctx->pix_fmt = AV_PIX_FMT_0RGB; bytes_pp = 4; break; case 18: avctx->pix_fmt = AV_PIX_FMT_GRAY8A; bytes_pp = 2; break; default: av_log(avctx, AV_LOG_ERROR, "Format %d is not supported\n", hdr.format); return AVERROR_PATCHWELCOME; if (s->frame.data[0]) avctx->release_buffer(avctx, &s->frame); if (av_image_check_size(hdr.width, hdr.height, 0, avctx) < 0) return AVERROR_INVALIDDATA; if (hdr.width != avctx->width || hdr.height != avctx->height) avcodec_set_dimensions(avctx, hdr.width, hdr.height); if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; chunk_type = bytestream2_get_be32(&gb); if (avctx->pix_fmt == AV_PIX_FMT_PAL8 && (chunk_type == 0x3 || chunk_type == 0x3d)) { BRPixHeader palhdr; ret = brpix_decode_header(&palhdr, &gb); if (!ret) { av_log(avctx, AV_LOG_ERROR, "Invalid palette header length\n"); return AVERROR_INVALIDDATA; if (palhdr.format != 7) { av_log(avctx, AV_LOG_ERROR, "Palette is not in 0RGB format\n"); return AVERROR_INVALIDDATA; chunk_type = bytestream2_get_be32(&gb); data_len = bytestream2_get_be32(&gb); bytestream2_skip(&gb, 8); if (chunk_type != 0x21 || data_len != 1032 || bytestream2_get_bytes_left(&gb) < 1032) { av_log(avctx, AV_LOG_ERROR, "Invalid palette data\n"); return AVERROR_INVALIDDATA; bytestream2_skipu(&gb, 1); *pal_out++ = (0xFFU << 24) | bytestream2_get_be24u(&gb); bytestream2_skip(&gb, 8); chunk_type = bytestream2_get_be32(&gb); data_len = bytestream2_get_be32(&gb); bytestream2_skip(&gb, 8); { unsigned int bytes_per_scanline = bytes_pp * hdr.width; unsigned int bytes_left = bytestream2_get_bytes_left(&gb); if (chunk_type != 0x21 || data_len != bytes_left || bytes_left / bytes_per_scanline < hdr.height) { av_log(avctx, AV_LOG_ERROR, "Invalid image data\n"); return AVERROR_INVALIDDATA; av_image_copy_plane(s->frame.data[0], s->frame.linesize[0], avpkt->data + bytestream2_tell(&gb), bytes_per_scanline, bytes_per_scanline, hdr.height); *frame_out = s->frame; *got_frame = 1; return avpkt->size;
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3) { BRPixContext *s = VAR_0->priv_data; AVFrame *frame_out = VAR_1; int VAR_4; GetByteContext gb; unsigned int VAR_5; unsigned int VAR_6[4]; unsigned int VAR_7; unsigned int VAR_8; BRPixHeader hdr; bytestream2_init(&gb, VAR_3->VAR_1, VAR_3->size); VAR_6[0] = bytestream2_get_be32(&gb); VAR_6[1] = bytestream2_get_be32(&gb); VAR_6[2] = bytestream2_get_be32(&gb); VAR_6[3] = bytestream2_get_be32(&gb); if (VAR_6[0] != 0x12 || VAR_6[1] != 0x8 || VAR_6[2] != 0x2 || VAR_6[3] != 0x2) { av_log(VAR_0, AV_LOG_ERROR, "Not a BRender PIX file\n"); return AVERROR_INVALIDDATA; VAR_7 = bytestream2_get_be32(&gb); if (VAR_7 != 0x3 && VAR_7 != 0x3d) { av_log(VAR_0, AV_LOG_ERROR, "Invalid chunk type %d\n", VAR_7); return AVERROR_INVALIDDATA; VAR_4 = brpix_decode_header(&hdr, &gb); if (!VAR_4) { av_log(VAR_0, AV_LOG_ERROR, "Invalid header length\n"); return AVERROR_INVALIDDATA; switch (hdr.format) { case 3: VAR_0->pix_fmt = AV_PIX_FMT_PAL8; VAR_5 = 1; break; case 4: VAR_0->pix_fmt = AV_PIX_FMT_RGB555BE; VAR_5 = 2; break; case 5: VAR_0->pix_fmt = AV_PIX_FMT_RGB565BE; VAR_5 = 2; break; case 6: VAR_0->pix_fmt = AV_PIX_FMT_RGB24; VAR_5 = 3; break; case 7: VAR_0->pix_fmt = AV_PIX_FMT_0RGB; VAR_5 = 4; break; case 18: VAR_0->pix_fmt = AV_PIX_FMT_GRAY8A; VAR_5 = 2; break; default: av_log(VAR_0, AV_LOG_ERROR, "Format %d is not supported\n", hdr.format); return AVERROR_PATCHWELCOME; if (s->frame.VAR_1[0]) VAR_0->release_buffer(VAR_0, &s->frame); if (av_image_check_size(hdr.width, hdr.height, 0, VAR_0) < 0) return AVERROR_INVALIDDATA; if (hdr.width != VAR_0->width || hdr.height != VAR_0->height) avcodec_set_dimensions(VAR_0, hdr.width, hdr.height); if ((VAR_4 = ff_get_buffer(VAR_0, &s->frame)) < 0) { av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return VAR_4; VAR_7 = bytestream2_get_be32(&gb); if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8 && (VAR_7 == 0x3 || VAR_7 == 0x3d)) { BRPixHeader palhdr; VAR_4 = brpix_decode_header(&palhdr, &gb); if (!VAR_4) { av_log(VAR_0, AV_LOG_ERROR, "Invalid palette header length\n"); return AVERROR_INVALIDDATA; if (palhdr.format != 7) { av_log(VAR_0, AV_LOG_ERROR, "Palette is not in 0RGB format\n"); return AVERROR_INVALIDDATA; VAR_7 = bytestream2_get_be32(&gb); VAR_8 = bytestream2_get_be32(&gb); bytestream2_skip(&gb, 8); if (VAR_7 != 0x21 || VAR_8 != 1032 || bytestream2_get_bytes_left(&gb) < 1032) { av_log(VAR_0, AV_LOG_ERROR, "Invalid palette VAR_1\n"); return AVERROR_INVALIDDATA; bytestream2_skipu(&gb, 1); *pal_out++ = (0xFFU << 24) | bytestream2_get_be24u(&gb); bytestream2_skip(&gb, 8); VAR_7 = bytestream2_get_be32(&gb); VAR_8 = bytestream2_get_be32(&gb); bytestream2_skip(&gb, 8); { unsigned int VAR_9 = VAR_5 * hdr.width; unsigned int VAR_10 = bytestream2_get_bytes_left(&gb); if (VAR_7 != 0x21 || VAR_8 != VAR_10 || VAR_10 / VAR_9 < hdr.height) { av_log(VAR_0, AV_LOG_ERROR, "Invalid image VAR_1\n"); return AVERROR_INVALIDDATA; av_image_copy_plane(s->frame.VAR_1[0], s->frame.linesize[0], VAR_3->VAR_1 + bytestream2_tell(&gb), VAR_9, VAR_9, hdr.height); *frame_out = s->frame; *VAR_2 = 1; return VAR_3->size;
[ "static int FUNC_0(AVCodecContext *VAR_0,\nvoid *VAR_1, int *VAR_2,\nAVPacket *VAR_3)\n{", "BRPixContext *s = VAR_0->priv_data;", "AVFrame *frame_out = VAR_1;", "int VAR_4;", "GetByteContext gb;", "unsigned int VAR_5;", "unsigned int VAR_6[4];", "unsigned int VAR_7;", "unsigned int VAR_8;", "BRPixHeader hdr;", "bytestream2_init(&gb, VAR_3->VAR_1, VAR_3->size);", "VAR_6[0] = bytestream2_get_be32(&gb);", "VAR_6[1] = bytestream2_get_be32(&gb);", "VAR_6[2] = bytestream2_get_be32(&gb);", "VAR_6[3] = bytestream2_get_be32(&gb);", "if (VAR_6[0] != 0x12 ||\nVAR_6[1] != 0x8 ||\nVAR_6[2] != 0x2 ||\nVAR_6[3] != 0x2) {", "av_log(VAR_0, AV_LOG_ERROR, \"Not a BRender PIX file\\n\");", "return AVERROR_INVALIDDATA;", "VAR_7 = bytestream2_get_be32(&gb);", "if (VAR_7 != 0x3 && VAR_7 != 0x3d) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid chunk type %d\\n\", VAR_7);", "return AVERROR_INVALIDDATA;", "VAR_4 = brpix_decode_header(&hdr, &gb);", "if (!VAR_4) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid header length\\n\");", "return AVERROR_INVALIDDATA;", "switch (hdr.format) {", "case 3:\nVAR_0->pix_fmt = AV_PIX_FMT_PAL8;", "VAR_5 = 1;", "break;", "case 4:\nVAR_0->pix_fmt = AV_PIX_FMT_RGB555BE;", "VAR_5 = 2;", "break;", "case 5:\nVAR_0->pix_fmt = AV_PIX_FMT_RGB565BE;", "VAR_5 = 2;", "break;", "case 6:\nVAR_0->pix_fmt = AV_PIX_FMT_RGB24;", "VAR_5 = 3;", "break;", "case 7:\nVAR_0->pix_fmt = AV_PIX_FMT_0RGB;", "VAR_5 = 4;", "break;", "case 18:\nVAR_0->pix_fmt = AV_PIX_FMT_GRAY8A;", "VAR_5 = 2;", "break;", "default:\nav_log(VAR_0, AV_LOG_ERROR, \"Format %d is not supported\\n\",\nhdr.format);", "return AVERROR_PATCHWELCOME;", "if (s->frame.VAR_1[0])\nVAR_0->release_buffer(VAR_0, &s->frame);", "if (av_image_check_size(hdr.width, hdr.height, 0, VAR_0) < 0)\nreturn AVERROR_INVALIDDATA;", "if (hdr.width != VAR_0->width || hdr.height != VAR_0->height)\navcodec_set_dimensions(VAR_0, hdr.width, hdr.height);", "if ((VAR_4 = ff_get_buffer(VAR_0, &s->frame)) < 0) {", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return VAR_4;", "VAR_7 = bytestream2_get_be32(&gb);", "if (VAR_0->pix_fmt == AV_PIX_FMT_PAL8 &&\n(VAR_7 == 0x3 || VAR_7 == 0x3d)) {", "BRPixHeader palhdr;", "VAR_4 = brpix_decode_header(&palhdr, &gb);", "if (!VAR_4) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid palette header length\\n\");", "return AVERROR_INVALIDDATA;", "if (palhdr.format != 7) {", "av_log(VAR_0, AV_LOG_ERROR, \"Palette is not in 0RGB format\\n\");", "return AVERROR_INVALIDDATA;", "VAR_7 = bytestream2_get_be32(&gb);", "VAR_8 = bytestream2_get_be32(&gb);", "bytestream2_skip(&gb, 8);", "if (VAR_7 != 0x21 || VAR_8 != 1032 ||\nbytestream2_get_bytes_left(&gb) < 1032) {", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid palette VAR_1\\n\");", "return AVERROR_INVALIDDATA;", "bytestream2_skipu(&gb, 1);", "*pal_out++ = (0xFFU << 24) | bytestream2_get_be24u(&gb);", "bytestream2_skip(&gb, 8);", "VAR_7 = bytestream2_get_be32(&gb);", "VAR_8 = bytestream2_get_be32(&gb);", "bytestream2_skip(&gb, 8);", "{", "unsigned int VAR_9 = VAR_5 * hdr.width;", "unsigned int VAR_10 = bytestream2_get_bytes_left(&gb);", "if (VAR_7 != 0x21 || VAR_8 != VAR_10 ||\nVAR_10 / VAR_9 < hdr.height)\n{", "av_log(VAR_0, AV_LOG_ERROR, \"Invalid image VAR_1\\n\");", "return AVERROR_INVALIDDATA;", "av_image_copy_plane(s->frame.VAR_1[0], s->frame.linesize[0],\nVAR_3->VAR_1 + bytestream2_tell(&gb),\nVAR_9,\nVAR_9, hdr.height);", "*frame_out = s->frame;", "*VAR_2 = 1;", "return VAR_3->size;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2, 3, 4 ], [ 5 ], [ 6 ], [ 7 ], [ 8 ], [ 9 ], [ 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19, 20, 21, 22 ], [ 23 ], [ 24 ], [ 25 ], [ 26 ], [ 27 ], [ 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34, 35 ], [ 36 ], [ 37 ], [ 38, 39 ], [ 40 ], [ 41 ], [ 42, 43 ], [ 44 ], [ 45 ], [ 46, 47 ], [ 48 ], [ 49 ], [ 50, 51 ], [ 52 ], [ 53 ], [ 54, 55 ], [ 56 ], [ 57 ], [ 58, 59, 60 ], [ 61 ], [ 62, 63 ], [ 64, 65 ], [ 66, 67 ], [ 68 ], [ 69 ], [ 70 ], [ 71 ], [ 72, 73 ], [ 74 ], [ 75 ], [ 76 ], [ 77 ], [ 78 ], [ 79 ], [ 80 ], [ 81 ], [ 82 ], [ 83 ], [ 84 ], [ 85, 86 ], [ 87 ], [ 88 ], [ 90 ], [ 91 ], [ 92 ], [ 93 ], [ 94 ], [ 95 ], [ 97 ], [ 98 ], [ 99 ], [ 100, 101, 102 ], [ 103 ], [ 104 ], [ 105, 106, 107, 108 ], [ 109 ], [ 110 ], [ 111 ] ]
5,909
static void mct_decode(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile) { int i, csize = 1; int32_t *src[3], i0, i1, i2; float *srcf[3], i0f, i1f, i2f; for (i = 0; i < 3; i++) if (tile->codsty[0].transform == FF_DWT97) srcf[i] = tile->comp[i].f_data; else src [i] = tile->comp[i].i_data; for (i = 0; i < 2; i++) csize *= tile->comp[0].coord[i][1] - tile->comp[0].coord[i][0]; switch (tile->codsty[0].transform) { case FF_DWT97: for (i = 0; i < csize; i++) { i0f = *srcf[0] + (f_ict_params[0] * *srcf[2]); i1f = *srcf[0] - (f_ict_params[1] * *srcf[1]) - (f_ict_params[2] * *srcf[2]); i2f = *srcf[0] + (f_ict_params[3] * *srcf[1]); *srcf[0]++ = i0f; *srcf[1]++ = i1f; *srcf[2]++ = i2f; break; case FF_DWT97_INT: for (i = 0; i < csize; i++) { i0 = *src[0] + (((i_ict_params[0] * *src[2]) + (1 << 15)) >> 16); i1 = *src[0] - (((i_ict_params[1] * *src[1]) + (1 << 15)) >> 16) - (((i_ict_params[2] * *src[2]) + (1 << 15)) >> 16); i2 = *src[0] + (((i_ict_params[3] * *src[1]) + (1 << 15)) >> 16); *src[0]++ = i0; *src[1]++ = i1; *src[2]++ = i2; break; case FF_DWT53: for (i = 0; i < csize; i++) { i1 = *src[0] - (*src[2] + *src[1] >> 2); i0 = i1 + *src[2]; i2 = i1 + *src[1]; *src[0]++ = i0; *src[1]++ = i1; *src[2]++ = i2; break;
true
FFmpeg
ac3b01a9c0607961f4540fe62040833870f5deb1
static void mct_decode(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile) { int i, csize = 1; int32_t *src[3], i0, i1, i2; float *srcf[3], i0f, i1f, i2f; for (i = 0; i < 3; i++) if (tile->codsty[0].transform == FF_DWT97) srcf[i] = tile->comp[i].f_data; else src [i] = tile->comp[i].i_data; for (i = 0; i < 2; i++) csize *= tile->comp[0].coord[i][1] - tile->comp[0].coord[i][0]; switch (tile->codsty[0].transform) { case FF_DWT97: for (i = 0; i < csize; i++) { i0f = *srcf[0] + (f_ict_params[0] * *srcf[2]); i1f = *srcf[0] - (f_ict_params[1] * *srcf[1]) - (f_ict_params[2] * *srcf[2]); i2f = *srcf[0] + (f_ict_params[3] * *srcf[1]); *srcf[0]++ = i0f; *srcf[1]++ = i1f; *srcf[2]++ = i2f; break; case FF_DWT97_INT: for (i = 0; i < csize; i++) { i0 = *src[0] + (((i_ict_params[0] * *src[2]) + (1 << 15)) >> 16); i1 = *src[0] - (((i_ict_params[1] * *src[1]) + (1 << 15)) >> 16) - (((i_ict_params[2] * *src[2]) + (1 << 15)) >> 16); i2 = *src[0] + (((i_ict_params[3] * *src[1]) + (1 << 15)) >> 16); *src[0]++ = i0; *src[1]++ = i1; *src[2]++ = i2; break; case FF_DWT53: for (i = 0; i < csize; i++) { i1 = *src[0] - (*src[2] + *src[1] >> 2); i0 = i1 + *src[2]; i2 = i1 + *src[1]; *src[0]++ = i0; *src[1]++ = i1; *src[2]++ = i2; break;
{ "code": [], "line_no": [] }
static void FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000Tile *VAR_1) { int VAR_2, VAR_3 = 1; int32_t *src[3], i0, i1, i2; float *VAR_4[3], VAR_5, VAR_6, VAR_7; for (VAR_2 = 0; VAR_2 < 3; VAR_2++) if (VAR_1->codsty[0].transform == FF_DWT97) VAR_4[VAR_2] = VAR_1->comp[VAR_2].f_data; else src [VAR_2] = VAR_1->comp[VAR_2].i_data; for (VAR_2 = 0; VAR_2 < 2; VAR_2++) VAR_3 *= VAR_1->comp[0].coord[VAR_2][1] - VAR_1->comp[0].coord[VAR_2][0]; switch (VAR_1->codsty[0].transform) { case FF_DWT97: for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) { VAR_5 = *VAR_4[0] + (f_ict_params[0] * *VAR_4[2]); VAR_6 = *VAR_4[0] - (f_ict_params[1] * *VAR_4[1]) - (f_ict_params[2] * *VAR_4[2]); VAR_7 = *VAR_4[0] + (f_ict_params[3] * *VAR_4[1]); *VAR_4[0]++ = VAR_5; *VAR_4[1]++ = VAR_6; *VAR_4[2]++ = VAR_7; break; case FF_DWT97_INT: for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) { i0 = *src[0] + (((i_ict_params[0] * *src[2]) + (1 << 15)) >> 16); i1 = *src[0] - (((i_ict_params[1] * *src[1]) + (1 << 15)) >> 16) - (((i_ict_params[2] * *src[2]) + (1 << 15)) >> 16); i2 = *src[0] + (((i_ict_params[3] * *src[1]) + (1 << 15)) >> 16); *src[0]++ = i0; *src[1]++ = i1; *src[2]++ = i2; break; case FF_DWT53: for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) { i1 = *src[0] - (*src[2] + *src[1] >> 2); i0 = i1 + *src[2]; i2 = i1 + *src[1]; *src[0]++ = i0; *src[1]++ = i1; *src[2]++ = i2; break;
[ "static void FUNC_0(Jpeg2000DecoderContext *VAR_0, Jpeg2000Tile *VAR_1)\n{", "int VAR_2, VAR_3 = 1;", "int32_t *src[3], i0, i1, i2;", "float *VAR_4[3], VAR_5, VAR_6, VAR_7;", "for (VAR_2 = 0; VAR_2 < 3; VAR_2++)", "if (VAR_1->codsty[0].transform == FF_DWT97)\nVAR_4[VAR_2] = VAR_1->comp[VAR_2].f_data;", "else\nsrc [VAR_2] = VAR_1->comp[VAR_2].i_data;", "for (VAR_2 = 0; VAR_2 < 2; VAR_2++)", "VAR_3 *= VAR_1->comp[0].coord[VAR_2][1] - VAR_1->comp[0].coord[VAR_2][0];", "switch (VAR_1->codsty[0].transform) {", "case FF_DWT97:\nfor (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) {", "VAR_5 = *VAR_4[0] + (f_ict_params[0] * *VAR_4[2]);", "VAR_6 = *VAR_4[0] - (f_ict_params[1] * *VAR_4[1])\n- (f_ict_params[2] * *VAR_4[2]);", "VAR_7 = *VAR_4[0] + (f_ict_params[3] * *VAR_4[1]);", "*VAR_4[0]++ = VAR_5;", "*VAR_4[1]++ = VAR_6;", "*VAR_4[2]++ = VAR_7;", "break;", "case FF_DWT97_INT:\nfor (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) {", "i0 = *src[0] + (((i_ict_params[0] * *src[2]) + (1 << 15)) >> 16);", "i1 = *src[0] - (((i_ict_params[1] * *src[1]) + (1 << 15)) >> 16)\n- (((i_ict_params[2] * *src[2]) + (1 << 15)) >> 16);", "i2 = *src[0] + (((i_ict_params[3] * *src[1]) + (1 << 15)) >> 16);", "*src[0]++ = i0;", "*src[1]++ = i1;", "*src[2]++ = i2;", "break;", "case FF_DWT53:\nfor (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) {", "i1 = *src[0] - (*src[2] + *src[1] >> 2);", "i0 = i1 + *src[2];", "i2 = i1 + *src[1];", "*src[0]++ = i0;", "*src[1]++ = i1;", "*src[2]++ = i2;", "break;" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7, 8 ], [ 9, 10 ], [ 11 ], [ 12 ], [ 13 ], [ 14, 15 ], [ 16 ], [ 17, 18 ], [ 19 ], [ 20 ], [ 21 ], [ 22 ], [ 23 ], [ 24, 25 ], [ 26 ], [ 27, 28 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 33 ], [ 34, 35 ], [ 36 ], [ 37 ], [ 38 ], [ 39 ], [ 40 ], [ 41 ], [ 42 ] ]
5,911
static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; int entries, i, j; get_be32(pb); // version + flags entries = get_be32(pb); if (entries >= UINT_MAX / sizeof(*sc->drefs)) return -1; sc->drefs_count = entries; sc->drefs = av_mallocz(entries * sizeof(*sc->drefs)); for (i = 0; i < sc->drefs_count; i++) { MOV_dref_t *dref = &sc->drefs[i]; uint32_t size = get_be32(pb); offset_t next = url_ftell(pb) + size - 4; dref->type = get_le32(pb); get_be32(pb); // version + flags dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','i','s') && size > 150) { /* macintosh alias record */ uint16_t volume_len, len; char volume[28]; int16_t type; url_fskip(pb, 10); volume_len = get_byte(pb); volume_len = FFMIN(volume_len, 27); get_buffer(pb, volume, 27); volume[volume_len] = 0; av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", volume, volume_len); url_fskip(pb, 112); for (type = 0; type != -1 && url_ftell(pb) < next; ) { type = get_be16(pb); len = get_be16(pb); av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); if (len&1) len += 1; if (type == 2) { // absolute path dref->path = av_mallocz(len+1); get_buffer(pb, dref->path, len); if (!strncmp(dref->path, volume, volume_len)) { len -= volume_len; memmove(dref->path, dref->path+volume_len, len); dref->path[len] = 0; } for (j = 0; j < len; j++) if (dref->path[j] == ':') dref->path[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "path %s\n", dref->path); } else url_fskip(pb, len); } } url_fseek(pb, next, SEEK_SET); } return 0; }
true
FFmpeg
dbb7cbf26ed44d258c56e976de3300d87b716875
static int mov_read_dref(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; int entries, i, j; get_be32(pb); entries = get_be32(pb); if (entries >= UINT_MAX / sizeof(*sc->drefs)) return -1; sc->drefs_count = entries; sc->drefs = av_mallocz(entries * sizeof(*sc->drefs)); for (i = 0; i < sc->drefs_count; i++) { MOV_dref_t *dref = &sc->drefs[i]; uint32_t size = get_be32(pb); offset_t next = url_ftell(pb) + size - 4; dref->type = get_le32(pb); get_be32(pb); dprintf(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','i','s') && size > 150) { uint16_t volume_len, len; char volume[28]; int16_t type; url_fskip(pb, 10); volume_len = get_byte(pb); volume_len = FFMIN(volume_len, 27); get_buffer(pb, volume, 27); volume[volume_len] = 0; av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", volume, volume_len); url_fskip(pb, 112); for (type = 0; type != -1 && url_ftell(pb) < next; ) { type = get_be16(pb); len = get_be16(pb); av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); if (len&1) len += 1; if (type == 2) { dref->path = av_mallocz(len+1); get_buffer(pb, dref->path, len); if (!strncmp(dref->path, volume, volume_len)) { len -= volume_len; memmove(dref->path, dref->path+volume_len, len); dref->path[len] = 0; } for (j = 0; j < len; j++) if (dref->path[j] == ':') dref->path[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "path %s\n", dref->path); } else url_fskip(pb, len); } } url_fseek(pb, next, SEEK_SET); } return 0; }
{ "code": [ " if (!strncmp(dref->path, volume, volume_len)) {" ], "line_no": [ 95 ] }
static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2) { AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1]; MOVStreamContext *sc = st->priv_data; int VAR_3, VAR_4, VAR_5; get_be32(VAR_1); VAR_3 = get_be32(VAR_1); if (VAR_3 >= UINT_MAX / sizeof(*sc->drefs)) return -1; sc->drefs_count = VAR_3; sc->drefs = av_mallocz(VAR_3 * sizeof(*sc->drefs)); for (VAR_4 = 0; VAR_4 < sc->drefs_count; VAR_4++) { MOV_dref_t *dref = &sc->drefs[VAR_4]; uint32_t size = get_be32(VAR_1); offset_t next = url_ftell(VAR_1) + size - 4; dref->type = get_le32(VAR_1); get_be32(VAR_1); dprintf(VAR_0->fc, "type %.4s size %d\n", (char*)&dref->type, size); if (dref->type == MKTAG('a','l','VAR_4','s') && size > 150) { uint16_t volume_len, len; char volume[28]; int16_t type; url_fskip(VAR_1, 10); volume_len = get_byte(VAR_1); volume_len = FFMIN(volume_len, 27); get_buffer(VAR_1, volume, 27); volume[volume_len] = 0; av_log(VAR_0->fc, AV_LOG_DEBUG, "volume %s, len %d\n", volume, volume_len); url_fskip(VAR_1, 112); for (type = 0; type != -1 && url_ftell(VAR_1) < next; ) { type = get_be16(VAR_1); len = get_be16(VAR_1); av_log(VAR_0->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); if (len&1) len += 1; if (type == 2) { dref->path = av_mallocz(len+1); get_buffer(VAR_1, dref->path, len); if (!strncmp(dref->path, volume, volume_len)) { len -= volume_len; memmove(dref->path, dref->path+volume_len, len); dref->path[len] = 0; } for (VAR_5 = 0; VAR_5 < len; VAR_5++) if (dref->path[VAR_5] == ':') dref->path[VAR_5] = '/'; av_log(VAR_0->fc, AV_LOG_DEBUG, "path %s\n", dref->path); } else url_fskip(VAR_1, len); } } url_fseek(VAR_1, next, SEEK_SET); } return 0; }
[ "static int FUNC_0(MOVContext *VAR_0, ByteIOContext *VAR_1, MOV_atom_t VAR_2)\n{", "AVStream *st = VAR_0->fc->streams[VAR_0->fc->nb_streams-1];", "MOVStreamContext *sc = st->priv_data;", "int VAR_3, VAR_4, VAR_5;", "get_be32(VAR_1);", "VAR_3 = get_be32(VAR_1);", "if (VAR_3 >= UINT_MAX / sizeof(*sc->drefs))\nreturn -1;", "sc->drefs_count = VAR_3;", "sc->drefs = av_mallocz(VAR_3 * sizeof(*sc->drefs));", "for (VAR_4 = 0; VAR_4 < sc->drefs_count; VAR_4++) {", "MOV_dref_t *dref = &sc->drefs[VAR_4];", "uint32_t size = get_be32(VAR_1);", "offset_t next = url_ftell(VAR_1) + size - 4;", "dref->type = get_le32(VAR_1);", "get_be32(VAR_1);", "dprintf(VAR_0->fc, \"type %.4s size %d\\n\", (char*)&dref->type, size);", "if (dref->type == MKTAG('a','l','VAR_4','s') && size > 150) {", "uint16_t volume_len, len;", "char volume[28];", "int16_t type;", "url_fskip(VAR_1, 10);", "volume_len = get_byte(VAR_1);", "volume_len = FFMIN(volume_len, 27);", "get_buffer(VAR_1, volume, 27);", "volume[volume_len] = 0;", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"volume %s, len %d\\n\", volume, volume_len);", "url_fskip(VAR_1, 112);", "for (type = 0; type != -1 && url_ftell(VAR_1) < next; ) {", "type = get_be16(VAR_1);", "len = get_be16(VAR_1);", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"type %d, len %d\\n\", type, len);", "if (len&1)\nlen += 1;", "if (type == 2) {", "dref->path = av_mallocz(len+1);", "get_buffer(VAR_1, dref->path, len);", "if (!strncmp(dref->path, volume, volume_len)) {", "len -= volume_len;", "memmove(dref->path, dref->path+volume_len, len);", "dref->path[len] = 0;", "}", "for (VAR_5 = 0; VAR_5 < len; VAR_5++)", "if (dref->path[VAR_5] == ':')\ndref->path[VAR_5] = '/';", "av_log(VAR_0->fc, AV_LOG_DEBUG, \"path %s\\n\", dref->path);", "} else", "url_fskip(VAR_1, len);", "}", "}", "url_fseek(VAR_1, next, SEEK_SET);", "}", "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, 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 ], [ 37 ], [ 39 ], [ 41 ], [ 45 ], [ 49 ], [ 51 ], [ 53 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 73 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 107, 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ] ]
5,912
int usb_handle_packet(USBDevice *dev, USBPacket *p) { int ret; if (dev == NULL) { return USB_RET_NODEV; } assert(dev->addr == p->devaddr); assert(dev->state == USB_STATE_DEFAULT); assert(p->owner == NULL); if (p->devep == 0) { /* control pipe */ switch (p->pid) { case USB_TOKEN_SETUP: ret = do_token_setup(dev, p); break; case USB_TOKEN_IN: ret = do_token_in(dev, p); break; case USB_TOKEN_OUT: ret = do_token_out(dev, p); break; default: ret = USB_RET_STALL; break; } } else { /* data pipe */ ret = usb_device_handle_data(dev, p); } if (ret == USB_RET_ASYNC) { p->owner = usb_ep_get(dev, p->pid, p->devep); } return ret; }
true
qemu
f53c398aa603cea135ee58fd15249aeff7b9c7ea
int usb_handle_packet(USBDevice *dev, USBPacket *p) { int ret; if (dev == NULL) { return USB_RET_NODEV; } assert(dev->addr == p->devaddr); assert(dev->state == USB_STATE_DEFAULT); assert(p->owner == NULL); if (p->devep == 0) { switch (p->pid) { case USB_TOKEN_SETUP: ret = do_token_setup(dev, p); break; case USB_TOKEN_IN: ret = do_token_in(dev, p); break; case USB_TOKEN_OUT: ret = do_token_out(dev, p); break; default: ret = USB_RET_STALL; break; } } else { ret = usb_device_handle_data(dev, p); } if (ret == USB_RET_ASYNC) { p->owner = usb_ep_get(dev, p->pid, p->devep); } return ret; }
{ "code": [ " assert(p->owner == NULL);", " p->owner = usb_ep_get(dev, p->pid, p->devep);" ], "line_no": [ 19, 67 ] }
int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1) { int VAR_2; if (VAR_0 == NULL) { return USB_RET_NODEV; } assert(VAR_0->addr == VAR_1->devaddr); assert(VAR_0->state == USB_STATE_DEFAULT); assert(VAR_1->owner == NULL); if (VAR_1->devep == 0) { switch (VAR_1->pid) { case USB_TOKEN_SETUP: VAR_2 = do_token_setup(VAR_0, VAR_1); break; case USB_TOKEN_IN: VAR_2 = do_token_in(VAR_0, VAR_1); break; case USB_TOKEN_OUT: VAR_2 = do_token_out(VAR_0, VAR_1); break; default: VAR_2 = USB_RET_STALL; break; } } else { VAR_2 = usb_device_handle_data(VAR_0, VAR_1); } if (VAR_2 == USB_RET_ASYNC) { VAR_1->owner = usb_ep_get(VAR_0, VAR_1->pid, VAR_1->devep); } return VAR_2; }
[ "int FUNC_0(USBDevice *VAR_0, USBPacket *VAR_1)\n{", "int VAR_2;", "if (VAR_0 == NULL) {", "return USB_RET_NODEV;", "}", "assert(VAR_0->addr == VAR_1->devaddr);", "assert(VAR_0->state == USB_STATE_DEFAULT);", "assert(VAR_1->owner == NULL);", "if (VAR_1->devep == 0) {", "switch (VAR_1->pid) {", "case USB_TOKEN_SETUP:\nVAR_2 = do_token_setup(VAR_0, VAR_1);", "break;", "case USB_TOKEN_IN:\nVAR_2 = do_token_in(VAR_0, VAR_1);", "break;", "case USB_TOKEN_OUT:\nVAR_2 = do_token_out(VAR_0, VAR_1);", "break;", "default:\nVAR_2 = USB_RET_STALL;", "break;", "}", "} else {", "VAR_2 = usb_device_handle_data(VAR_0, VAR_1);", "}", "if (VAR_2 == USB_RET_ASYNC) {", "VAR_1->owner = usb_ep_get(VAR_0, VAR_1->pid, VAR_1->devep);", "}", "return VAR_2;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47, 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ] ]
5,914
static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw) { char *filename; MemoryRegion *bios, *isa_bios; int bios_size, isa_bios_size; int ret; /* BIOS load */ if (bios_name == NULL) { bios_name = BIOS_FILENAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = get_image_size(filename); } else { bios_size = -1; } if (bios_size <= 0 || (bios_size % 65536) != 0) { goto bios_error; } bios = g_malloc(sizeof(*bios)); memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_abort); vmstate_register_ram_global(bios); if (!isapc_ram_fw) { memory_region_set_readonly(bios, true); } ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1); if (ret != 0) { bios_error: fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name); exit(1); } g_free(filename); /* map the last 128KB of the BIOS in ISA space */ isa_bios_size = bios_size; if (isa_bios_size > (128 * 1024)) { isa_bios_size = 128 * 1024; } isa_bios = g_malloc(sizeof(*isa_bios)); memory_region_init_alias(isa_bios, NULL, "isa-bios", bios, bios_size - isa_bios_size, isa_bios_size); memory_region_add_subregion_overlap(rom_memory, 0x100000 - isa_bios_size, isa_bios, 1); if (!isapc_ram_fw) { memory_region_set_readonly(isa_bios, true); } /* map all the bios at the top of memory */ memory_region_add_subregion(rom_memory, (uint32_t)(-bios_size), bios); }
true
qemu
f8ed85ac992c48814d916d5df4d44f9a971c5de4
static void old_pc_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw) { char *filename; MemoryRegion *bios, *isa_bios; int bios_size, isa_bios_size; int ret; if (bios_name == NULL) { bios_name = BIOS_FILENAME; } filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { bios_size = get_image_size(filename); } else { bios_size = -1; } if (bios_size <= 0 || (bios_size % 65536) != 0) { goto bios_error; } bios = g_malloc(sizeof(*bios)); memory_region_init_ram(bios, NULL, "pc.bios", bios_size, &error_abort); vmstate_register_ram_global(bios); if (!isapc_ram_fw) { memory_region_set_readonly(bios, true); } ret = rom_add_file_fixed(bios_name, (uint32_t)(-bios_size), -1); if (ret != 0) { bios_error: fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name); exit(1); } g_free(filename); isa_bios_size = bios_size; if (isa_bios_size > (128 * 1024)) { isa_bios_size = 128 * 1024; } isa_bios = g_malloc(sizeof(*isa_bios)); memory_region_init_alias(isa_bios, NULL, "isa-bios", bios, bios_size - isa_bios_size, isa_bios_size); memory_region_add_subregion_overlap(rom_memory, 0x100000 - isa_bios_size, isa_bios, 1); if (!isapc_ram_fw) { memory_region_set_readonly(isa_bios, true); } memory_region_add_subregion(rom_memory, (uint32_t)(-bios_size), bios); }
{ "code": [ " memory_region_init_ram(bios, NULL, \"pc.bios\", bios_size, &error_abort);" ], "line_no": [ 45 ] }
static void FUNC_0(MemoryRegion *VAR_0, bool VAR_1) { char *VAR_2; MemoryRegion *bios, *isa_bios; int VAR_3, VAR_4; int VAR_5; if (bios_name == NULL) { bios_name = BIOS_FILENAME; } VAR_2 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (VAR_2) { VAR_3 = get_image_size(VAR_2); } else { VAR_3 = -1; } if (VAR_3 <= 0 || (VAR_3 % 65536) != 0) { goto bios_error; } bios = g_malloc(sizeof(*bios)); memory_region_init_ram(bios, NULL, "pc.bios", VAR_3, &error_abort); vmstate_register_ram_global(bios); if (!VAR_1) { memory_region_set_readonly(bios, true); } VAR_5 = rom_add_file_fixed(bios_name, (uint32_t)(-VAR_3), -1); if (VAR_5 != 0) { bios_error: fprintf(stderr, "qemu: could not load PC BIOS '%s'\n", bios_name); exit(1); } g_free(VAR_2); VAR_4 = VAR_3; if (VAR_4 > (128 * 1024)) { VAR_4 = 128 * 1024; } isa_bios = g_malloc(sizeof(*isa_bios)); memory_region_init_alias(isa_bios, NULL, "isa-bios", bios, VAR_3 - VAR_4, VAR_4); memory_region_add_subregion_overlap(VAR_0, 0x100000 - VAR_4, isa_bios, 1); if (!VAR_1) { memory_region_set_readonly(isa_bios, true); } memory_region_add_subregion(VAR_0, (uint32_t)(-VAR_3), bios); }
[ "static void FUNC_0(MemoryRegion *VAR_0, bool VAR_1)\n{", "char *VAR_2;", "MemoryRegion *bios, *isa_bios;", "int VAR_3, VAR_4;", "int VAR_5;", "if (bios_name == NULL) {", "bios_name = BIOS_FILENAME;", "}", "VAR_2 = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);", "if (VAR_2) {", "VAR_3 = get_image_size(VAR_2);", "} else {", "VAR_3 = -1;", "}", "if (VAR_3 <= 0 ||\n(VAR_3 % 65536) != 0) {", "goto bios_error;", "}", "bios = g_malloc(sizeof(*bios));", "memory_region_init_ram(bios, NULL, \"pc.bios\", VAR_3, &error_abort);", "vmstate_register_ram_global(bios);", "if (!VAR_1) {", "memory_region_set_readonly(bios, true);", "}", "VAR_5 = rom_add_file_fixed(bios_name, (uint32_t)(-VAR_3), -1);", "if (VAR_5 != 0) {", "bios_error:\nfprintf(stderr, \"qemu: could not load PC BIOS '%s'\\n\", bios_name);", "exit(1);", "}", "g_free(VAR_2);", "VAR_4 = VAR_3;", "if (VAR_4 > (128 * 1024)) {", "VAR_4 = 128 * 1024;", "}", "isa_bios = g_malloc(sizeof(*isa_bios));", "memory_region_init_alias(isa_bios, NULL, \"isa-bios\", bios,\nVAR_3 - VAR_4, VAR_4);", "memory_region_add_subregion_overlap(VAR_0,\n0x100000 - VAR_4,\nisa_bios,\n1);", "if (!VAR_1) {", "memory_region_set_readonly(isa_bios, true);", "}", "memory_region_add_subregion(VAR_0,\n(uint32_t)(-VAR_3),\nbios);", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 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 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83, 85 ], [ 87, 89, 91, 93 ], [ 95 ], [ 97 ], [ 99 ], [ 105, 107, 109 ], [ 111 ] ]
5,916
static int kvm_handle_debug(PowerPCCPU *cpu, struct kvm_run *run) { CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; struct kvm_debug_exit_arch *arch_info = &run->debug.arch; int handle = 0; if (kvm_find_sw_breakpoint(cs, arch_info->address)) { handle = 1; } else { /* QEMU is not able to handle debug exception, so inject * program exception to guest; * Yes program exception NOT debug exception !! * For software breakpoint QEMU uses a privileged instruction; * So there cannot be any reason that we are here for guest * set debug exception, only possibility is guest executed a * privileged / illegal instruction and that's why we are * injecting a program interrupt. */ cpu_synchronize_state(cs); /* env->nip is PC, so increment this by 4 to use * ppc_cpu_do_interrupt(), which set srr0 = env->nip - 4. */ env->nip += 4; cs->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL; ppc_cpu_do_interrupt(cs); } return handle; }
true
qemu
88365d17d586bcf0d9f4432447db345f72278a2a
static int kvm_handle_debug(PowerPCCPU *cpu, struct kvm_run *run) { CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; struct kvm_debug_exit_arch *arch_info = &run->debug.arch; int handle = 0; if (kvm_find_sw_breakpoint(cs, arch_info->address)) { handle = 1; } else { cpu_synchronize_state(cs); env->nip += 4; cs->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL; ppc_cpu_do_interrupt(cs); } return handle; }
{ "code": [ " if (kvm_find_sw_breakpoint(cs, arch_info->address)) {" ], "line_no": [ 15 ] }
static int FUNC_0(PowerPCCPU *VAR_0, struct kvm_run *VAR_1) { CPUState *cs = CPU(VAR_0); CPUPPCState *env = &VAR_0->env; struct kvm_debug_exit_arch *VAR_2 = &VAR_1->debug.arch; int VAR_3 = 0; if (kvm_find_sw_breakpoint(cs, VAR_2->address)) { VAR_3 = 1; } else { cpu_synchronize_state(cs); env->nip += 4; cs->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL; ppc_cpu_do_interrupt(cs); } return VAR_3; }
[ "static int FUNC_0(PowerPCCPU *VAR_0, struct kvm_run *VAR_1)\n{", "CPUState *cs = CPU(VAR_0);", "CPUPPCState *env = &VAR_0->env;", "struct kvm_debug_exit_arch *VAR_2 = &VAR_1->debug.arch;", "int VAR_3 = 0;", "if (kvm_find_sw_breakpoint(cs, VAR_2->address)) {", "VAR_3 = 1;", "} else {", "cpu_synchronize_state(cs);", "env->nip += 4;", "cs->exception_index = POWERPC_EXCP_PROGRAM;", "env->error_code = POWERPC_EXCP_INVAL;", "ppc_cpu_do_interrupt(cs);", "}", "return VAR_3;", "}" ]
[ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 41 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ] ]
5,917
void helper_ldda_asi(target_ulong addr, int asi, int rd) { if ((asi < 0x80 && (env->pstate & PS_PRIV) == 0) || ((env->def->features & CPU_FEATURE_HYPV) && asi >= 0x30 && asi < 0x80 && !(env->hpstate & HS_PRIV))) raise_exception(TT_PRIV_ACT); switch (asi) { case 0x24: // Nucleus quad LDD 128 bit atomic case 0x2c: // Nucleus quad LDD 128 bit atomic LE helper_check_align(addr, 0xf); if (rd == 0) { env->gregs[1] = ldq_kernel(addr + 8); if (asi == 0x2c) bswap64s(&env->gregs[1]); } else if (rd < 8) { env->gregs[rd] = ldq_kernel(addr); env->gregs[rd + 1] = ldq_kernel(addr + 8); if (asi == 0x2c) { bswap64s(&env->gregs[rd]); bswap64s(&env->gregs[rd + 1]); } } else { env->regwptr[rd] = ldq_kernel(addr); env->regwptr[rd + 1] = ldq_kernel(addr + 8); if (asi == 0x2c) { bswap64s(&env->regwptr[rd]); bswap64s(&env->regwptr[rd + 1]); } } break; default: helper_check_align(addr, 0x3); if (rd == 0) env->gregs[1] = helper_ld_asi(addr + 4, asi, 4, 0); else if (rd < 8) { env->gregs[rd] = helper_ld_asi(addr, asi, 4, 0); env->gregs[rd + 1] = helper_ld_asi(addr + 4, asi, 4, 0); } else { env->regwptr[rd] = helper_ld_asi(addr, asi, 4, 0); env->regwptr[rd + 1] = helper_ld_asi(addr + 4, asi, 4, 0); } break; } }
true
qemu
2aae2b8e0abd58e76d616bcbe93c6966d06d0188
void helper_ldda_asi(target_ulong addr, int asi, int rd) { if ((asi < 0x80 && (env->pstate & PS_PRIV) == 0) || ((env->def->features & CPU_FEATURE_HYPV) && asi >= 0x30 && asi < 0x80 && !(env->hpstate & HS_PRIV))) raise_exception(TT_PRIV_ACT); switch (asi) { case 0x24: case 0x2c: LE helper_check_align(addr, 0xf); if (rd == 0) { env->gregs[1] = ldq_kernel(addr + 8); if (asi == 0x2c) bswap64s(&env->gregs[1]); } else if (rd < 8) { env->gregs[rd] = ldq_kernel(addr); env->gregs[rd + 1] = ldq_kernel(addr + 8); if (asi == 0x2c) { bswap64s(&env->gregs[rd]); bswap64s(&env->gregs[rd + 1]); } } else { env->regwptr[rd] = ldq_kernel(addr); env->regwptr[rd + 1] = ldq_kernel(addr + 8); if (asi == 0x2c) { bswap64s(&env->regwptr[rd]); bswap64s(&env->regwptr[rd + 1]); } } break; default: helper_check_align(addr, 0x3); if (rd == 0) env->gregs[1] = helper_ld_asi(addr + 4, asi, 4, 0); else if (rd < 8) { env->gregs[rd] = helper_ld_asi(addr, asi, 4, 0); env->gregs[rd + 1] = helper_ld_asi(addr + 4, asi, 4, 0); } else { env->regwptr[rd] = helper_ld_asi(addr, asi, 4, 0); env->regwptr[rd + 1] = helper_ld_asi(addr + 4, asi, 4, 0); } break; } }
{ "code": [ " || ((env->def->features & CPU_FEATURE_HYPV)", " || ((env->def->features & CPU_FEATURE_HYPV)", " || ((env->def->features & CPU_FEATURE_HYPV)" ], "line_no": [ 7, 7, 7 ] }
void FUNC_0(target_ulong VAR_0, int VAR_1, int VAR_2) { if ((VAR_1 < 0x80 && (env->pstate & PS_PRIV) == 0) || ((env->def->features & CPU_FEATURE_HYPV) && VAR_1 >= 0x30 && VAR_1 < 0x80 && !(env->hpstate & HS_PRIV))) raise_exception(TT_PRIV_ACT); switch (VAR_1) { case 0x24: case 0x2c: LE helper_check_align(VAR_0, 0xf); if (VAR_2 == 0) { env->gregs[1] = ldq_kernel(VAR_0 + 8); if (VAR_1 == 0x2c) bswap64s(&env->gregs[1]); } else if (VAR_2 < 8) { env->gregs[VAR_2] = ldq_kernel(VAR_0); env->gregs[VAR_2 + 1] = ldq_kernel(VAR_0 + 8); if (VAR_1 == 0x2c) { bswap64s(&env->gregs[VAR_2]); bswap64s(&env->gregs[VAR_2 + 1]); } } else { env->regwptr[VAR_2] = ldq_kernel(VAR_0); env->regwptr[VAR_2 + 1] = ldq_kernel(VAR_0 + 8); if (VAR_1 == 0x2c) { bswap64s(&env->regwptr[VAR_2]); bswap64s(&env->regwptr[VAR_2 + 1]); } } break; default: helper_check_align(VAR_0, 0x3); if (VAR_2 == 0) env->gregs[1] = helper_ld_asi(VAR_0 + 4, VAR_1, 4, 0); else if (VAR_2 < 8) { env->gregs[VAR_2] = helper_ld_asi(VAR_0, VAR_1, 4, 0); env->gregs[VAR_2 + 1] = helper_ld_asi(VAR_0 + 4, VAR_1, 4, 0); } else { env->regwptr[VAR_2] = helper_ld_asi(VAR_0, VAR_1, 4, 0); env->regwptr[VAR_2 + 1] = helper_ld_asi(VAR_0 + 4, VAR_1, 4, 0); } break; } }
[ "void FUNC_0(target_ulong VAR_0, int VAR_1, int VAR_2)\n{", "if ((VAR_1 < 0x80 && (env->pstate & PS_PRIV) == 0)\n|| ((env->def->features & CPU_FEATURE_HYPV)\n&& VAR_1 >= 0x30 && VAR_1 < 0x80\n&& !(env->hpstate & HS_PRIV)))\nraise_exception(TT_PRIV_ACT);", "switch (VAR_1) {", "case 0x24:\ncase 0x2c: LE\nhelper_check_align(VAR_0, 0xf);", "if (VAR_2 == 0) {", "env->gregs[1] = ldq_kernel(VAR_0 + 8);", "if (VAR_1 == 0x2c)\nbswap64s(&env->gregs[1]);", "} else if (VAR_2 < 8) {", "env->gregs[VAR_2] = ldq_kernel(VAR_0);", "env->gregs[VAR_2 + 1] = ldq_kernel(VAR_0 + 8);", "if (VAR_1 == 0x2c) {", "bswap64s(&env->gregs[VAR_2]);", "bswap64s(&env->gregs[VAR_2 + 1]);", "}", "} else {", "env->regwptr[VAR_2] = ldq_kernel(VAR_0);", "env->regwptr[VAR_2 + 1] = ldq_kernel(VAR_0 + 8);", "if (VAR_1 == 0x2c) {", "bswap64s(&env->regwptr[VAR_2]);", "bswap64s(&env->regwptr[VAR_2 + 1]);", "}", "}", "break;", "default:\nhelper_check_align(VAR_0, 0x3);", "if (VAR_2 == 0)\nenv->gregs[1] = helper_ld_asi(VAR_0 + 4, VAR_1, 4, 0);", "else if (VAR_2 < 8) {", "env->gregs[VAR_2] = helper_ld_asi(VAR_0, VAR_1, 4, 0);", "env->gregs[VAR_2 + 1] = helper_ld_asi(VAR_0 + 4, VAR_1, 4, 0);", "} else {", "env->regwptr[VAR_2] = helper_ld_asi(VAR_0, VAR_1, 4, 0);", "env->regwptr[VAR_2 + 1] = helper_ld_asi(VAR_0 + 4, VAR_1, 4, 0);", "}", "break;", "}", "}" ]
[ 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 ]
[ [ 1, 3 ], [ 5, 7, 9, 11, 13 ], [ 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 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ] ]
5,918
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VBDecContext * const c = avctx->priv_data; uint8_t *outptr, *srcptr; int i, j; int flags; uint32_t size; int rest = buf_size; int offset = 0; if(c->pic.data[0]) avctx->release_buffer(avctx, &c->pic); c->pic.reference = 3; if(avctx->get_buffer(avctx, &c->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } c->stream = buf; flags = bytestream_get_le16(&c->stream); rest -= 2; if(flags & VB_HAS_GMC){ i = (int16_t)bytestream_get_le16(&c->stream); j = (int16_t)bytestream_get_le16(&c->stream); offset = i + j * avctx->width; rest -= 4; } if(flags & VB_HAS_VIDEO){ size = bytestream_get_le32(&c->stream); if(size > rest){ av_log(avctx, AV_LOG_ERROR, "Frame size is too big\n"); return -1; } vb_decode_framedata(c, c->stream, size, offset); c->stream += size - 4; rest -= size; } if(flags & VB_HAS_PALETTE){ size = bytestream_get_le32(&c->stream); if(size > rest){ av_log(avctx, AV_LOG_ERROR, "Palette size is too big\n"); return -1; } vb_decode_palette(c, size); rest -= size; } memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE); c->pic.palette_has_changed = flags & VB_HAS_PALETTE; outptr = c->pic.data[0]; srcptr = c->frame; for(i = 0; i < avctx->height; i++){ memcpy(outptr, srcptr, avctx->width); srcptr += avctx->width; outptr += c->pic.linesize[0]; } FFSWAP(uint8_t*, c->frame, c->prev_frame); *data_size = sizeof(AVFrame); *(AVFrame*)data = c->pic; /* always report that the buffer was completely consumed */ return buf_size; }
true
FFmpeg
5b98ea1b7309fd43694b92e990439636630f408a
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VBDecContext * const c = avctx->priv_data; uint8_t *outptr, *srcptr; int i, j; int flags; uint32_t size; int rest = buf_size; int offset = 0; if(c->pic.data[0]) avctx->release_buffer(avctx, &c->pic); c->pic.reference = 3; if(avctx->get_buffer(avctx, &c->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } c->stream = buf; flags = bytestream_get_le16(&c->stream); rest -= 2; if(flags & VB_HAS_GMC){ i = (int16_t)bytestream_get_le16(&c->stream); j = (int16_t)bytestream_get_le16(&c->stream); offset = i + j * avctx->width; rest -= 4; } if(flags & VB_HAS_VIDEO){ size = bytestream_get_le32(&c->stream); if(size > rest){ av_log(avctx, AV_LOG_ERROR, "Frame size is too big\n"); return -1; } vb_decode_framedata(c, c->stream, size, offset); c->stream += size - 4; rest -= size; } if(flags & VB_HAS_PALETTE){ size = bytestream_get_le32(&c->stream); if(size > rest){ av_log(avctx, AV_LOG_ERROR, "Palette size is too big\n"); return -1; } vb_decode_palette(c, size); rest -= size; } memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE); c->pic.palette_has_changed = flags & VB_HAS_PALETTE; outptr = c->pic.data[0]; srcptr = c->frame; for(i = 0; i < avctx->height; i++){ memcpy(outptr, srcptr, avctx->width); srcptr += avctx->width; outptr += c->pic.linesize[0]; } FFSWAP(uint8_t*, c->frame, c->prev_frame); *data_size = sizeof(AVFrame); *(AVFrame*)data = c->pic; return buf_size; }
{ "code": [ " if(size > rest){", " av_log(avctx, AV_LOG_ERROR, \"Frame size is too big\\n\");" ], "line_no": [ 65, 67 ] }
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; int VAR_5 = VAR_3->size; VBDecContext * const c = VAR_0->priv_data; uint8_t *outptr, *srcptr; int VAR_6, VAR_7; int VAR_8; uint32_t size; int VAR_9 = VAR_5; int VAR_10 = 0; if(c->pic.VAR_1[0]) VAR_0->release_buffer(VAR_0, &c->pic); c->pic.reference = 3; if(VAR_0->get_buffer(VAR_0, &c->pic) < 0){ av_log(VAR_0, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } c->stream = VAR_4; VAR_8 = bytestream_get_le16(&c->stream); VAR_9 -= 2; if(VAR_8 & VB_HAS_GMC){ VAR_6 = (int16_t)bytestream_get_le16(&c->stream); VAR_7 = (int16_t)bytestream_get_le16(&c->stream); VAR_10 = VAR_6 + VAR_7 * VAR_0->width; VAR_9 -= 4; } if(VAR_8 & VB_HAS_VIDEO){ size = bytestream_get_le32(&c->stream); if(size > VAR_9){ av_log(VAR_0, AV_LOG_ERROR, "Frame size is too big\n"); return -1; } vb_decode_framedata(c, c->stream, size, VAR_10); c->stream += size - 4; VAR_9 -= size; } if(VAR_8 & VB_HAS_PALETTE){ size = bytestream_get_le32(&c->stream); if(size > VAR_9){ av_log(VAR_0, AV_LOG_ERROR, "Palette size is too big\n"); return -1; } vb_decode_palette(c, size); VAR_9 -= size; } memcpy(c->pic.VAR_1[1], c->pal, AVPALETTE_SIZE); c->pic.palette_has_changed = VAR_8 & VB_HAS_PALETTE; outptr = c->pic.VAR_1[0]; srcptr = c->frame; for(VAR_6 = 0; VAR_6 < VAR_0->height; VAR_6++){ memcpy(outptr, srcptr, VAR_0->width); srcptr += VAR_0->width; outptr += c->pic.linesize[0]; } FFSWAP(uint8_t*, c->frame, c->prev_frame); *VAR_2 = sizeof(AVFrame); *(AVFrame*)VAR_1 = c->pic; return VAR_5; }
[ "static int FUNC_0(AVCodecContext *VAR_0, void *VAR_1, int *VAR_2, AVPacket *VAR_3)\n{", "const uint8_t *VAR_4 = VAR_3->VAR_1;", "int VAR_5 = VAR_3->size;", "VBDecContext * const c = VAR_0->priv_data;", "uint8_t *outptr, *srcptr;", "int VAR_6, VAR_7;", "int VAR_8;", "uint32_t size;", "int VAR_9 = VAR_5;", "int VAR_10 = 0;", "if(c->pic.VAR_1[0])\nVAR_0->release_buffer(VAR_0, &c->pic);", "c->pic.reference = 3;", "if(VAR_0->get_buffer(VAR_0, &c->pic) < 0){", "av_log(VAR_0, AV_LOG_ERROR, \"get_buffer() failed\\n\");", "return -1;", "}", "c->stream = VAR_4;", "VAR_8 = bytestream_get_le16(&c->stream);", "VAR_9 -= 2;", "if(VAR_8 & VB_HAS_GMC){", "VAR_6 = (int16_t)bytestream_get_le16(&c->stream);", "VAR_7 = (int16_t)bytestream_get_le16(&c->stream);", "VAR_10 = VAR_6 + VAR_7 * VAR_0->width;", "VAR_9 -= 4;", "}", "if(VAR_8 & VB_HAS_VIDEO){", "size = bytestream_get_le32(&c->stream);", "if(size > VAR_9){", "av_log(VAR_0, AV_LOG_ERROR, \"Frame size is too big\\n\");", "return -1;", "}", "vb_decode_framedata(c, c->stream, size, VAR_10);", "c->stream += size - 4;", "VAR_9 -= size;", "}", "if(VAR_8 & VB_HAS_PALETTE){", "size = bytestream_get_le32(&c->stream);", "if(size > VAR_9){", "av_log(VAR_0, AV_LOG_ERROR, \"Palette size is too big\\n\");", "return -1;", "}", "vb_decode_palette(c, size);", "VAR_9 -= size;", "}", "memcpy(c->pic.VAR_1[1], c->pal, AVPALETTE_SIZE);", "c->pic.palette_has_changed = VAR_8 & VB_HAS_PALETTE;", "outptr = c->pic.VAR_1[0];", "srcptr = c->frame;", "for(VAR_6 = 0; VAR_6 < VAR_0->height; VAR_6++){", "memcpy(outptr, srcptr, VAR_0->width);", "srcptr += VAR_0->width;", "outptr += c->pic.linesize[0];", "}", "FFSWAP(uint8_t*, c->frame, c->prev_frame);", "*VAR_2 = sizeof(AVFrame);", "*(AVFrame*)VAR_1 = c->pic;", "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, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25, 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 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 ], [ 107 ], [ 109 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 125 ], [ 129 ], [ 131 ], [ 137 ], [ 139 ] ]
5,919
static inline void RENAME(bgr32ToY)(uint8_t *dst, uint8_t *src, int width) { int i; for(i=0; i<width; i++) { int b= ((uint32_t*)src)[i]&0xFF; int g= (((uint32_t*)src)[i]>>8)&0xFF; int r= (((uint32_t*)src)[i]>>16)&0xFF; dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); } }
true
FFmpeg
2da0d70d5eebe42f9fcd27ee554419ebe2a5da06
static inline void RENAME(bgr32ToY)(uint8_t *dst, uint8_t *src, int width) { int i; for(i=0; i<width; i++) { int b= ((uint32_t*)src)[i]&0xFF; int g= (((uint32_t*)src)[i]>>8)&0xFF; int r= (((uint32_t*)src)[i]>>16)&0xFF; dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); } }
{ "code": [ "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tint b= ((uint32_t*)src)[i]&0xFF;", "\t\tint g= (((uint32_t*)src)[i]>>8)&0xFF;", "\t\tint r= (((uint32_t*)src)[i]>>16)&0xFF;", "\t\tdst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tdst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tint g= (((uint32_t*)src)[i]>>8)&0xFF;", "\t\tdst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\t\tdst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tfor(i=0; i<width; i++)", "\tint i;", "\tint i;", "\tint i;", "\tint i;", "\tint i;" ], "line_no": [ 5, 5, 5, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 11, 13, 15, 19, 5, 7, 5, 7, 19, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 13, 19, 5, 7, 5, 7, 19, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 5, 5, 5, 5 ] }
static inline void FUNC_0(bgr32ToY)(uint8_t *dst, uint8_t *src, int width) { int VAR_0; for(VAR_0=0; VAR_0<width; VAR_0++) { int b= ((uint32_t*)src)[VAR_0]&0xFF; int g= (((uint32_t*)src)[VAR_0]>>8)&0xFF; int r= (((uint32_t*)src)[VAR_0]>>16)&0xFF; dst[VAR_0]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT); } }
[ "static inline void FUNC_0(bgr32ToY)(uint8_t *dst, uint8_t *src, int width)\n{", "int VAR_0;", "for(VAR_0=0; VAR_0<width; VAR_0++)", "{", "int b= ((uint32_t*)src)[VAR_0]&0xFF;", "int g= (((uint32_t*)src)[VAR_0]>>8)&0xFF;", "int r= (((uint32_t*)src)[VAR_0]>>16)&0xFF;", "dst[VAR_0]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);", "}", "}" ]
[ 0, 1, 1, 0, 1, 1, 1, 1, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ] ]
5,921
static void gen_read_xer(TCGv dst) { TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); TCGv t2 = tcg_temp_new(); tcg_gen_mov_tl(dst, cpu_xer); tcg_gen_shli_tl(t0, cpu_so, XER_SO); tcg_gen_shli_tl(t1, cpu_ov, XER_OV); tcg_gen_shli_tl(t2, cpu_ca, XER_CA); tcg_gen_or_tl(t0, t0, t1); tcg_gen_or_tl(dst, dst, t2); tcg_gen_or_tl(dst, dst, t0); tcg_temp_free(t0); tcg_temp_free(t1); tcg_temp_free(t2); }
true
qemu
dd09c36159858c66ab6e47c688e4177dd3912bf0
static void gen_read_xer(TCGv dst) { TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); TCGv t2 = tcg_temp_new(); tcg_gen_mov_tl(dst, cpu_xer); tcg_gen_shli_tl(t0, cpu_so, XER_SO); tcg_gen_shli_tl(t1, cpu_ov, XER_OV); tcg_gen_shli_tl(t2, cpu_ca, XER_CA); tcg_gen_or_tl(t0, t0, t1); tcg_gen_or_tl(dst, dst, t2); tcg_gen_or_tl(dst, dst, t0); tcg_temp_free(t0); tcg_temp_free(t1); tcg_temp_free(t2); }
{ "code": [ "static void gen_read_xer(TCGv dst)" ], "line_no": [ 1 ] }
static void FUNC_0(TCGv VAR_0) { TCGv t0 = tcg_temp_new(); TCGv t1 = tcg_temp_new(); TCGv t2 = tcg_temp_new(); tcg_gen_mov_tl(VAR_0, cpu_xer); tcg_gen_shli_tl(t0, cpu_so, XER_SO); tcg_gen_shli_tl(t1, cpu_ov, XER_OV); tcg_gen_shli_tl(t2, cpu_ca, XER_CA); tcg_gen_or_tl(t0, t0, t1); tcg_gen_or_tl(VAR_0, VAR_0, t2); tcg_gen_or_tl(VAR_0, VAR_0, t0); tcg_temp_free(t0); tcg_temp_free(t1); tcg_temp_free(t2); }
[ "static void FUNC_0(TCGv VAR_0)\n{", "TCGv t0 = tcg_temp_new();", "TCGv t1 = tcg_temp_new();", "TCGv t2 = tcg_temp_new();", "tcg_gen_mov_tl(VAR_0, cpu_xer);", "tcg_gen_shli_tl(t0, cpu_so, XER_SO);", "tcg_gen_shli_tl(t1, cpu_ov, XER_OV);", "tcg_gen_shli_tl(t2, cpu_ca, XER_CA);", "tcg_gen_or_tl(t0, t0, t1);", "tcg_gen_or_tl(VAR_0, VAR_0, t2);", "tcg_gen_or_tl(VAR_0, VAR_0, t0);", "tcg_temp_free(t0);", "tcg_temp_free(t1);", "tcg_temp_free(t2);", "}" ]
[ 1, 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 ] ]
5,922
Object *object_dynamic_cast(Object *obj, const char *typename) { if (object_class_dynamic_cast(object_get_class(obj), typename)) { return obj; } return NULL; }
true
qemu
b7f43fe46029d8fd0594cd599fa2599dcce0f553
Object *object_dynamic_cast(Object *obj, const char *typename) { if (object_class_dynamic_cast(object_get_class(obj), typename)) { return obj; } return NULL; }
{ "code": [ " if (object_class_dynamic_cast(object_get_class(obj), typename)) {" ], "line_no": [ 5 ] }
Object *FUNC_0(Object *obj, const char *typename) { if (object_class_dynamic_cast(object_get_class(obj), typename)) { return obj; } return NULL; }
[ "Object *FUNC_0(Object *obj, const char *typename)\n{", "if (object_class_dynamic_cast(object_get_class(obj), typename)) {", "return obj;", "}", "return NULL;", "}" ]
[ 0, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ] ]
5,924
static void h264_h_loop_filter_chroma_intra_c(uint8_t *pix, int stride, int alpha, int beta) { h264_loop_filter_chroma_intra_c(pix, 1, stride, alpha, beta); }
false
FFmpeg
dd561441b1e849df7d8681c6f32af82d4088dafd
static void h264_h_loop_filter_chroma_intra_c(uint8_t *pix, int stride, int alpha, int beta) { h264_loop_filter_chroma_intra_c(pix, 1, stride, alpha, beta); }
{ "code": [], "line_no": [] }
static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3) { h264_loop_filter_chroma_intra_c(VAR_0, 1, VAR_1, VAR_2, VAR_3); }
[ "static void FUNC_0(uint8_t *VAR_0, int VAR_1, int VAR_2, int VAR_3)\n{", "h264_loop_filter_chroma_intra_c(VAR_0, 1, VAR_1, VAR_2, VAR_3);", "}" ]
[ 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
5,925
static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data) { SVQ1Context * const s = avctx->priv_data; AVFrame *pict = data; AVFrame * const p= (AVFrame*)&s->picture; AVFrame temp; int i; if(avctx->pix_fmt != PIX_FMT_YUV410P){ av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n"); return -1; } if(!s->current_picture.data[0]){ avctx->get_buffer(avctx, &s->current_picture); avctx->get_buffer(avctx, &s->last_picture); s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16); } temp= s->current_picture; s->current_picture= s->last_picture; s->last_picture= temp; init_put_bits(&s->pb, buf, buf_size); *p = *pict; p->pict_type = avctx->gop_size && avctx->frame_number % avctx->gop_size ? FF_P_TYPE : FF_I_TYPE; p->key_frame = p->pict_type == FF_I_TYPE; svq1_write_header(s, p->pict_type); for(i=0; i<3; i++){ if(svq1_encode_plane(s, i, s->picture.data[i], s->last_picture.data[i], s->current_picture.data[i], s->frame_width / (i?4:1), s->frame_height / (i?4:1), s->picture.linesize[i], s->current_picture.linesize[i]) < 0) return -1; } // align_put_bits(&s->pb); while(put_bits_count(&s->pb) & 31) put_bits(&s->pb, 1, 0); flush_put_bits(&s->pb); return put_bits_count(&s->pb) / 8; }
true
FFmpeg
a7494872d5a673f064b0570f4359c8d1a3ea1051
static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data) { SVQ1Context * const s = avctx->priv_data; AVFrame *pict = data; AVFrame * const p= (AVFrame*)&s->picture; AVFrame temp; int i; if(avctx->pix_fmt != PIX_FMT_YUV410P){ av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n"); return -1; } if(!s->current_picture.data[0]){ avctx->get_buffer(avctx, &s->current_picture); avctx->get_buffer(avctx, &s->last_picture); s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16); } temp= s->current_picture; s->current_picture= s->last_picture; s->last_picture= temp; init_put_bits(&s->pb, buf, buf_size); *p = *pict; p->pict_type = avctx->gop_size && avctx->frame_number % avctx->gop_size ? FF_P_TYPE : FF_I_TYPE; p->key_frame = p->pict_type == FF_I_TYPE; svq1_write_header(s, p->pict_type); for(i=0; i<3; i++){ if(svq1_encode_plane(s, i, s->picture.data[i], s->last_picture.data[i], s->current_picture.data[i], s->frame_width / (i?4:1), s->frame_height / (i?4:1), s->picture.linesize[i], s->current_picture.linesize[i]) < 0) return -1; } while(put_bits_count(&s->pb) & 31) put_bits(&s->pb, 1, 0); flush_put_bits(&s->pb); return put_bits_count(&s->pb) / 8; }
{ "code": [ " s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16);" ], "line_no": [ 35 ] }
static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1, int VAR_2, void *VAR_3) { SVQ1Context * const s = VAR_0->priv_data; AVFrame *pict = VAR_3; AVFrame * const p= (AVFrame*)&s->picture; AVFrame temp; int VAR_4; if(VAR_0->pix_fmt != PIX_FMT_YUV410P){ av_log(VAR_0, AV_LOG_ERROR, "unsupported pixel format\n"); return -1; } if(!s->current_picture.VAR_3[0]){ VAR_0->get_buffer(VAR_0, &s->current_picture); VAR_0->get_buffer(VAR_0, &s->last_picture); s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16); } temp= s->current_picture; s->current_picture= s->last_picture; s->last_picture= temp; init_put_bits(&s->pb, VAR_1, VAR_2); *p = *pict; p->pict_type = VAR_0->gop_size && VAR_0->frame_number % VAR_0->gop_size ? FF_P_TYPE : FF_I_TYPE; p->key_frame = p->pict_type == FF_I_TYPE; svq1_write_header(s, p->pict_type); for(VAR_4=0; VAR_4<3; VAR_4++){ if(svq1_encode_plane(s, VAR_4, s->picture.VAR_3[VAR_4], s->last_picture.VAR_3[VAR_4], s->current_picture.VAR_3[VAR_4], s->frame_width / (VAR_4?4:1), s->frame_height / (VAR_4?4:1), s->picture.linesize[VAR_4], s->current_picture.linesize[VAR_4]) < 0) return -1; } while(put_bits_count(&s->pb) & 31) put_bits(&s->pb, 1, 0); flush_put_bits(&s->pb); return put_bits_count(&s->pb) / 8; }
[ "static int FUNC_0(AVCodecContext *VAR_0, unsigned char *VAR_1,\nint VAR_2, void *VAR_3)\n{", "SVQ1Context * const s = VAR_0->priv_data;", "AVFrame *pict = VAR_3;", "AVFrame * const p= (AVFrame*)&s->picture;", "AVFrame temp;", "int VAR_4;", "if(VAR_0->pix_fmt != PIX_FMT_YUV410P){", "av_log(VAR_0, AV_LOG_ERROR, \"unsupported pixel format\\n\");", "return -1;", "}", "if(!s->current_picture.VAR_3[0]){", "VAR_0->get_buffer(VAR_0, &s->current_picture);", "VAR_0->get_buffer(VAR_0, &s->last_picture);", "s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16);", "}", "temp= s->current_picture;", "s->current_picture= s->last_picture;", "s->last_picture= temp;", "init_put_bits(&s->pb, VAR_1, VAR_2);", "*p = *pict;", "p->pict_type = VAR_0->gop_size && VAR_0->frame_number % VAR_0->gop_size ? FF_P_TYPE : FF_I_TYPE;", "p->key_frame = p->pict_type == FF_I_TYPE;", "svq1_write_header(s, p->pict_type);", "for(VAR_4=0; VAR_4<3; VAR_4++){", "if(svq1_encode_plane(s, VAR_4,\ns->picture.VAR_3[VAR_4], s->last_picture.VAR_3[VAR_4], s->current_picture.VAR_3[VAR_4],\ns->frame_width / (VAR_4?4:1), s->frame_height / (VAR_4?4:1),\ns->picture.linesize[VAR_4], s->current_picture.linesize[VAR_4]) < 0)\nreturn -1;", "}", "while(put_bits_count(&s->pb) & 31)\nput_bits(&s->pb, 1, 0);", "flush_put_bits(&s->pb);", "return put_bits_count(&s->pb) / 8;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65, 67, 69, 71, 73 ], [ 75 ], [ 81, 83 ], [ 87 ], [ 91 ], [ 93 ] ]
5,926
static void xics_common_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->reset = xics_common_reset; }
true
qemu
b1fc72f0fb0aeae4194ff89c454aabe019983d0d
static void xics_common_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->reset = xics_common_reset; }
{ "code": [], "line_no": [] }
static void FUNC_0(ObjectClass *VAR_0, void *VAR_1) { DeviceClass *dc = DEVICE_CLASS(VAR_0); dc->reset = xics_common_reset; }
[ "static void FUNC_0(ObjectClass *VAR_0, void *VAR_1)\n{", "DeviceClass *dc = DEVICE_CLASS(VAR_0);", "dc->reset = xics_common_reset;", "}" ]
[ 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 10 ], [ 13 ] ]
5,927
static BlockJob *test_block_job_start(unsigned int iterations, bool use_timer, int rc, int *result) { BlockDriverState *bs; TestBlockJob *s; TestBlockJobCBData *data; data = g_new0(TestBlockJobCBData, 1); bs = bdrv_new(); s = block_job_create(&test_block_job_driver, bs, 0, test_block_job_cb, data, &error_abort); s->iterations = iterations; s->use_timer = use_timer; s->rc = rc; s->result = result; s->common.co = qemu_coroutine_create(test_block_job_run); data->job = s; data->result = result; qemu_coroutine_enter(s->common.co, s); return &s->common; }
true
qemu
7f0317cfc8da620cdb38cb5cfec5f82b8dd05403
static BlockJob *test_block_job_start(unsigned int iterations, bool use_timer, int rc, int *result) { BlockDriverState *bs; TestBlockJob *s; TestBlockJobCBData *data; data = g_new0(TestBlockJobCBData, 1); bs = bdrv_new(); s = block_job_create(&test_block_job_driver, bs, 0, test_block_job_cb, data, &error_abort); s->iterations = iterations; s->use_timer = use_timer; s->rc = rc; s->result = result; s->common.co = qemu_coroutine_create(test_block_job_run); data->job = s; data->result = result; qemu_coroutine_enter(s->common.co, s); return &s->common; }
{ "code": [ " s = block_job_create(&test_block_job_driver, bs, 0, test_block_job_cb,", " data, &error_abort);" ], "line_no": [ 21, 23 ] }
static BlockJob *FUNC_0(unsigned int iterations, bool use_timer, int rc, int *result) { BlockDriverState *bs; TestBlockJob *s; TestBlockJobCBData *data; data = g_new0(TestBlockJobCBData, 1); bs = bdrv_new(); s = block_job_create(&test_block_job_driver, bs, 0, test_block_job_cb, data, &error_abort); s->iterations = iterations; s->use_timer = use_timer; s->rc = rc; s->result = result; s->common.co = qemu_coroutine_create(test_block_job_run); data->job = s; data->result = result; qemu_coroutine_enter(s->common.co, s); return &s->common; }
[ "static BlockJob *FUNC_0(unsigned int iterations,\nbool use_timer,\nint rc, int *result)\n{", "BlockDriverState *bs;", "TestBlockJob *s;", "TestBlockJobCBData *data;", "data = g_new0(TestBlockJobCBData, 1);", "bs = bdrv_new();", "s = block_job_create(&test_block_job_driver, bs, 0, test_block_job_cb,\ndata, &error_abort);", "s->iterations = iterations;", "s->use_timer = use_timer;", "s->rc = rc;", "s->result = result;", "s->common.co = qemu_coroutine_create(test_block_job_run);", "data->job = s;", "data->result = result;", "qemu_coroutine_enter(s->common.co, s);", "return &s->common;", "}" ]
[ 0, 0, 0, 0, 0, 0, 1, 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 ] ]
5,929
static int cook_decode_init(AVCodecContext *avctx) { COOKextradata *e = avctx->extradata; COOKContext *q = avctx->priv_data; /* Take care of the codec specific extradata. */ if (avctx->extradata_size <= 0) { av_log(NULL,AV_LOG_ERROR,"Necessary extradata missing!\n"); } else { /* 8 for mono, 16 for stereo, ? for multichannel Swap to right endianness so we don't need to care later on. */ av_log(NULL,AV_LOG_DEBUG,"codecdata_length=%d\n",avctx->extradata_size); if (avctx->extradata_size >= 8){ e->cookversion = be2me_32(e->cookversion); e->samples_per_frame = be2me_16(e->samples_per_frame); e->subbands = be2me_16(e->subbands); } if (avctx->extradata_size >= 16){ e->js_subband_start = be2me_16(e->js_subband_start); e->js_vlc_bits = be2me_16(e->js_vlc_bits); } } /* Take data from the AVCodecContext (RM container). */ q->sample_rate = avctx->sample_rate; q->nb_channels = avctx->channels; q->bit_rate = avctx->bit_rate; /* Initialize state. */ q->random_state = 1; /* Initialize extradata related variables. */ q->samples_per_channel = e->samples_per_frame / q->nb_channels; q->samples_per_frame = e->samples_per_frame; q->subbands = e->subbands; q->bits_per_subpacket = avctx->block_align * 8; /* Initialize default data states. */ q->js_subband_start = 0; q->log2_numvector_size = 5; q->total_subbands = q->subbands; /* Initialize version-dependent variables */ av_log(NULL,AV_LOG_DEBUG,"e->cookversion=%x\n",e->cookversion); switch (e->cookversion) { case MONO_COOK1: if (q->nb_channels != 1) { av_log(NULL,AV_LOG_ERROR,"Container channels != 1, report sample!\n"); } av_log(NULL,AV_LOG_DEBUG,"MONO_COOK1\n"); break; case MONO_COOK2: if (q->nb_channels != 1) { q->joint_stereo = 0; q->bits_per_subpacket = q->bits_per_subpacket/2; } av_log(NULL,AV_LOG_DEBUG,"MONO_COOK2\n"); break; case JOINT_STEREO: if (q->nb_channels != 2) { av_log(NULL,AV_LOG_ERROR,"Container channels != 2, report sample!\n"); } av_log(NULL,AV_LOG_DEBUG,"JOINT_STEREO\n"); if (avctx->extradata_size >= 16){ q->total_subbands = q->subbands + e->js_subband_start; q->js_subband_start = e->js_subband_start; q->joint_stereo = 1; q->js_vlc_bits = e->js_vlc_bits; } if (q->samples_per_channel > 256) { q->log2_numvector_size = 6; } if (q->samples_per_channel > 512) { q->log2_numvector_size = 7; } break; case MC_COOK: av_log(NULL,AV_LOG_ERROR,"MC_COOK not supported!\n"); break; default: av_log(NULL,AV_LOG_ERROR,"Unknown Cook version, report sample!\n"); break; } /* Initialize variable relations */ q->mlt_size = q->samples_per_channel; q->numvector_size = (1 << q->log2_numvector_size); /* Generate tables */ init_rootpow2table(q); init_pow2table(q); init_gain_table(q); if (init_cook_vlc_tables(q) != 0) /* Pad the databuffer with FF_INPUT_BUFFER_PADDING_SIZE, this is for the bitstreamreader. */ if ((q->decoded_bytes_buffer = av_mallocz((avctx->block_align+(4-avctx->block_align%4) + FF_INPUT_BUFFER_PADDING_SIZE)*sizeof(uint8_t))) == NULL) q->decode_buf_ptr[0] = q->decode_buffer_1; q->decode_buf_ptr[1] = q->decode_buffer_2; q->decode_buf_ptr[2] = q->decode_buffer_3; q->decode_buf_ptr[3] = q->decode_buffer_4; q->decode_buf_ptr2[0] = q->decode_buffer_3; q->decode_buf_ptr2[1] = q->decode_buffer_4; q->previous_buffer_ptr[0] = q->mono_previous_buffer1; q->previous_buffer_ptr[1] = q->mono_previous_buffer2; /* Initialize transform. */ if ( init_cook_mlt(q) == 0 ) /* Try to catch some obviously faulty streams, othervise it might be exploitable */ if (q->total_subbands > 53) { av_log(NULL,AV_LOG_ERROR,"total_subbands > 53, report sample!\n"); } if (q->subbands > 50) { av_log(NULL,AV_LOG_ERROR,"subbands > 50, report sample!\n"); } if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512) || (q->samples_per_channel == 1024)) { } else { av_log(NULL,AV_LOG_ERROR,"unknown amount of samples_per_channel = %d, report sample!\n",q->samples_per_channel); } #ifdef COOKDEBUG dump_cook_context(q,e); #endif return 0; }
true
FFmpeg
3a1a7e32ace7af47de74e8ae779cb4e04c89aa97
static int cook_decode_init(AVCodecContext *avctx) { COOKextradata *e = avctx->extradata; COOKContext *q = avctx->priv_data; if (avctx->extradata_size <= 0) { av_log(NULL,AV_LOG_ERROR,"Necessary extradata missing!\n"); } else { av_log(NULL,AV_LOG_DEBUG,"codecdata_length=%d\n",avctx->extradata_size); if (avctx->extradata_size >= 8){ e->cookversion = be2me_32(e->cookversion); e->samples_per_frame = be2me_16(e->samples_per_frame); e->subbands = be2me_16(e->subbands); } if (avctx->extradata_size >= 16){ e->js_subband_start = be2me_16(e->js_subband_start); e->js_vlc_bits = be2me_16(e->js_vlc_bits); } } q->sample_rate = avctx->sample_rate; q->nb_channels = avctx->channels; q->bit_rate = avctx->bit_rate; q->random_state = 1; q->samples_per_channel = e->samples_per_frame / q->nb_channels; q->samples_per_frame = e->samples_per_frame; q->subbands = e->subbands; q->bits_per_subpacket = avctx->block_align * 8; q->js_subband_start = 0; q->log2_numvector_size = 5; q->total_subbands = q->subbands; av_log(NULL,AV_LOG_DEBUG,"e->cookversion=%x\n",e->cookversion); switch (e->cookversion) { case MONO_COOK1: if (q->nb_channels != 1) { av_log(NULL,AV_LOG_ERROR,"Container channels != 1, report sample!\n"); } av_log(NULL,AV_LOG_DEBUG,"MONO_COOK1\n"); break; case MONO_COOK2: if (q->nb_channels != 1) { q->joint_stereo = 0; q->bits_per_subpacket = q->bits_per_subpacket/2; } av_log(NULL,AV_LOG_DEBUG,"MONO_COOK2\n"); break; case JOINT_STEREO: if (q->nb_channels != 2) { av_log(NULL,AV_LOG_ERROR,"Container channels != 2, report sample!\n"); } av_log(NULL,AV_LOG_DEBUG,"JOINT_STEREO\n"); if (avctx->extradata_size >= 16){ q->total_subbands = q->subbands + e->js_subband_start; q->js_subband_start = e->js_subband_start; q->joint_stereo = 1; q->js_vlc_bits = e->js_vlc_bits; } if (q->samples_per_channel > 256) { q->log2_numvector_size = 6; } if (q->samples_per_channel > 512) { q->log2_numvector_size = 7; } break; case MC_COOK: av_log(NULL,AV_LOG_ERROR,"MC_COOK not supported!\n"); break; default: av_log(NULL,AV_LOG_ERROR,"Unknown Cook version, report sample!\n"); break; } q->mlt_size = q->samples_per_channel; q->numvector_size = (1 << q->log2_numvector_size); init_rootpow2table(q); init_pow2table(q); init_gain_table(q); if (init_cook_vlc_tables(q) != 0) if ((q->decoded_bytes_buffer = av_mallocz((avctx->block_align+(4-avctx->block_align%4) + FF_INPUT_BUFFER_PADDING_SIZE)*sizeof(uint8_t))) == NULL) q->decode_buf_ptr[0] = q->decode_buffer_1; q->decode_buf_ptr[1] = q->decode_buffer_2; q->decode_buf_ptr[2] = q->decode_buffer_3; q->decode_buf_ptr[3] = q->decode_buffer_4; q->decode_buf_ptr2[0] = q->decode_buffer_3; q->decode_buf_ptr2[1] = q->decode_buffer_4; q->previous_buffer_ptr[0] = q->mono_previous_buffer1; q->previous_buffer_ptr[1] = q->mono_previous_buffer2; if ( init_cook_mlt(q) == 0 ) if (q->total_subbands > 53) { av_log(NULL,AV_LOG_ERROR,"total_subbands > 53, report sample!\n"); } if (q->subbands > 50) { av_log(NULL,AV_LOG_ERROR,"subbands > 50, report sample!\n"); } if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512) || (q->samples_per_channel == 1024)) { } else { av_log(NULL,AV_LOG_ERROR,"unknown amount of samples_per_channel = %d, report sample!\n",q->samples_per_channel); } #ifdef COOKDEBUG dump_cook_context(q,e); #endif return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0) { COOKextradata *e = VAR_0->extradata; COOKContext *q = VAR_0->priv_data; if (VAR_0->extradata_size <= 0) { av_log(NULL,AV_LOG_ERROR,"Necessary extradata missing!\n"); } else { av_log(NULL,AV_LOG_DEBUG,"codecdata_length=%d\n",VAR_0->extradata_size); if (VAR_0->extradata_size >= 8){ e->cookversion = be2me_32(e->cookversion); e->samples_per_frame = be2me_16(e->samples_per_frame); e->subbands = be2me_16(e->subbands); } if (VAR_0->extradata_size >= 16){ e->js_subband_start = be2me_16(e->js_subband_start); e->js_vlc_bits = be2me_16(e->js_vlc_bits); } } q->sample_rate = VAR_0->sample_rate; q->nb_channels = VAR_0->channels; q->bit_rate = VAR_0->bit_rate; q->random_state = 1; q->samples_per_channel = e->samples_per_frame / q->nb_channels; q->samples_per_frame = e->samples_per_frame; q->subbands = e->subbands; q->bits_per_subpacket = VAR_0->block_align * 8; q->js_subband_start = 0; q->log2_numvector_size = 5; q->total_subbands = q->subbands; av_log(NULL,AV_LOG_DEBUG,"e->cookversion=%x\n",e->cookversion); switch (e->cookversion) { case MONO_COOK1: if (q->nb_channels != 1) { av_log(NULL,AV_LOG_ERROR,"Container channels != 1, report sample!\n"); } av_log(NULL,AV_LOG_DEBUG,"MONO_COOK1\n"); break; case MONO_COOK2: if (q->nb_channels != 1) { q->joint_stereo = 0; q->bits_per_subpacket = q->bits_per_subpacket/2; } av_log(NULL,AV_LOG_DEBUG,"MONO_COOK2\n"); break; case JOINT_STEREO: if (q->nb_channels != 2) { av_log(NULL,AV_LOG_ERROR,"Container channels != 2, report sample!\n"); } av_log(NULL,AV_LOG_DEBUG,"JOINT_STEREO\n"); if (VAR_0->extradata_size >= 16){ q->total_subbands = q->subbands + e->js_subband_start; q->js_subband_start = e->js_subband_start; q->joint_stereo = 1; q->js_vlc_bits = e->js_vlc_bits; } if (q->samples_per_channel > 256) { q->log2_numvector_size = 6; } if (q->samples_per_channel > 512) { q->log2_numvector_size = 7; } break; case MC_COOK: av_log(NULL,AV_LOG_ERROR,"MC_COOK not supported!\n"); break; default: av_log(NULL,AV_LOG_ERROR,"Unknown Cook version, report sample!\n"); break; } q->mlt_size = q->samples_per_channel; q->numvector_size = (1 << q->log2_numvector_size); init_rootpow2table(q); init_pow2table(q); init_gain_table(q); if (init_cook_vlc_tables(q) != 0) if ((q->decoded_bytes_buffer = av_mallocz((VAR_0->block_align+(4-VAR_0->block_align%4) + FF_INPUT_BUFFER_PADDING_SIZE)*sizeof(uint8_t))) == NULL) q->decode_buf_ptr[0] = q->decode_buffer_1; q->decode_buf_ptr[1] = q->decode_buffer_2; q->decode_buf_ptr[2] = q->decode_buffer_3; q->decode_buf_ptr[3] = q->decode_buffer_4; q->decode_buf_ptr2[0] = q->decode_buffer_3; q->decode_buf_ptr2[1] = q->decode_buffer_4; q->previous_buffer_ptr[0] = q->mono_previous_buffer1; q->previous_buffer_ptr[1] = q->mono_previous_buffer2; if ( init_cook_mlt(q) == 0 ) if (q->total_subbands > 53) { av_log(NULL,AV_LOG_ERROR,"total_subbands > 53, report sample!\n"); } if (q->subbands > 50) { av_log(NULL,AV_LOG_ERROR,"subbands > 50, report sample!\n"); } if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512) || (q->samples_per_channel == 1024)) { } else { av_log(NULL,AV_LOG_ERROR,"unknown amount of samples_per_channel = %d, report sample!\n",q->samples_per_channel); } #ifdef COOKDEBUG dump_cook_context(q,e); #endif return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0)\n{", "COOKextradata *e = VAR_0->extradata;", "COOKContext *q = VAR_0->priv_data;", "if (VAR_0->extradata_size <= 0) {", "av_log(NULL,AV_LOG_ERROR,\"Necessary extradata missing!\\n\");", "} else {", "av_log(NULL,AV_LOG_DEBUG,\"codecdata_length=%d\\n\",VAR_0->extradata_size);", "if (VAR_0->extradata_size >= 8){", "e->cookversion = be2me_32(e->cookversion);", "e->samples_per_frame = be2me_16(e->samples_per_frame);", "e->subbands = be2me_16(e->subbands);", "}", "if (VAR_0->extradata_size >= 16){", "e->js_subband_start = be2me_16(e->js_subband_start);", "e->js_vlc_bits = be2me_16(e->js_vlc_bits);", "}", "}", "q->sample_rate = VAR_0->sample_rate;", "q->nb_channels = VAR_0->channels;", "q->bit_rate = VAR_0->bit_rate;", "q->random_state = 1;", "q->samples_per_channel = e->samples_per_frame / q->nb_channels;", "q->samples_per_frame = e->samples_per_frame;", "q->subbands = e->subbands;", "q->bits_per_subpacket = VAR_0->block_align * 8;", "q->js_subband_start = 0;", "q->log2_numvector_size = 5;", "q->total_subbands = q->subbands;", "av_log(NULL,AV_LOG_DEBUG,\"e->cookversion=%x\\n\",e->cookversion);", "switch (e->cookversion) {", "case MONO_COOK1:\nif (q->nb_channels != 1) {", "av_log(NULL,AV_LOG_ERROR,\"Container channels != 1, report sample!\\n\");", "}", "av_log(NULL,AV_LOG_DEBUG,\"MONO_COOK1\\n\");", "break;", "case MONO_COOK2:\nif (q->nb_channels != 1) {", "q->joint_stereo = 0;", "q->bits_per_subpacket = q->bits_per_subpacket/2;", "}", "av_log(NULL,AV_LOG_DEBUG,\"MONO_COOK2\\n\");", "break;", "case JOINT_STEREO:\nif (q->nb_channels != 2) {", "av_log(NULL,AV_LOG_ERROR,\"Container channels != 2, report sample!\\n\");", "}", "av_log(NULL,AV_LOG_DEBUG,\"JOINT_STEREO\\n\");", "if (VAR_0->extradata_size >= 16){", "q->total_subbands = q->subbands + e->js_subband_start;", "q->js_subband_start = e->js_subband_start;", "q->joint_stereo = 1;", "q->js_vlc_bits = e->js_vlc_bits;", "}", "if (q->samples_per_channel > 256) {", "q->log2_numvector_size = 6;", "}", "if (q->samples_per_channel > 512) {", "q->log2_numvector_size = 7;", "}", "break;", "case MC_COOK:\nav_log(NULL,AV_LOG_ERROR,\"MC_COOK not supported!\\n\");", "break;", "default:\nav_log(NULL,AV_LOG_ERROR,\"Unknown Cook version, report sample!\\n\");", "break;", "}", "q->mlt_size = q->samples_per_channel;", "q->numvector_size = (1 << q->log2_numvector_size);", "init_rootpow2table(q);", "init_pow2table(q);", "init_gain_table(q);", "if (init_cook_vlc_tables(q) != 0)\nif ((q->decoded_bytes_buffer = av_mallocz((VAR_0->block_align+(4-VAR_0->block_align%4) + FF_INPUT_BUFFER_PADDING_SIZE)*sizeof(uint8_t))) == NULL)\nq->decode_buf_ptr[0] = q->decode_buffer_1;", "q->decode_buf_ptr[1] = q->decode_buffer_2;", "q->decode_buf_ptr[2] = q->decode_buffer_3;", "q->decode_buf_ptr[3] = q->decode_buffer_4;", "q->decode_buf_ptr2[0] = q->decode_buffer_3;", "q->decode_buf_ptr2[1] = q->decode_buffer_4;", "q->previous_buffer_ptr[0] = q->mono_previous_buffer1;", "q->previous_buffer_ptr[1] = q->mono_previous_buffer2;", "if ( init_cook_mlt(q) == 0 )\nif (q->total_subbands > 53) {", "av_log(NULL,AV_LOG_ERROR,\"total_subbands > 53, report sample!\\n\");", "}", "if (q->subbands > 50) {", "av_log(NULL,AV_LOG_ERROR,\"subbands > 50, report sample!\\n\");", "}", "if ((q->samples_per_channel == 256) || (q->samples_per_channel == 512) || (q->samples_per_channel == 1024)) {", "} else {", "av_log(NULL,AV_LOG_ERROR,\"unknown amount of samples_per_channel = %d, report sample!\\n\",q->samples_per_channel);", "}", "#ifdef COOKDEBUG\ndump_cook_context(q,e);", "#endif\nreturn 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ], [ 6 ], [ 7 ], [ 8 ], [ 11 ], [ 12 ], [ 13 ], [ 14 ], [ 15 ], [ 16 ], [ 17 ], [ 18 ], [ 19 ], [ 20 ], [ 21 ], [ 23 ], [ 24 ], [ 25 ], [ 27 ], [ 29 ], [ 30 ], [ 31 ], [ 32 ], [ 34 ], [ 35 ], [ 36 ], [ 38 ], [ 39 ], [ 40, 41 ], [ 42 ], [ 43 ], [ 44 ], [ 45 ], [ 46, 47 ], [ 48 ], [ 49 ], [ 50 ], [ 51 ], [ 52 ], [ 53, 54 ], [ 55 ], [ 56 ], [ 57 ], [ 58 ], [ 59 ], [ 60 ], [ 61 ], [ 62 ], [ 63 ], [ 64 ], [ 65 ], [ 66 ], [ 67 ], [ 68 ], [ 69 ], [ 70 ], [ 71, 72 ], [ 73 ], [ 74, 75 ], [ 76 ], [ 77 ], [ 79 ], [ 80 ], [ 82 ], [ 83 ], [ 84 ], [ 85, 88, 89 ], [ 90 ], [ 91 ], [ 92 ], [ 93 ], [ 94 ], [ 95 ], [ 96 ], [ 98, 100 ], [ 101 ], [ 102 ], [ 103 ], [ 104 ], [ 105 ], [ 106 ], [ 107 ], [ 108 ], [ 109 ], [ 110, 111 ], [ 112, 113 ], [ 114 ] ]
5,930
static int check_for_block_signature(BlockDriverState *bs, const uint8_t *buf) { static const uint8_t signatures[][4] = { { 'Q', 'F', 'I', 0xfb }, /* qcow/qcow2 */ { 'C', 'O', 'W', 'D' }, /* VMDK3 */ { 'V', 'M', 'D', 'K' }, /* VMDK4 */ { 'O', 'O', 'O', 'M' }, /* UML COW */ {} }; int i; for (i = 0; signatures[i][0] != 0; i++) { if (memcmp(buf, signatures[i], 4) == 0) { return 1; } } return 0; }
true
qemu
8b33d9eeba91422ee2d73b6936ad57262d18cf5a
static int check_for_block_signature(BlockDriverState *bs, const uint8_t *buf) { static const uint8_t signatures[][4] = { { 'Q', 'F', 'I', 0xfb }, { 'C', 'O', 'W', 'D' }, { 'V', 'M', 'D', 'K' }, { 'O', 'O', 'O', 'M' }, {} }; int i; for (i = 0; signatures[i][0] != 0; i++) { if (memcmp(buf, signatures[i], 4) == 0) { return 1; } } return 0; }
{ "code": [ "static int check_for_block_signature(BlockDriverState *bs, const uint8_t *buf)", " static const uint8_t signatures[][4] = {", " {}", " };", " int i;", " for (i = 0; signatures[i][0] != 0; i++) {", " if (memcmp(buf, signatures[i], 4) == 0) {", " return 1;", " return 0;", " return 0;" ], "line_no": [ 1, 5, 15, 17, 19, 23, 25, 27, 35, 35 ] }
static int FUNC_0(BlockDriverState *VAR_0, const uint8_t *VAR_1) { static const uint8_t VAR_2[][4] = { { 'Q', 'F', 'I', 0xfb }, { 'C', 'O', 'W', 'D' }, { 'V', 'M', 'D', 'K' }, { 'O', 'O', 'O', 'M' }, {} }; int VAR_3; for (VAR_3 = 0; VAR_2[VAR_3][0] != 0; VAR_3++) { if (memcmp(VAR_1, VAR_2[VAR_3], 4) == 0) { return 1; } } return 0; }
[ "static int FUNC_0(BlockDriverState *VAR_0, const uint8_t *VAR_1)\n{", "static const uint8_t VAR_2[][4] = {", "{ 'Q', 'F', 'I', 0xfb },", "{ 'C', 'O', 'W', 'D' },", "{ 'V', 'M', 'D', 'K' },", "{ 'O', 'O', 'O', 'M' },", "{}", "};", "int VAR_3;", "for (VAR_3 = 0; VAR_2[VAR_3][0] != 0; VAR_3++) {", "if (memcmp(VAR_1, VAR_2[VAR_3], 4) == 0) {", "return 1;", "}", "}", "return 0;", "}" ]
[ 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ] ]
5,932
static int parallels_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVParallelsState *s = bs->opaque; ParallelsHeader ph; int ret, size, i; QemuOpts *opts = NULL; Error *local_err = NULL; char *buf; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false, errp); if (!bs->file) { return -EINVAL; } ret = bdrv_pread(bs->file, 0, &ph, sizeof(ph)); if (ret < 0) { goto fail; } bs->total_sectors = le64_to_cpu(ph.nb_sectors); if (le32_to_cpu(ph.version) != HEADER_VERSION) { goto fail_format; } if (!memcmp(ph.magic, HEADER_MAGIC, 16)) { s->off_multiplier = 1; bs->total_sectors = 0xffffffff & bs->total_sectors; } else if (!memcmp(ph.magic, HEADER_MAGIC2, 16)) { s->off_multiplier = le32_to_cpu(ph.tracks); } else { goto fail_format; } s->tracks = le32_to_cpu(ph.tracks); if (s->tracks == 0) { error_setg(errp, "Invalid image: Zero sectors per track"); ret = -EINVAL; goto fail; } if (s->tracks > INT32_MAX/513) { error_setg(errp, "Invalid image: Too big cluster"); ret = -EFBIG; goto fail; } s->bat_size = le32_to_cpu(ph.bat_entries); if (s->bat_size > INT_MAX / sizeof(uint32_t)) { error_setg(errp, "Catalog too large"); ret = -EFBIG; goto fail; } size = bat_entry_off(s->bat_size); s->header_size = ROUND_UP(size, bdrv_opt_mem_align(bs->file->bs)); s->header = qemu_try_blockalign(bs->file->bs, s->header_size); if (s->header == NULL) { ret = -ENOMEM; goto fail; } s->data_end = le32_to_cpu(ph.data_off); if (s->data_end == 0) { s->data_end = ROUND_UP(bat_entry_off(s->bat_size), BDRV_SECTOR_SIZE); } if (s->data_end < s->header_size) { /* there is not enough unused space to fit to block align between BAT and actual data. We can't avoid read-modify-write... */ s->header_size = size; } ret = bdrv_pread(bs->file, 0, s->header, s->header_size); if (ret < 0) { goto fail; } s->bat_bitmap = (uint32_t *)(s->header + 1); for (i = 0; i < s->bat_size; i++) { int64_t off = bat2sect(s, i); if (off >= s->data_end) { s->data_end = off + s->tracks; } } if (le32_to_cpu(ph.inuse) == HEADER_INUSE_MAGIC) { /* Image was not closed correctly. The check is mandatory */ s->header_unclean = true; if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_CHECK)) { error_setg(errp, "parallels: Image was not closed correctly; " "cannot be opened read/write"); ret = -EACCES; goto fail; } } opts = qemu_opts_create(&parallels_runtime_opts, NULL, 0, &local_err); if (local_err != NULL) { goto fail_options; } qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err != NULL) { goto fail_options; } s->prealloc_size = qemu_opt_get_size_del(opts, PARALLELS_OPT_PREALLOC_SIZE, 0); s->prealloc_size = MAX(s->tracks, s->prealloc_size >> BDRV_SECTOR_BITS); buf = qemu_opt_get_del(opts, PARALLELS_OPT_PREALLOC_MODE); s->prealloc_mode = qapi_enum_parse(prealloc_mode_lookup, buf, PRL_PREALLOC_MODE__MAX, PRL_PREALLOC_MODE_FALLOCATE, &local_err); g_free(buf); if (local_err != NULL) { goto fail_options; } if (!(flags & BDRV_O_RESIZE) || !bdrv_has_zero_init(bs->file->bs) || bdrv_truncate(bs->file, bdrv_getlength(bs->file->bs), PREALLOC_MODE_OFF, NULL) != 0) { s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE; } if (flags & BDRV_O_RDWR) { s->header->inuse = cpu_to_le32(HEADER_INUSE_MAGIC); ret = parallels_update_header(bs); if (ret < 0) { goto fail; } } s->bat_dirty_block = 4 * getpagesize(); s->bat_dirty_bmap = bitmap_new(DIV_ROUND_UP(s->header_size, s->bat_dirty_block)); qemu_co_mutex_init(&s->lock); return 0; fail_format: error_setg(errp, "Image not in Parallels format"); ret = -EINVAL; fail: qemu_vfree(s->header); return ret; fail_options: error_propagate(errp, local_err); ret = -EINVAL; goto fail; }
true
qemu
e5e6268348972aaf415d7931bbd808b3fdba6cb1
static int parallels_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVParallelsState *s = bs->opaque; ParallelsHeader ph; int ret, size, i; QemuOpts *opts = NULL; Error *local_err = NULL; char *buf; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false, errp); if (!bs->file) { return -EINVAL; } ret = bdrv_pread(bs->file, 0, &ph, sizeof(ph)); if (ret < 0) { goto fail; } bs->total_sectors = le64_to_cpu(ph.nb_sectors); if (le32_to_cpu(ph.version) != HEADER_VERSION) { goto fail_format; } if (!memcmp(ph.magic, HEADER_MAGIC, 16)) { s->off_multiplier = 1; bs->total_sectors = 0xffffffff & bs->total_sectors; } else if (!memcmp(ph.magic, HEADER_MAGIC2, 16)) { s->off_multiplier = le32_to_cpu(ph.tracks); } else { goto fail_format; } s->tracks = le32_to_cpu(ph.tracks); if (s->tracks == 0) { error_setg(errp, "Invalid image: Zero sectors per track"); ret = -EINVAL; goto fail; } if (s->tracks > INT32_MAX/513) { error_setg(errp, "Invalid image: Too big cluster"); ret = -EFBIG; goto fail; } s->bat_size = le32_to_cpu(ph.bat_entries); if (s->bat_size > INT_MAX / sizeof(uint32_t)) { error_setg(errp, "Catalog too large"); ret = -EFBIG; goto fail; } size = bat_entry_off(s->bat_size); s->header_size = ROUND_UP(size, bdrv_opt_mem_align(bs->file->bs)); s->header = qemu_try_blockalign(bs->file->bs, s->header_size); if (s->header == NULL) { ret = -ENOMEM; goto fail; } s->data_end = le32_to_cpu(ph.data_off); if (s->data_end == 0) { s->data_end = ROUND_UP(bat_entry_off(s->bat_size), BDRV_SECTOR_SIZE); } if (s->data_end < s->header_size) { s->header_size = size; } ret = bdrv_pread(bs->file, 0, s->header, s->header_size); if (ret < 0) { goto fail; } s->bat_bitmap = (uint32_t *)(s->header + 1); for (i = 0; i < s->bat_size; i++) { int64_t off = bat2sect(s, i); if (off >= s->data_end) { s->data_end = off + s->tracks; } } if (le32_to_cpu(ph.inuse) == HEADER_INUSE_MAGIC) { s->header_unclean = true; if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_CHECK)) { error_setg(errp, "parallels: Image was not closed correctly; " "cannot be opened read/write"); ret = -EACCES; goto fail; } } opts = qemu_opts_create(&parallels_runtime_opts, NULL, 0, &local_err); if (local_err != NULL) { goto fail_options; } qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err != NULL) { goto fail_options; } s->prealloc_size = qemu_opt_get_size_del(opts, PARALLELS_OPT_PREALLOC_SIZE, 0); s->prealloc_size = MAX(s->tracks, s->prealloc_size >> BDRV_SECTOR_BITS); buf = qemu_opt_get_del(opts, PARALLELS_OPT_PREALLOC_MODE); s->prealloc_mode = qapi_enum_parse(prealloc_mode_lookup, buf, PRL_PREALLOC_MODE__MAX, PRL_PREALLOC_MODE_FALLOCATE, &local_err); g_free(buf); if (local_err != NULL) { goto fail_options; } if (!(flags & BDRV_O_RESIZE) || !bdrv_has_zero_init(bs->file->bs) || bdrv_truncate(bs->file, bdrv_getlength(bs->file->bs), PREALLOC_MODE_OFF, NULL) != 0) { s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE; } if (flags & BDRV_O_RDWR) { s->header->inuse = cpu_to_le32(HEADER_INUSE_MAGIC); ret = parallels_update_header(bs); if (ret < 0) { goto fail; } } s->bat_dirty_block = 4 * getpagesize(); s->bat_dirty_bmap = bitmap_new(DIV_ROUND_UP(s->header_size, s->bat_dirty_block)); qemu_co_mutex_init(&s->lock); return 0; fail_format: error_setg(errp, "Image not in Parallels format"); ret = -EINVAL; fail: qemu_vfree(s->header); return ret; fail_options: error_propagate(errp, local_err); ret = -EINVAL; goto fail; }
{ "code": [ " if (!(flags & BDRV_O_RESIZE) || !bdrv_has_zero_init(bs->file->bs) ||", " bdrv_truncate(bs->file, bdrv_getlength(bs->file->bs),", " PREALLOC_MODE_OFF, NULL) != 0) {" ], "line_no": [ 233, 235, 237 ] }
static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2, Error **VAR_3) { BDRVParallelsState *s = VAR_0->opaque; ParallelsHeader ph; int VAR_4, VAR_5, VAR_6; QemuOpts *opts = NULL; Error *local_err = NULL; char *VAR_7; VAR_0->file = bdrv_open_child(NULL, VAR_1, "file", VAR_0, &child_file, false, VAR_3); if (!VAR_0->file) { return -EINVAL; } VAR_4 = bdrv_pread(VAR_0->file, 0, &ph, sizeof(ph)); if (VAR_4 < 0) { goto fail; } VAR_0->total_sectors = le64_to_cpu(ph.nb_sectors); if (le32_to_cpu(ph.version) != HEADER_VERSION) { goto fail_format; } if (!memcmp(ph.magic, HEADER_MAGIC, 16)) { s->off_multiplier = 1; VAR_0->total_sectors = 0xffffffff & VAR_0->total_sectors; } else if (!memcmp(ph.magic, HEADER_MAGIC2, 16)) { s->off_multiplier = le32_to_cpu(ph.tracks); } else { goto fail_format; } s->tracks = le32_to_cpu(ph.tracks); if (s->tracks == 0) { error_setg(VAR_3, "Invalid image: Zero sectors per track"); VAR_4 = -EINVAL; goto fail; } if (s->tracks > INT32_MAX/513) { error_setg(VAR_3, "Invalid image: Too big cluster"); VAR_4 = -EFBIG; goto fail; } s->bat_size = le32_to_cpu(ph.bat_entries); if (s->bat_size > INT_MAX / sizeof(uint32_t)) { error_setg(VAR_3, "Catalog too large"); VAR_4 = -EFBIG; goto fail; } VAR_5 = bat_entry_off(s->bat_size); s->header_size = ROUND_UP(VAR_5, bdrv_opt_mem_align(VAR_0->file->VAR_0)); s->header = qemu_try_blockalign(VAR_0->file->VAR_0, s->header_size); if (s->header == NULL) { VAR_4 = -ENOMEM; goto fail; } s->data_end = le32_to_cpu(ph.data_off); if (s->data_end == 0) { s->data_end = ROUND_UP(bat_entry_off(s->bat_size), BDRV_SECTOR_SIZE); } if (s->data_end < s->header_size) { s->header_size = VAR_5; } VAR_4 = bdrv_pread(VAR_0->file, 0, s->header, s->header_size); if (VAR_4 < 0) { goto fail; } s->bat_bitmap = (uint32_t *)(s->header + 1); for (VAR_6 = 0; VAR_6 < s->bat_size; VAR_6++) { int64_t off = bat2sect(s, VAR_6); if (off >= s->data_end) { s->data_end = off + s->tracks; } } if (le32_to_cpu(ph.inuse) == HEADER_INUSE_MAGIC) { s->header_unclean = true; if ((VAR_2 & BDRV_O_RDWR) && !(VAR_2 & BDRV_O_CHECK)) { error_setg(VAR_3, "parallels: Image was not closed correctly; " "cannot be opened read/write"); VAR_4 = -EACCES; goto fail; } } opts = qemu_opts_create(&parallels_runtime_opts, NULL, 0, &local_err); if (local_err != NULL) { goto fail_options; } qemu_opts_absorb_qdict(opts, VAR_1, &local_err); if (local_err != NULL) { goto fail_options; } s->prealloc_size = qemu_opt_get_size_del(opts, PARALLELS_OPT_PREALLOC_SIZE, 0); s->prealloc_size = MAX(s->tracks, s->prealloc_size >> BDRV_SECTOR_BITS); VAR_7 = qemu_opt_get_del(opts, PARALLELS_OPT_PREALLOC_MODE); s->prealloc_mode = qapi_enum_parse(prealloc_mode_lookup, VAR_7, PRL_PREALLOC_MODE__MAX, PRL_PREALLOC_MODE_FALLOCATE, &local_err); g_free(VAR_7); if (local_err != NULL) { goto fail_options; } if (!(VAR_2 & BDRV_O_RESIZE) || !bdrv_has_zero_init(VAR_0->file->VAR_0) || bdrv_truncate(VAR_0->file, bdrv_getlength(VAR_0->file->VAR_0), PREALLOC_MODE_OFF, NULL) != 0) { s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE; } if (VAR_2 & BDRV_O_RDWR) { s->header->inuse = cpu_to_le32(HEADER_INUSE_MAGIC); VAR_4 = parallels_update_header(VAR_0); if (VAR_4 < 0) { goto fail; } } s->bat_dirty_block = 4 * getpagesize(); s->bat_dirty_bmap = bitmap_new(DIV_ROUND_UP(s->header_size, s->bat_dirty_block)); qemu_co_mutex_init(&s->lock); return 0; fail_format: error_setg(VAR_3, "Image not in Parallels format"); VAR_4 = -EINVAL; fail: qemu_vfree(s->header); return VAR_4; fail_options: error_propagate(VAR_3, local_err); VAR_4 = -EINVAL; goto fail; }
[ "static int FUNC_0(BlockDriverState *VAR_0, QDict *VAR_1, int VAR_2,\nError **VAR_3)\n{", "BDRVParallelsState *s = VAR_0->opaque;", "ParallelsHeader ph;", "int VAR_4, VAR_5, VAR_6;", "QemuOpts *opts = NULL;", "Error *local_err = NULL;", "char *VAR_7;", "VAR_0->file = bdrv_open_child(NULL, VAR_1, \"file\", VAR_0, &child_file,\nfalse, VAR_3);", "if (!VAR_0->file) {", "return -EINVAL;", "}", "VAR_4 = bdrv_pread(VAR_0->file, 0, &ph, sizeof(ph));", "if (VAR_4 < 0) {", "goto fail;", "}", "VAR_0->total_sectors = le64_to_cpu(ph.nb_sectors);", "if (le32_to_cpu(ph.version) != HEADER_VERSION) {", "goto fail_format;", "}", "if (!memcmp(ph.magic, HEADER_MAGIC, 16)) {", "s->off_multiplier = 1;", "VAR_0->total_sectors = 0xffffffff & VAR_0->total_sectors;", "} else if (!memcmp(ph.magic, HEADER_MAGIC2, 16)) {", "s->off_multiplier = le32_to_cpu(ph.tracks);", "} else {", "goto fail_format;", "}", "s->tracks = le32_to_cpu(ph.tracks);", "if (s->tracks == 0) {", "error_setg(VAR_3, \"Invalid image: Zero sectors per track\");", "VAR_4 = -EINVAL;", "goto fail;", "}", "if (s->tracks > INT32_MAX/513) {", "error_setg(VAR_3, \"Invalid image: Too big cluster\");", "VAR_4 = -EFBIG;", "goto fail;", "}", "s->bat_size = le32_to_cpu(ph.bat_entries);", "if (s->bat_size > INT_MAX / sizeof(uint32_t)) {", "error_setg(VAR_3, \"Catalog too large\");", "VAR_4 = -EFBIG;", "goto fail;", "}", "VAR_5 = bat_entry_off(s->bat_size);", "s->header_size = ROUND_UP(VAR_5, bdrv_opt_mem_align(VAR_0->file->VAR_0));", "s->header = qemu_try_blockalign(VAR_0->file->VAR_0, s->header_size);", "if (s->header == NULL) {", "VAR_4 = -ENOMEM;", "goto fail;", "}", "s->data_end = le32_to_cpu(ph.data_off);", "if (s->data_end == 0) {", "s->data_end = ROUND_UP(bat_entry_off(s->bat_size), BDRV_SECTOR_SIZE);", "}", "if (s->data_end < s->header_size) {", "s->header_size = VAR_5;", "}", "VAR_4 = bdrv_pread(VAR_0->file, 0, s->header, s->header_size);", "if (VAR_4 < 0) {", "goto fail;", "}", "s->bat_bitmap = (uint32_t *)(s->header + 1);", "for (VAR_6 = 0; VAR_6 < s->bat_size; VAR_6++) {", "int64_t off = bat2sect(s, VAR_6);", "if (off >= s->data_end) {", "s->data_end = off + s->tracks;", "}", "}", "if (le32_to_cpu(ph.inuse) == HEADER_INUSE_MAGIC) {", "s->header_unclean = true;", "if ((VAR_2 & BDRV_O_RDWR) && !(VAR_2 & BDRV_O_CHECK)) {", "error_setg(VAR_3, \"parallels: Image was not closed correctly; \"", "\"cannot be opened read/write\");", "VAR_4 = -EACCES;", "goto fail;", "}", "}", "opts = qemu_opts_create(&parallels_runtime_opts, NULL, 0, &local_err);", "if (local_err != NULL) {", "goto fail_options;", "}", "qemu_opts_absorb_qdict(opts, VAR_1, &local_err);", "if (local_err != NULL) {", "goto fail_options;", "}", "s->prealloc_size =\nqemu_opt_get_size_del(opts, PARALLELS_OPT_PREALLOC_SIZE, 0);", "s->prealloc_size = MAX(s->tracks, s->prealloc_size >> BDRV_SECTOR_BITS);", "VAR_7 = qemu_opt_get_del(opts, PARALLELS_OPT_PREALLOC_MODE);", "s->prealloc_mode = qapi_enum_parse(prealloc_mode_lookup, VAR_7,\nPRL_PREALLOC_MODE__MAX, PRL_PREALLOC_MODE_FALLOCATE, &local_err);", "g_free(VAR_7);", "if (local_err != NULL) {", "goto fail_options;", "}", "if (!(VAR_2 & BDRV_O_RESIZE) || !bdrv_has_zero_init(VAR_0->file->VAR_0) ||\nbdrv_truncate(VAR_0->file, bdrv_getlength(VAR_0->file->VAR_0),\nPREALLOC_MODE_OFF, NULL) != 0) {", "s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE;", "}", "if (VAR_2 & BDRV_O_RDWR) {", "s->header->inuse = cpu_to_le32(HEADER_INUSE_MAGIC);", "VAR_4 = parallels_update_header(VAR_0);", "if (VAR_4 < 0) {", "goto fail;", "}", "}", "s->bat_dirty_block = 4 * getpagesize();", "s->bat_dirty_bmap =\nbitmap_new(DIV_ROUND_UP(s->header_size, s->bat_dirty_block));", "qemu_co_mutex_init(&s->lock);", "return 0;", "fail_format:\nerror_setg(VAR_3, \"Image not in Parallels format\");", "VAR_4 = -EINVAL;", "fail:\nqemu_vfree(s->header);", "return VAR_4;", "fail_options:\nerror_propagate(VAR_3, local_err);", "VAR_4 = -EINVAL;", "goto fail;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 21, 23 ], [ 25 ], [ 27 ], [ 29 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85 ], [ 87 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 101 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 137 ], [ 139 ], [ 143 ], [ 145 ], [ 147 ], [ 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 169 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 211, 213 ], [ 215 ], [ 217 ], [ 219, 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 233, 235, 237 ], [ 239 ], [ 241 ], [ 245 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ], [ 255 ], [ 257 ], [ 261 ], [ 263, 265 ], [ 269 ], [ 271 ], [ 275, 277 ], [ 279 ], [ 281, 283 ], [ 285 ], [ 289, 291 ], [ 293 ], [ 295 ], [ 297 ] ]
5,933
static void __attribute__((constructor)) st_init(void) { atexit(st_flush_trace_buffer); }
true
qemu
0b5538c300a56c3cfb33022840fe0b4968147e7a
static void __attribute__((constructor)) st_init(void) { atexit(st_flush_trace_buffer); }
{ "code": [ "static void __attribute__((constructor)) st_init(void)", " atexit(st_flush_trace_buffer);" ], "line_no": [ 1, 5 ] }
static void __attribute__((constructor)) FUNC_0(void) { atexit(st_flush_trace_buffer); }
[ "static void __attribute__((constructor)) FUNC_0(void)\n{", "atexit(st_flush_trace_buffer);", "}" ]
[ 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ] ]
5,935
static void test_qemu_strtoull_full_max(void) { const char *str = g_strdup_printf("%lld", ULLONG_MAX); uint64_t res = 999; int err; err = qemu_strtoull(str, NULL, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, ULLONG_MAX); }
true
qemu
d6f723b513a0c3c4e58343b7c52a2f9850861fa0
static void test_qemu_strtoull_full_max(void) { const char *str = g_strdup_printf("%lld", ULLONG_MAX); uint64_t res = 999; int err; err = qemu_strtoull(str, NULL, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, ULLONG_MAX); }
{ "code": [ " const char *str = g_strdup_printf(\"%lld\", ULLONG_MAX);" ], "line_no": [ 5 ] }
static void FUNC_0(void) { const char *VAR_0 = g_strdup_printf("%lld", ULLONG_MAX); uint64_t res = 999; int VAR_1; VAR_1 = qemu_strtoull(VAR_0, NULL, 0, &res); g_assert_cmpint(VAR_1, ==, 0); g_assert_cmpint(res, ==, ULLONG_MAX); }
[ "static void FUNC_0(void)\n{", "const char *VAR_0 = g_strdup_printf(\"%lld\", ULLONG_MAX);", "uint64_t res = 999;", "int VAR_1;", "VAR_1 = qemu_strtoull(VAR_0, NULL, 0, &res);", "g_assert_cmpint(VAR_1, ==, 0);", "g_assert_cmpint(res, ==, ULLONG_MAX);", "}" ]
[ 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ] ]
5,936
static av_cold int mss1_decode_init(AVCodecContext *avctx) { MSS1Context * const c = avctx->priv_data; int ret; c->ctx.avctx = avctx; c->pic = av_frame_alloc(); if (!c->pic) return AVERROR(ENOMEM); ret = ff_mss12_decode_init(&c->ctx, 0, &c->sc, NULL); avctx->pix_fmt = AV_PIX_FMT_PAL8; return ret; }
true
FFmpeg
331fae80a1fb9b027442047fb564c02c6c41e70b
static av_cold int mss1_decode_init(AVCodecContext *avctx) { MSS1Context * const c = avctx->priv_data; int ret; c->ctx.avctx = avctx; c->pic = av_frame_alloc(); if (!c->pic) return AVERROR(ENOMEM); ret = ff_mss12_decode_init(&c->ctx, 0, &c->sc, NULL); avctx->pix_fmt = AV_PIX_FMT_PAL8; return ret; }
{ "code": [], "line_no": [] }
static av_cold int FUNC_0(AVCodecContext *avctx) { MSS1Context * const c = avctx->priv_data; int VAR_0; c->ctx.avctx = avctx; c->pic = av_frame_alloc(); if (!c->pic) return AVERROR(ENOMEM); VAR_0 = ff_mss12_decode_init(&c->ctx, 0, &c->sc, NULL); avctx->pix_fmt = AV_PIX_FMT_PAL8; return VAR_0; }
[ "static av_cold int FUNC_0(AVCodecContext *avctx)\n{", "MSS1Context * const c = avctx->priv_data;", "int VAR_0;", "c->ctx.avctx = avctx;", "c->pic = av_frame_alloc();", "if (!c->pic)\nreturn AVERROR(ENOMEM);", "VAR_0 = ff_mss12_decode_init(&c->ctx, 0, &c->sc, NULL);", "avctx->pix_fmt = AV_PIX_FMT_PAL8;", "return VAR_0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 15 ], [ 17, 19 ], [ 23 ], [ 29 ], [ 33 ], [ 35 ] ]
5,938
static int ioreq_map(struct ioreq *ioreq) { XenGnttab gnt = ioreq->blkdev->xendev.gnttabdev; uint32_t domids[BLKIF_MAX_SEGMENTS_PER_REQUEST]; uint32_t refs[BLKIF_MAX_SEGMENTS_PER_REQUEST]; void *page[BLKIF_MAX_SEGMENTS_PER_REQUEST]; int i, j, new_maps = 0; PersistentGrant *grant; /* domids and refs variables will contain the information necessary * to map the grants that are needed to fulfill this request. * * After mapping the needed grants, the page array will contain the * memory address of each granted page in the order specified in ioreq * (disregarding if it's a persistent grant or not). */ if (ioreq->v.niov == 0 || ioreq->mapped == 1) { return 0; } if (ioreq->blkdev->feature_persistent) { for (i = 0; i < ioreq->v.niov; i++) { grant = g_tree_lookup(ioreq->blkdev->persistent_gnts, GUINT_TO_POINTER(ioreq->refs[i])); if (grant != NULL) { page[i] = grant->page; xen_be_printf(&ioreq->blkdev->xendev, 3, "using persistent-grant %" PRIu32 "\n", ioreq->refs[i]); } else { /* Add the grant to the list of grants that * should be mapped */ domids[new_maps] = ioreq->domids[i]; refs[new_maps] = ioreq->refs[i]; page[i] = NULL; new_maps++; } } /* Set the protection to RW, since grants may be reused later * with a different protection than the one needed for this request */ ioreq->prot = PROT_WRITE | PROT_READ; } else { /* All grants in the request should be mapped */ memcpy(refs, ioreq->refs, sizeof(refs)); memcpy(domids, ioreq->domids, sizeof(domids)); memset(page, 0, sizeof(page)); new_maps = ioreq->v.niov; } if (batch_maps && new_maps) { ioreq->pages = xc_gnttab_map_grant_refs (gnt, new_maps, domids, refs, ioreq->prot); if (ioreq->pages == NULL) { xen_be_printf(&ioreq->blkdev->xendev, 0, "can't map %d grant refs (%s, %d maps)\n", new_maps, strerror(errno), ioreq->blkdev->cnt_map); return -1; } for (i = 0, j = 0; i < ioreq->v.niov; i++) { if (page[i] == NULL) { page[i] = ioreq->pages + (j++) * XC_PAGE_SIZE; } } ioreq->blkdev->cnt_map += new_maps; } else if (new_maps) { for (i = 0; i < new_maps; i++) { ioreq->page[i] = xc_gnttab_map_grant_ref (gnt, domids[i], refs[i], ioreq->prot); if (ioreq->page[i] == NULL) { xen_be_printf(&ioreq->blkdev->xendev, 0, "can't map grant ref %d (%s, %d maps)\n", refs[i], strerror(errno), ioreq->blkdev->cnt_map); ioreq->mapped = 1; ioreq_unmap(ioreq); return -1; } ioreq->blkdev->cnt_map++; } for (i = 0, j = 0; i < ioreq->v.niov; i++) { if (page[i] == NULL) { page[i] = ioreq->page[j++]; } } } if (ioreq->blkdev->feature_persistent) { while ((ioreq->blkdev->persistent_gnt_count < ioreq->blkdev->max_grants) && new_maps) { /* Go through the list of newly mapped grants and add as many * as possible to the list of persistently mapped grants. * * Since we start at the end of ioreq->page(s), we only need * to decrease new_maps to prevent this granted pages from * being unmapped in ioreq_unmap. */ grant = g_malloc0(sizeof(*grant)); new_maps--; if (batch_maps) { grant->page = ioreq->pages + (new_maps) * XC_PAGE_SIZE; } else { grant->page = ioreq->page[new_maps]; } grant->blkdev = ioreq->blkdev; xen_be_printf(&ioreq->blkdev->xendev, 3, "adding grant %" PRIu32 " page: %p\n", refs[new_maps], grant->page); g_tree_insert(ioreq->blkdev->persistent_gnts, GUINT_TO_POINTER(refs[new_maps]), grant); ioreq->blkdev->persistent_gnt_count++; } } for (i = 0; i < ioreq->v.niov; i++) { ioreq->v.iov[i].iov_base += (uintptr_t)page[i]; } ioreq->mapped = 1; ioreq->num_unmap = new_maps; return 0; }
true
qemu
2f01dfacb56bc7a0d4639adc9dff9aae131e6216
static int ioreq_map(struct ioreq *ioreq) { XenGnttab gnt = ioreq->blkdev->xendev.gnttabdev; uint32_t domids[BLKIF_MAX_SEGMENTS_PER_REQUEST]; uint32_t refs[BLKIF_MAX_SEGMENTS_PER_REQUEST]; void *page[BLKIF_MAX_SEGMENTS_PER_REQUEST]; int i, j, new_maps = 0; PersistentGrant *grant; if (ioreq->v.niov == 0 || ioreq->mapped == 1) { return 0; } if (ioreq->blkdev->feature_persistent) { for (i = 0; i < ioreq->v.niov; i++) { grant = g_tree_lookup(ioreq->blkdev->persistent_gnts, GUINT_TO_POINTER(ioreq->refs[i])); if (grant != NULL) { page[i] = grant->page; xen_be_printf(&ioreq->blkdev->xendev, 3, "using persistent-grant %" PRIu32 "\n", ioreq->refs[i]); } else { domids[new_maps] = ioreq->domids[i]; refs[new_maps] = ioreq->refs[i]; page[i] = NULL; new_maps++; } } ioreq->prot = PROT_WRITE | PROT_READ; } else { memcpy(refs, ioreq->refs, sizeof(refs)); memcpy(domids, ioreq->domids, sizeof(domids)); memset(page, 0, sizeof(page)); new_maps = ioreq->v.niov; } if (batch_maps && new_maps) { ioreq->pages = xc_gnttab_map_grant_refs (gnt, new_maps, domids, refs, ioreq->prot); if (ioreq->pages == NULL) { xen_be_printf(&ioreq->blkdev->xendev, 0, "can't map %d grant refs (%s, %d maps)\n", new_maps, strerror(errno), ioreq->blkdev->cnt_map); return -1; } for (i = 0, j = 0; i < ioreq->v.niov; i++) { if (page[i] == NULL) { page[i] = ioreq->pages + (j++) * XC_PAGE_SIZE; } } ioreq->blkdev->cnt_map += new_maps; } else if (new_maps) { for (i = 0; i < new_maps; i++) { ioreq->page[i] = xc_gnttab_map_grant_ref (gnt, domids[i], refs[i], ioreq->prot); if (ioreq->page[i] == NULL) { xen_be_printf(&ioreq->blkdev->xendev, 0, "can't map grant ref %d (%s, %d maps)\n", refs[i], strerror(errno), ioreq->blkdev->cnt_map); ioreq->mapped = 1; ioreq_unmap(ioreq); return -1; } ioreq->blkdev->cnt_map++; } for (i = 0, j = 0; i < ioreq->v.niov; i++) { if (page[i] == NULL) { page[i] = ioreq->page[j++]; } } } if (ioreq->blkdev->feature_persistent) { while ((ioreq->blkdev->persistent_gnt_count < ioreq->blkdev->max_grants) && new_maps) { grant = g_malloc0(sizeof(*grant)); new_maps--; if (batch_maps) { grant->page = ioreq->pages + (new_maps) * XC_PAGE_SIZE; } else { grant->page = ioreq->page[new_maps]; } grant->blkdev = ioreq->blkdev; xen_be_printf(&ioreq->blkdev->xendev, 3, "adding grant %" PRIu32 " page: %p\n", refs[new_maps], grant->page); g_tree_insert(ioreq->blkdev->persistent_gnts, GUINT_TO_POINTER(refs[new_maps]), grant); ioreq->blkdev->persistent_gnt_count++; } } for (i = 0; i < ioreq->v.niov; i++) { ioreq->v.iov[i].iov_base += (uintptr_t)page[i]; } ioreq->mapped = 1; ioreq->num_unmap = new_maps; return 0; }
{ "code": [ " if (ioreq->blkdev->feature_persistent) {" ], "line_no": [ 39 ] }
static int FUNC_0(struct VAR_0 *VAR_0) { XenGnttab gnt = VAR_0->blkdev->xendev.gnttabdev; uint32_t domids[BLKIF_MAX_SEGMENTS_PER_REQUEST]; uint32_t refs[BLKIF_MAX_SEGMENTS_PER_REQUEST]; void *VAR_1[BLKIF_MAX_SEGMENTS_PER_REQUEST]; int VAR_2, VAR_3, VAR_4 = 0; PersistentGrant *grant; if (VAR_0->v.niov == 0 || VAR_0->mapped == 1) { return 0; } if (VAR_0->blkdev->feature_persistent) { for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) { grant = g_tree_lookup(VAR_0->blkdev->persistent_gnts, GUINT_TO_POINTER(VAR_0->refs[VAR_2])); if (grant != NULL) { VAR_1[VAR_2] = grant->VAR_1; xen_be_printf(&VAR_0->blkdev->xendev, 3, "using persistent-grant %" PRIu32 "\n", VAR_0->refs[VAR_2]); } else { domids[VAR_4] = VAR_0->domids[VAR_2]; refs[VAR_4] = VAR_0->refs[VAR_2]; VAR_1[VAR_2] = NULL; VAR_4++; } } VAR_0->prot = PROT_WRITE | PROT_READ; } else { memcpy(refs, VAR_0->refs, sizeof(refs)); memcpy(domids, VAR_0->domids, sizeof(domids)); memset(VAR_1, 0, sizeof(VAR_1)); VAR_4 = VAR_0->v.niov; } if (batch_maps && VAR_4) { VAR_0->pages = xc_gnttab_map_grant_refs (gnt, VAR_4, domids, refs, VAR_0->prot); if (VAR_0->pages == NULL) { xen_be_printf(&VAR_0->blkdev->xendev, 0, "can't map %d grant refs (%s, %d maps)\n", VAR_4, strerror(errno), VAR_0->blkdev->cnt_map); return -1; } for (VAR_2 = 0, VAR_3 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) { if (VAR_1[VAR_2] == NULL) { VAR_1[VAR_2] = VAR_0->pages + (VAR_3++) * XC_PAGE_SIZE; } } VAR_0->blkdev->cnt_map += VAR_4; } else if (VAR_4) { for (VAR_2 = 0; VAR_2 < VAR_4; VAR_2++) { VAR_0->VAR_1[VAR_2] = xc_gnttab_map_grant_ref (gnt, domids[VAR_2], refs[VAR_2], VAR_0->prot); if (VAR_0->VAR_1[VAR_2] == NULL) { xen_be_printf(&VAR_0->blkdev->xendev, 0, "can't map grant ref %d (%s, %d maps)\n", refs[VAR_2], strerror(errno), VAR_0->blkdev->cnt_map); VAR_0->mapped = 1; ioreq_unmap(VAR_0); return -1; } VAR_0->blkdev->cnt_map++; } for (VAR_2 = 0, VAR_3 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) { if (VAR_1[VAR_2] == NULL) { VAR_1[VAR_2] = VAR_0->VAR_1[VAR_3++]; } } } if (VAR_0->blkdev->feature_persistent) { while ((VAR_0->blkdev->persistent_gnt_count < VAR_0->blkdev->max_grants) && VAR_4) { grant = g_malloc0(sizeof(*grant)); VAR_4--; if (batch_maps) { grant->VAR_1 = VAR_0->pages + (VAR_4) * XC_PAGE_SIZE; } else { grant->VAR_1 = VAR_0->VAR_1[VAR_4]; } grant->blkdev = VAR_0->blkdev; xen_be_printf(&VAR_0->blkdev->xendev, 3, "adding grant %" PRIu32 " VAR_1: %p\n", refs[VAR_4], grant->VAR_1); g_tree_insert(VAR_0->blkdev->persistent_gnts, GUINT_TO_POINTER(refs[VAR_4]), grant); VAR_0->blkdev->persistent_gnt_count++; } } for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) { VAR_0->v.iov[VAR_2].iov_base += (uintptr_t)VAR_1[VAR_2]; } VAR_0->mapped = 1; VAR_0->num_unmap = VAR_4; return 0; }
[ "static int FUNC_0(struct VAR_0 *VAR_0)\n{", "XenGnttab gnt = VAR_0->blkdev->xendev.gnttabdev;", "uint32_t domids[BLKIF_MAX_SEGMENTS_PER_REQUEST];", "uint32_t refs[BLKIF_MAX_SEGMENTS_PER_REQUEST];", "void *VAR_1[BLKIF_MAX_SEGMENTS_PER_REQUEST];", "int VAR_2, VAR_3, VAR_4 = 0;", "PersistentGrant *grant;", "if (VAR_0->v.niov == 0 || VAR_0->mapped == 1) {", "return 0;", "}", "if (VAR_0->blkdev->feature_persistent) {", "for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) {", "grant = g_tree_lookup(VAR_0->blkdev->persistent_gnts,\nGUINT_TO_POINTER(VAR_0->refs[VAR_2]));", "if (grant != NULL) {", "VAR_1[VAR_2] = grant->VAR_1;", "xen_be_printf(&VAR_0->blkdev->xendev, 3,\n\"using persistent-grant %\" PRIu32 \"\\n\",\nVAR_0->refs[VAR_2]);", "} else {", "domids[VAR_4] = VAR_0->domids[VAR_2];", "refs[VAR_4] = VAR_0->refs[VAR_2];", "VAR_1[VAR_2] = NULL;", "VAR_4++;", "}", "}", "VAR_0->prot = PROT_WRITE | PROT_READ;", "} else {", "memcpy(refs, VAR_0->refs, sizeof(refs));", "memcpy(domids, VAR_0->domids, sizeof(domids));", "memset(VAR_1, 0, sizeof(VAR_1));", "VAR_4 = VAR_0->v.niov;", "}", "if (batch_maps && VAR_4) {", "VAR_0->pages = xc_gnttab_map_grant_refs\n(gnt, VAR_4, domids, refs, VAR_0->prot);", "if (VAR_0->pages == NULL) {", "xen_be_printf(&VAR_0->blkdev->xendev, 0,\n\"can't map %d grant refs (%s, %d maps)\\n\",\nVAR_4, strerror(errno), VAR_0->blkdev->cnt_map);", "return -1;", "}", "for (VAR_2 = 0, VAR_3 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) {", "if (VAR_1[VAR_2] == NULL) {", "VAR_1[VAR_2] = VAR_0->pages + (VAR_3++) * XC_PAGE_SIZE;", "}", "}", "VAR_0->blkdev->cnt_map += VAR_4;", "} else if (VAR_4) {", "for (VAR_2 = 0; VAR_2 < VAR_4; VAR_2++) {", "VAR_0->VAR_1[VAR_2] = xc_gnttab_map_grant_ref\n(gnt, domids[VAR_2], refs[VAR_2], VAR_0->prot);", "if (VAR_0->VAR_1[VAR_2] == NULL) {", "xen_be_printf(&VAR_0->blkdev->xendev, 0,\n\"can't map grant ref %d (%s, %d maps)\\n\",\nrefs[VAR_2], strerror(errno), VAR_0->blkdev->cnt_map);", "VAR_0->mapped = 1;", "ioreq_unmap(VAR_0);", "return -1;", "}", "VAR_0->blkdev->cnt_map++;", "}", "for (VAR_2 = 0, VAR_3 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) {", "if (VAR_1[VAR_2] == NULL) {", "VAR_1[VAR_2] = VAR_0->VAR_1[VAR_3++];", "}", "}", "}", "if (VAR_0->blkdev->feature_persistent) {", "while ((VAR_0->blkdev->persistent_gnt_count < VAR_0->blkdev->max_grants)\n&& VAR_4) {", "grant = g_malloc0(sizeof(*grant));", "VAR_4--;", "if (batch_maps) {", "grant->VAR_1 = VAR_0->pages + (VAR_4) * XC_PAGE_SIZE;", "} else {", "grant->VAR_1 = VAR_0->VAR_1[VAR_4];", "}", "grant->blkdev = VAR_0->blkdev;", "xen_be_printf(&VAR_0->blkdev->xendev, 3,\n\"adding grant %\" PRIu32 \" VAR_1: %p\\n\",\nrefs[VAR_4], grant->VAR_1);", "g_tree_insert(VAR_0->blkdev->persistent_gnts,\nGUINT_TO_POINTER(refs[VAR_4]),\ngrant);", "VAR_0->blkdev->persistent_gnt_count++;", "}", "}", "for (VAR_2 = 0; VAR_2 < VAR_0->v.niov; VAR_2++) {", "VAR_0->v.iov[VAR_2].iov_base += (uintptr_t)VAR_1[VAR_2];", "}", "VAR_0->mapped = 1;", "VAR_0->num_unmap = VAR_4;", "return 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, 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 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43, 45 ], [ 49 ], [ 51 ], [ 53, 55, 57 ], [ 59 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 85 ], [ 87 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105, 107 ], [ 109 ], [ 111, 113, 115 ], [ 117 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 135 ], [ 137, 139 ], [ 141 ], [ 143, 145, 147 ], [ 149 ], [ 151 ], [ 153 ], [ 155 ], [ 157 ], [ 159 ], [ 161 ], [ 163 ], [ 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175, 177 ], [ 193 ], [ 195 ], [ 197 ], [ 199 ], [ 201 ], [ 203 ], [ 205 ], [ 207 ], [ 209, 211, 213 ], [ 215, 217, 219 ], [ 221 ], [ 223 ], [ 225 ], [ 227 ], [ 229 ], [ 231 ], [ 233 ], [ 235 ], [ 237 ], [ 239 ] ]
5,939
static void *aio_thread(void *unused) { sigset_t set; /* block all signals */ sigfillset(&set); sigprocmask(SIG_BLOCK, &set, NULL); while (1) { struct qemu_paiocb *aiocb; size_t offset; int ret = 0; pthread_mutex_lock(&lock); while (TAILQ_EMPTY(&request_list) && !(ret == ETIMEDOUT)) { struct timespec ts = { 0 }; qemu_timeval tv; qemu_gettimeofday(&tv); ts.tv_sec = tv.tv_sec + 10; ret = pthread_cond_timedwait(&cond, &lock, &ts); } if (ret == ETIMEDOUT) break; aiocb = TAILQ_FIRST(&request_list); TAILQ_REMOVE(&request_list, aiocb, node); offset = 0; aiocb->active = 1; idle_threads--; pthread_mutex_unlock(&lock); while (offset < aiocb->aio_nbytes) { ssize_t len; if (aiocb->is_write) len = pwrite(aiocb->aio_fildes, (const char *)aiocb->aio_buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); else len = pread(aiocb->aio_fildes, (char *)aiocb->aio_buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); if (len == -1 && errno == EINTR) continue; else if (len == -1) { pthread_mutex_lock(&lock); aiocb->ret = -errno; pthread_mutex_unlock(&lock); break; } else if (len == 0) break; offset += len; pthread_mutex_lock(&lock); aiocb->ret = offset; pthread_mutex_unlock(&lock); } pthread_mutex_lock(&lock); idle_threads++; pthread_mutex_unlock(&lock); sigqueue(getpid(), aiocb->aio_sigevent.sigev_signo, aiocb->aio_sigevent.sigev_value); } idle_threads--; cur_threads--; pthread_mutex_unlock(&lock); return NULL; }
true
qemu
f094a78220187996e33ba5adce29789326cf6c3c
static void *aio_thread(void *unused) { sigset_t set; sigfillset(&set); sigprocmask(SIG_BLOCK, &set, NULL); while (1) { struct qemu_paiocb *aiocb; size_t offset; int ret = 0; pthread_mutex_lock(&lock); while (TAILQ_EMPTY(&request_list) && !(ret == ETIMEDOUT)) { struct timespec ts = { 0 }; qemu_timeval tv; qemu_gettimeofday(&tv); ts.tv_sec = tv.tv_sec + 10; ret = pthread_cond_timedwait(&cond, &lock, &ts); } if (ret == ETIMEDOUT) break; aiocb = TAILQ_FIRST(&request_list); TAILQ_REMOVE(&request_list, aiocb, node); offset = 0; aiocb->active = 1; idle_threads--; pthread_mutex_unlock(&lock); while (offset < aiocb->aio_nbytes) { ssize_t len; if (aiocb->is_write) len = pwrite(aiocb->aio_fildes, (const char *)aiocb->aio_buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); else len = pread(aiocb->aio_fildes, (char *)aiocb->aio_buf + offset, aiocb->aio_nbytes - offset, aiocb->aio_offset + offset); if (len == -1 && errno == EINTR) continue; else if (len == -1) { pthread_mutex_lock(&lock); aiocb->ret = -errno; pthread_mutex_unlock(&lock); break; } else if (len == 0) break; offset += len; pthread_mutex_lock(&lock); aiocb->ret = offset; pthread_mutex_unlock(&lock); } pthread_mutex_lock(&lock); idle_threads++; pthread_mutex_unlock(&lock); sigqueue(getpid(), aiocb->aio_sigevent.sigev_signo, aiocb->aio_sigevent.sigev_value); } idle_threads--; cur_threads--; pthread_mutex_unlock(&lock); return NULL; }
{ "code": [ " pthread_mutex_lock(&lock);", " aiocb->ret = -errno;", " pthread_mutex_unlock(&lock);", " pthread_mutex_lock(&lock);", " aiocb->ret = offset;", " pthread_mutex_unlock(&lock);" ], "line_no": [ 109, 111, 113, 127, 129, 131 ] }
static void *FUNC_0(void *VAR_0) { sigset_t set; sigfillset(&set); sigprocmask(SIG_BLOCK, &set, NULL); while (1) { struct qemu_paiocb *VAR_1; size_t offset; int VAR_2 = 0; pthread_mutex_lock(&lock); while (TAILQ_EMPTY(&request_list) && !(VAR_2 == ETIMEDOUT)) { struct timespec VAR_3 = { 0 }; qemu_timeval tv; qemu_gettimeofday(&tv); VAR_3.tv_sec = tv.tv_sec + 10; VAR_2 = pthread_cond_timedwait(&cond, &lock, &VAR_3); } if (VAR_2 == ETIMEDOUT) break; VAR_1 = TAILQ_FIRST(&request_list); TAILQ_REMOVE(&request_list, VAR_1, node); offset = 0; VAR_1->active = 1; idle_threads--; pthread_mutex_unlock(&lock); while (offset < VAR_1->aio_nbytes) { ssize_t len; if (VAR_1->is_write) len = pwrite(VAR_1->aio_fildes, (const char *)VAR_1->aio_buf + offset, VAR_1->aio_nbytes - offset, VAR_1->aio_offset + offset); else len = pread(VAR_1->aio_fildes, (char *)VAR_1->aio_buf + offset, VAR_1->aio_nbytes - offset, VAR_1->aio_offset + offset); if (len == -1 && errno == EINTR) continue; else if (len == -1) { pthread_mutex_lock(&lock); VAR_1->VAR_2 = -errno; pthread_mutex_unlock(&lock); break; } else if (len == 0) break; offset += len; pthread_mutex_lock(&lock); VAR_1->VAR_2 = offset; pthread_mutex_unlock(&lock); } pthread_mutex_lock(&lock); idle_threads++; pthread_mutex_unlock(&lock); sigqueue(getpid(), VAR_1->aio_sigevent.sigev_signo, VAR_1->aio_sigevent.sigev_value); } idle_threads--; cur_threads--; pthread_mutex_unlock(&lock); return NULL; }
[ "static void *FUNC_0(void *VAR_0)\n{", "sigset_t set;", "sigfillset(&set);", "sigprocmask(SIG_BLOCK, &set, NULL);", "while (1) {", "struct qemu_paiocb *VAR_1;", "size_t offset;", "int VAR_2 = 0;", "pthread_mutex_lock(&lock);", "while (TAILQ_EMPTY(&request_list) &&\n!(VAR_2 == ETIMEDOUT)) {", "struct timespec VAR_3 = { 0 };", "qemu_timeval tv;", "qemu_gettimeofday(&tv);", "VAR_3.tv_sec = tv.tv_sec + 10;", "VAR_2 = pthread_cond_timedwait(&cond, &lock, &VAR_3);", "}", "if (VAR_2 == ETIMEDOUT)\nbreak;", "VAR_1 = TAILQ_FIRST(&request_list);", "TAILQ_REMOVE(&request_list, VAR_1, node);", "offset = 0;", "VAR_1->active = 1;", "idle_threads--;", "pthread_mutex_unlock(&lock);", "while (offset < VAR_1->aio_nbytes) {", "ssize_t len;", "if (VAR_1->is_write)\nlen = pwrite(VAR_1->aio_fildes,\n(const char *)VAR_1->aio_buf + offset,\nVAR_1->aio_nbytes - offset,\nVAR_1->aio_offset + offset);", "else\nlen = pread(VAR_1->aio_fildes,\n(char *)VAR_1->aio_buf + offset,\nVAR_1->aio_nbytes - offset,\nVAR_1->aio_offset + offset);", "if (len == -1 && errno == EINTR)\ncontinue;", "else if (len == -1) {", "pthread_mutex_lock(&lock);", "VAR_1->VAR_2 = -errno;", "pthread_mutex_unlock(&lock);", "break;", "} else if (len == 0)", "break;", "offset += len;", "pthread_mutex_lock(&lock);", "VAR_1->VAR_2 = offset;", "pthread_mutex_unlock(&lock);", "}", "pthread_mutex_lock(&lock);", "idle_threads++;", "pthread_mutex_unlock(&lock);", "sigqueue(getpid(),\nVAR_1->aio_sigevent.sigev_signo,\nVAR_1->aio_sigevent.sigev_value);", "}", "idle_threads--;", "cur_threads--;", "pthread_mutex_unlock(&lock);", "return NULL;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 27 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 51, 53 ], [ 57 ], [ 59 ], [ 63 ], [ 65 ], [ 69 ], [ 71 ], [ 75 ], [ 77 ], [ 81, 83, 85, 87, 89 ], [ 91, 93, 95, 97, 99 ], [ 103, 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113 ], [ 115 ], [ 117 ], [ 119 ], [ 123 ], [ 127 ], [ 129 ], [ 131 ], [ 133 ], [ 137 ], [ 139 ], [ 141 ], [ 145, 147, 149 ], [ 151 ], [ 155 ], [ 157 ], [ 159 ], [ 163 ], [ 165 ] ]
5,940
int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size) { uint32_t mrk; int i, tmp; const uint16_t *ssrc = (const uint16_t *) src; uint16_t *sdst = (uint16_t *) dst; PutBitContext pb; if ((unsigned) src_size > (unsigned) max_size) src_size = max_size; mrk = AV_RB32(src); switch (mrk) { case DCA_SYNCWORD_CORE_BE: memcpy(dst, src, src_size); return src_size; case DCA_SYNCWORD_CORE_LE: for (i = 0; i < (src_size + 1) >> 1; i++) *sdst++ = av_bswap16(*ssrc++); return src_size; case DCA_SYNCWORD_CORE_14B_BE: case DCA_SYNCWORD_CORE_14B_LE: init_put_bits(&pb, dst, max_size); for (i = 0; i < (src_size + 1) >> 1; i++, src += 2) { tmp = ((mrk == DCA_SYNCWORD_CORE_14B_BE) ? AV_RB16(src) : AV_RL16(src)) & 0x3FFF; put_bits(&pb, 14, tmp); } flush_put_bits(&pb); return (put_bits_count(&pb) + 7) >> 3; default: return AVERROR_INVALIDDATA; } }
true
FFmpeg
b06cb15b9d7928bf54b639c9f9f7658c2c38bfb9
int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size) { uint32_t mrk; int i, tmp; const uint16_t *ssrc = (const uint16_t *) src; uint16_t *sdst = (uint16_t *) dst; PutBitContext pb; if ((unsigned) src_size > (unsigned) max_size) src_size = max_size; mrk = AV_RB32(src); switch (mrk) { case DCA_SYNCWORD_CORE_BE: memcpy(dst, src, src_size); return src_size; case DCA_SYNCWORD_CORE_LE: for (i = 0; i < (src_size + 1) >> 1; i++) *sdst++ = av_bswap16(*ssrc++); return src_size; case DCA_SYNCWORD_CORE_14B_BE: case DCA_SYNCWORD_CORE_14B_LE: init_put_bits(&pb, dst, max_size); for (i = 0; i < (src_size + 1) >> 1; i++, src += 2) { tmp = ((mrk == DCA_SYNCWORD_CORE_14B_BE) ? AV_RB16(src) : AV_RL16(src)) & 0x3FFF; put_bits(&pb, 14, tmp); } flush_put_bits(&pb); return (put_bits_count(&pb) + 7) >> 3; default: return AVERROR_INVALIDDATA; } }
{ "code": [ " const uint16_t *ssrc = (const uint16_t *) src;", " uint16_t *sdst = (uint16_t *) dst;", " for (i = 0; i < (src_size + 1) >> 1; i++)", " *sdst++ = av_bswap16(*ssrc++);" ], "line_no": [ 11, 13, 37, 39 ] }
int FUNC_0(const uint8_t *VAR_0, int VAR_1, uint8_t *VAR_2, int VAR_3) { uint32_t mrk; int VAR_4, VAR_5; const uint16_t *VAR_6 = (const uint16_t *) VAR_0; uint16_t *sdst = (uint16_t *) VAR_2; PutBitContext pb; if ((unsigned) VAR_1 > (unsigned) VAR_3) VAR_1 = VAR_3; mrk = AV_RB32(VAR_0); switch (mrk) { case DCA_SYNCWORD_CORE_BE: memcpy(VAR_2, VAR_0, VAR_1); return VAR_1; case DCA_SYNCWORD_CORE_LE: for (VAR_4 = 0; VAR_4 < (VAR_1 + 1) >> 1; VAR_4++) *sdst++ = av_bswap16(*VAR_6++); return VAR_1; case DCA_SYNCWORD_CORE_14B_BE: case DCA_SYNCWORD_CORE_14B_LE: init_put_bits(&pb, VAR_2, VAR_3); for (VAR_4 = 0; VAR_4 < (VAR_1 + 1) >> 1; VAR_4++, VAR_0 += 2) { VAR_5 = ((mrk == DCA_SYNCWORD_CORE_14B_BE) ? AV_RB16(VAR_0) : AV_RL16(VAR_0)) & 0x3FFF; put_bits(&pb, 14, VAR_5); } flush_put_bits(&pb); return (put_bits_count(&pb) + 7) >> 3; default: return AVERROR_INVALIDDATA; } }
[ "int FUNC_0(const uint8_t *VAR_0, int VAR_1, uint8_t *VAR_2,\nint VAR_3)\n{", "uint32_t mrk;", "int VAR_4, VAR_5;", "const uint16_t *VAR_6 = (const uint16_t *) VAR_0;", "uint16_t *sdst = (uint16_t *) VAR_2;", "PutBitContext pb;", "if ((unsigned) VAR_1 > (unsigned) VAR_3)\nVAR_1 = VAR_3;", "mrk = AV_RB32(VAR_0);", "switch (mrk) {", "case DCA_SYNCWORD_CORE_BE:\nmemcpy(VAR_2, VAR_0, VAR_1);", "return VAR_1;", "case DCA_SYNCWORD_CORE_LE:\nfor (VAR_4 = 0; VAR_4 < (VAR_1 + 1) >> 1; VAR_4++)", "*sdst++ = av_bswap16(*VAR_6++);", "return VAR_1;", "case DCA_SYNCWORD_CORE_14B_BE:\ncase DCA_SYNCWORD_CORE_14B_LE:\ninit_put_bits(&pb, VAR_2, VAR_3);", "for (VAR_4 = 0; VAR_4 < (VAR_1 + 1) >> 1; VAR_4++, VAR_0 += 2) {", "VAR_5 = ((mrk == DCA_SYNCWORD_CORE_14B_BE) ? AV_RB16(VAR_0) : AV_RL16(VAR_0)) & 0x3FFF;", "put_bits(&pb, 14, VAR_5);", "}", "flush_put_bits(&pb);", "return (put_bits_count(&pb) + 7) >> 3;", "default:\nreturn AVERROR_INVALIDDATA;", "}", "}" ]
[ 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29, 31 ], [ 33 ], [ 35, 37 ], [ 39 ], [ 41 ], [ 43, 45, 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 57 ], [ 59 ], [ 61, 63 ], [ 65 ], [ 67 ] ]
5,941
av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp) { int cpu_flags = av_get_cpu_flags(); if (have_armv6(cpu_flags)) ff_vp8dsp_init_armv6(dsp); if (have_neon(cpu_flags)) ff_vp8dsp_init_neon(dsp); }
false
FFmpeg
b8664c929437d6d079e16979c496a2db40cf2324
av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp) { int cpu_flags = av_get_cpu_flags(); if (have_armv6(cpu_flags)) ff_vp8dsp_init_armv6(dsp); if (have_neon(cpu_flags)) ff_vp8dsp_init_neon(dsp); }
{ "code": [], "line_no": [] }
av_cold void FUNC_0(VP8DSPContext *dsp) { int VAR_0 = av_get_cpu_flags(); if (have_armv6(VAR_0)) ff_vp8dsp_init_armv6(dsp); if (have_neon(VAR_0)) ff_vp8dsp_init_neon(dsp); }
[ "av_cold void FUNC_0(VP8DSPContext *dsp)\n{", "int VAR_0 = av_get_cpu_flags();", "if (have_armv6(VAR_0))\nff_vp8dsp_init_armv6(dsp);", "if (have_neon(VAR_0))\nff_vp8dsp_init_neon(dsp);", "}" ]
[ 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9, 11 ], [ 13, 15 ], [ 17 ] ]
5,942
static int g723_1_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { G723_1_Context *p = avctx->priv_data; int16_t unq_lpc[LPC_ORDER * SUBFRAMES]; int16_t qnt_lpc[LPC_ORDER * SUBFRAMES]; int16_t cur_lsp[LPC_ORDER]; int16_t weighted_lpc[LPC_ORDER * SUBFRAMES << 1]; int16_t vector[FRAME_LEN + PITCH_MAX]; int offset, ret; int16_t *in = (const int16_t *)frame->data[0]; HFParam hf[4]; int i, j; highpass_filter(in, &p->hpf_fir_mem, &p->hpf_iir_mem); memcpy(vector, p->prev_data, HALF_FRAME_LEN * sizeof(int16_t)); memcpy(vector + HALF_FRAME_LEN, in, FRAME_LEN * sizeof(int16_t)); comp_lpc_coeff(vector, unq_lpc); lpc2lsp(&unq_lpc[LPC_ORDER * 3], p->prev_lsp, cur_lsp); lsp_quantize(p->lsp_index, cur_lsp, p->prev_lsp); /* Update memory */ memcpy(vector + LPC_ORDER, p->prev_data + SUBFRAME_LEN, sizeof(int16_t) * SUBFRAME_LEN); memcpy(vector + LPC_ORDER + SUBFRAME_LEN, in, sizeof(int16_t) * (HALF_FRAME_LEN + SUBFRAME_LEN)); memcpy(p->prev_data, in + HALF_FRAME_LEN, sizeof(int16_t) * HALF_FRAME_LEN); memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN); perceptual_filter(p, weighted_lpc, unq_lpc, vector); memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN); memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX); memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN); scale_vector(vector, vector, FRAME_LEN + PITCH_MAX); p->pitch_lag[0] = estimate_pitch(vector, PITCH_MAX); p->pitch_lag[1] = estimate_pitch(vector, PITCH_MAX + HALF_FRAME_LEN); for (i = PITCH_MAX, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) comp_harmonic_coeff(vector + i, p->pitch_lag[j >> 1], hf + j); memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX); memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN); memcpy(p->prev_weight_sig, vector + FRAME_LEN, sizeof(int16_t) * PITCH_MAX); for (i = 0, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) harmonic_filter(hf + j, vector + PITCH_MAX + i, in + i); inverse_quant(cur_lsp, p->prev_lsp, p->lsp_index, 0); lsp_interpolate(qnt_lpc, cur_lsp, p->prev_lsp); memcpy(p->prev_lsp, cur_lsp, sizeof(int16_t) * LPC_ORDER); offset = 0; for (i = 0; i < SUBFRAMES; i++) { int16_t impulse_resp[SUBFRAME_LEN]; int16_t residual[SUBFRAME_LEN + PITCH_ORDER - 1]; int16_t flt_in[SUBFRAME_LEN]; int16_t zero[LPC_ORDER], fir[LPC_ORDER], iir[LPC_ORDER]; /** * Compute the combined impulse response of the synthesis filter, * formant perceptual weighting filter and harmonic noise shaping filter */ memset(zero, 0, sizeof(int16_t) * LPC_ORDER); memset(vector, 0, sizeof(int16_t) * PITCH_MAX); memset(flt_in, 0, sizeof(int16_t) * SUBFRAME_LEN); flt_in[0] = 1 << 13; /* Unit impulse */ synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1), zero, zero, flt_in, vector + PITCH_MAX, 1); harmonic_filter(hf + i, vector + PITCH_MAX, impulse_resp); /* Compute the combined zero input response */ flt_in[0] = 0; memcpy(fir, p->perf_fir_mem, sizeof(int16_t) * LPC_ORDER); memcpy(iir, p->perf_iir_mem, sizeof(int16_t) * LPC_ORDER); synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1), fir, iir, flt_in, vector + PITCH_MAX, 0); memcpy(vector, p->harmonic_mem, sizeof(int16_t) * PITCH_MAX); harmonic_noise_sub(hf + i, vector + PITCH_MAX, in); acb_search(p, residual, impulse_resp, in, i); gen_acb_excitation(residual, p->prev_excitation,p->pitch_lag[i >> 1], &p->subframe[i], p->cur_rate); sub_acb_contrib(residual, impulse_resp, in); fcb_search(p, impulse_resp, in, i); /* Reconstruct the excitation */ gen_acb_excitation(impulse_resp, p->prev_excitation, p->pitch_lag[i >> 1], &p->subframe[i], RATE_6300); memmove(p->prev_excitation, p->prev_excitation + SUBFRAME_LEN, sizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN)); for (j = 0; j < SUBFRAME_LEN; j++) in[j] = av_clip_int16((in[j] << 1) + impulse_resp[j]); memcpy(p->prev_excitation + PITCH_MAX - SUBFRAME_LEN, in, sizeof(int16_t) * SUBFRAME_LEN); /* Update filter memories */ synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1), p->perf_fir_mem, p->perf_iir_mem, in, vector + PITCH_MAX, 0); memmove(p->harmonic_mem, p->harmonic_mem + SUBFRAME_LEN, sizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN)); memcpy(p->harmonic_mem + PITCH_MAX - SUBFRAME_LEN, vector + PITCH_MAX, sizeof(int16_t) * SUBFRAME_LEN); in += SUBFRAME_LEN; offset += LPC_ORDER; } if ((ret = ff_alloc_packet2(avctx, avpkt, 24))) return ret; *got_packet_ptr = 1; avpkt->size = pack_bitstream(p, avpkt->data, avpkt->size); return 0; }
false
FFmpeg
bcaf64b605442e1622d16da89d4ec0e7730b8a8c
static int g723_1_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { G723_1_Context *p = avctx->priv_data; int16_t unq_lpc[LPC_ORDER * SUBFRAMES]; int16_t qnt_lpc[LPC_ORDER * SUBFRAMES]; int16_t cur_lsp[LPC_ORDER]; int16_t weighted_lpc[LPC_ORDER * SUBFRAMES << 1]; int16_t vector[FRAME_LEN + PITCH_MAX]; int offset, ret; int16_t *in = (const int16_t *)frame->data[0]; HFParam hf[4]; int i, j; highpass_filter(in, &p->hpf_fir_mem, &p->hpf_iir_mem); memcpy(vector, p->prev_data, HALF_FRAME_LEN * sizeof(int16_t)); memcpy(vector + HALF_FRAME_LEN, in, FRAME_LEN * sizeof(int16_t)); comp_lpc_coeff(vector, unq_lpc); lpc2lsp(&unq_lpc[LPC_ORDER * 3], p->prev_lsp, cur_lsp); lsp_quantize(p->lsp_index, cur_lsp, p->prev_lsp); memcpy(vector + LPC_ORDER, p->prev_data + SUBFRAME_LEN, sizeof(int16_t) * SUBFRAME_LEN); memcpy(vector + LPC_ORDER + SUBFRAME_LEN, in, sizeof(int16_t) * (HALF_FRAME_LEN + SUBFRAME_LEN)); memcpy(p->prev_data, in + HALF_FRAME_LEN, sizeof(int16_t) * HALF_FRAME_LEN); memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN); perceptual_filter(p, weighted_lpc, unq_lpc, vector); memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN); memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX); memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN); scale_vector(vector, vector, FRAME_LEN + PITCH_MAX); p->pitch_lag[0] = estimate_pitch(vector, PITCH_MAX); p->pitch_lag[1] = estimate_pitch(vector, PITCH_MAX + HALF_FRAME_LEN); for (i = PITCH_MAX, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) comp_harmonic_coeff(vector + i, p->pitch_lag[j >> 1], hf + j); memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX); memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN); memcpy(p->prev_weight_sig, vector + FRAME_LEN, sizeof(int16_t) * PITCH_MAX); for (i = 0, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) harmonic_filter(hf + j, vector + PITCH_MAX + i, in + i); inverse_quant(cur_lsp, p->prev_lsp, p->lsp_index, 0); lsp_interpolate(qnt_lpc, cur_lsp, p->prev_lsp); memcpy(p->prev_lsp, cur_lsp, sizeof(int16_t) * LPC_ORDER); offset = 0; for (i = 0; i < SUBFRAMES; i++) { int16_t impulse_resp[SUBFRAME_LEN]; int16_t residual[SUBFRAME_LEN + PITCH_ORDER - 1]; int16_t flt_in[SUBFRAME_LEN]; int16_t zero[LPC_ORDER], fir[LPC_ORDER], iir[LPC_ORDER]; memset(zero, 0, sizeof(int16_t) * LPC_ORDER); memset(vector, 0, sizeof(int16_t) * PITCH_MAX); memset(flt_in, 0, sizeof(int16_t) * SUBFRAME_LEN); flt_in[0] = 1 << 13; synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1), zero, zero, flt_in, vector + PITCH_MAX, 1); harmonic_filter(hf + i, vector + PITCH_MAX, impulse_resp); flt_in[0] = 0; memcpy(fir, p->perf_fir_mem, sizeof(int16_t) * LPC_ORDER); memcpy(iir, p->perf_iir_mem, sizeof(int16_t) * LPC_ORDER); synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1), fir, iir, flt_in, vector + PITCH_MAX, 0); memcpy(vector, p->harmonic_mem, sizeof(int16_t) * PITCH_MAX); harmonic_noise_sub(hf + i, vector + PITCH_MAX, in); acb_search(p, residual, impulse_resp, in, i); gen_acb_excitation(residual, p->prev_excitation,p->pitch_lag[i >> 1], &p->subframe[i], p->cur_rate); sub_acb_contrib(residual, impulse_resp, in); fcb_search(p, impulse_resp, in, i); gen_acb_excitation(impulse_resp, p->prev_excitation, p->pitch_lag[i >> 1], &p->subframe[i], RATE_6300); memmove(p->prev_excitation, p->prev_excitation + SUBFRAME_LEN, sizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN)); for (j = 0; j < SUBFRAME_LEN; j++) in[j] = av_clip_int16((in[j] << 1) + impulse_resp[j]); memcpy(p->prev_excitation + PITCH_MAX - SUBFRAME_LEN, in, sizeof(int16_t) * SUBFRAME_LEN); synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1), p->perf_fir_mem, p->perf_iir_mem, in, vector + PITCH_MAX, 0); memmove(p->harmonic_mem, p->harmonic_mem + SUBFRAME_LEN, sizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN)); memcpy(p->harmonic_mem + PITCH_MAX - SUBFRAME_LEN, vector + PITCH_MAX, sizeof(int16_t) * SUBFRAME_LEN); in += SUBFRAME_LEN; offset += LPC_ORDER; } if ((ret = ff_alloc_packet2(avctx, avpkt, 24))) return ret; *got_packet_ptr = 1; avpkt->size = pack_bitstream(p, avpkt->data, avpkt->size); return 0; }
{ "code": [], "line_no": [] }
static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1, const AVFrame *VAR_2, int *VAR_3) { G723_1_Context *p = VAR_0->priv_data; int16_t unq_lpc[LPC_ORDER * SUBFRAMES]; int16_t qnt_lpc[LPC_ORDER * SUBFRAMES]; int16_t cur_lsp[LPC_ORDER]; int16_t weighted_lpc[LPC_ORDER * SUBFRAMES << 1]; int16_t vector[FRAME_LEN + PITCH_MAX]; int VAR_4, VAR_5; int16_t *in = (const int16_t *)VAR_2->data[0]; HFParam hf[4]; int VAR_6, VAR_7; highpass_filter(in, &p->hpf_fir_mem, &p->hpf_iir_mem); memcpy(vector, p->prev_data, HALF_FRAME_LEN * sizeof(int16_t)); memcpy(vector + HALF_FRAME_LEN, in, FRAME_LEN * sizeof(int16_t)); comp_lpc_coeff(vector, unq_lpc); lpc2lsp(&unq_lpc[LPC_ORDER * 3], p->prev_lsp, cur_lsp); lsp_quantize(p->lsp_index, cur_lsp, p->prev_lsp); memcpy(vector + LPC_ORDER, p->prev_data + SUBFRAME_LEN, sizeof(int16_t) * SUBFRAME_LEN); memcpy(vector + LPC_ORDER + SUBFRAME_LEN, in, sizeof(int16_t) * (HALF_FRAME_LEN + SUBFRAME_LEN)); memcpy(p->prev_data, in + HALF_FRAME_LEN, sizeof(int16_t) * HALF_FRAME_LEN); memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN); perceptual_filter(p, weighted_lpc, unq_lpc, vector); memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN); memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX); memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN); scale_vector(vector, vector, FRAME_LEN + PITCH_MAX); p->pitch_lag[0] = estimate_pitch(vector, PITCH_MAX); p->pitch_lag[1] = estimate_pitch(vector, PITCH_MAX + HALF_FRAME_LEN); for (VAR_6 = PITCH_MAX, VAR_7 = 0; VAR_7 < SUBFRAMES; VAR_6 += SUBFRAME_LEN, VAR_7++) comp_harmonic_coeff(vector + VAR_6, p->pitch_lag[VAR_7 >> 1], hf + VAR_7); memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX); memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN); memcpy(p->prev_weight_sig, vector + FRAME_LEN, sizeof(int16_t) * PITCH_MAX); for (VAR_6 = 0, VAR_7 = 0; VAR_7 < SUBFRAMES; VAR_6 += SUBFRAME_LEN, VAR_7++) harmonic_filter(hf + VAR_7, vector + PITCH_MAX + VAR_6, in + VAR_6); inverse_quant(cur_lsp, p->prev_lsp, p->lsp_index, 0); lsp_interpolate(qnt_lpc, cur_lsp, p->prev_lsp); memcpy(p->prev_lsp, cur_lsp, sizeof(int16_t) * LPC_ORDER); VAR_4 = 0; for (VAR_6 = 0; VAR_6 < SUBFRAMES; VAR_6++) { int16_t impulse_resp[SUBFRAME_LEN]; int16_t residual[SUBFRAME_LEN + PITCH_ORDER - 1]; int16_t flt_in[SUBFRAME_LEN]; int16_t zero[LPC_ORDER], fir[LPC_ORDER], iir[LPC_ORDER]; memset(zero, 0, sizeof(int16_t) * LPC_ORDER); memset(vector, 0, sizeof(int16_t) * PITCH_MAX); memset(flt_in, 0, sizeof(int16_t) * SUBFRAME_LEN); flt_in[0] = 1 << 13; synth_percept_filter(qnt_lpc + VAR_4, weighted_lpc + (VAR_4 << 1), zero, zero, flt_in, vector + PITCH_MAX, 1); harmonic_filter(hf + VAR_6, vector + PITCH_MAX, impulse_resp); flt_in[0] = 0; memcpy(fir, p->perf_fir_mem, sizeof(int16_t) * LPC_ORDER); memcpy(iir, p->perf_iir_mem, sizeof(int16_t) * LPC_ORDER); synth_percept_filter(qnt_lpc + VAR_4, weighted_lpc + (VAR_4 << 1), fir, iir, flt_in, vector + PITCH_MAX, 0); memcpy(vector, p->harmonic_mem, sizeof(int16_t) * PITCH_MAX); harmonic_noise_sub(hf + VAR_6, vector + PITCH_MAX, in); acb_search(p, residual, impulse_resp, in, VAR_6); gen_acb_excitation(residual, p->prev_excitation,p->pitch_lag[VAR_6 >> 1], &p->subframe[VAR_6], p->cur_rate); sub_acb_contrib(residual, impulse_resp, in); fcb_search(p, impulse_resp, in, VAR_6); gen_acb_excitation(impulse_resp, p->prev_excitation, p->pitch_lag[VAR_6 >> 1], &p->subframe[VAR_6], RATE_6300); memmove(p->prev_excitation, p->prev_excitation + SUBFRAME_LEN, sizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN)); for (VAR_7 = 0; VAR_7 < SUBFRAME_LEN; VAR_7++) in[VAR_7] = av_clip_int16((in[VAR_7] << 1) + impulse_resp[VAR_7]); memcpy(p->prev_excitation + PITCH_MAX - SUBFRAME_LEN, in, sizeof(int16_t) * SUBFRAME_LEN); synth_percept_filter(qnt_lpc + VAR_4, weighted_lpc + (VAR_4 << 1), p->perf_fir_mem, p->perf_iir_mem, in, vector + PITCH_MAX, 0); memmove(p->harmonic_mem, p->harmonic_mem + SUBFRAME_LEN, sizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN)); memcpy(p->harmonic_mem + PITCH_MAX - SUBFRAME_LEN, vector + PITCH_MAX, sizeof(int16_t) * SUBFRAME_LEN); in += SUBFRAME_LEN; VAR_4 += LPC_ORDER; } if ((VAR_5 = ff_alloc_packet2(VAR_0, VAR_1, 24))) return VAR_5; *VAR_3 = 1; VAR_1->size = pack_bitstream(p, VAR_1->data, VAR_1->size); return 0; }
[ "static int FUNC_0(AVCodecContext *VAR_0, AVPacket *VAR_1,\nconst AVFrame *VAR_2, int *VAR_3)\n{", "G723_1_Context *p = VAR_0->priv_data;", "int16_t unq_lpc[LPC_ORDER * SUBFRAMES];", "int16_t qnt_lpc[LPC_ORDER * SUBFRAMES];", "int16_t cur_lsp[LPC_ORDER];", "int16_t weighted_lpc[LPC_ORDER * SUBFRAMES << 1];", "int16_t vector[FRAME_LEN + PITCH_MAX];", "int VAR_4, VAR_5;", "int16_t *in = (const int16_t *)VAR_2->data[0];", "HFParam hf[4];", "int VAR_6, VAR_7;", "highpass_filter(in, &p->hpf_fir_mem, &p->hpf_iir_mem);", "memcpy(vector, p->prev_data, HALF_FRAME_LEN * sizeof(int16_t));", "memcpy(vector + HALF_FRAME_LEN, in, FRAME_LEN * sizeof(int16_t));", "comp_lpc_coeff(vector, unq_lpc);", "lpc2lsp(&unq_lpc[LPC_ORDER * 3], p->prev_lsp, cur_lsp);", "lsp_quantize(p->lsp_index, cur_lsp, p->prev_lsp);", "memcpy(vector + LPC_ORDER, p->prev_data + SUBFRAME_LEN,\nsizeof(int16_t) * SUBFRAME_LEN);", "memcpy(vector + LPC_ORDER + SUBFRAME_LEN, in,\nsizeof(int16_t) * (HALF_FRAME_LEN + SUBFRAME_LEN));", "memcpy(p->prev_data, in + HALF_FRAME_LEN,\nsizeof(int16_t) * HALF_FRAME_LEN);", "memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN);", "perceptual_filter(p, weighted_lpc, unq_lpc, vector);", "memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN);", "memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX);", "memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN);", "scale_vector(vector, vector, FRAME_LEN + PITCH_MAX);", "p->pitch_lag[0] = estimate_pitch(vector, PITCH_MAX);", "p->pitch_lag[1] = estimate_pitch(vector, PITCH_MAX + HALF_FRAME_LEN);", "for (VAR_6 = PITCH_MAX, VAR_7 = 0; VAR_7 < SUBFRAMES; VAR_6 += SUBFRAME_LEN, VAR_7++)", "comp_harmonic_coeff(vector + VAR_6, p->pitch_lag[VAR_7 >> 1], hf + VAR_7);", "memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX);", "memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN);", "memcpy(p->prev_weight_sig, vector + FRAME_LEN, sizeof(int16_t) * PITCH_MAX);", "for (VAR_6 = 0, VAR_7 = 0; VAR_7 < SUBFRAMES; VAR_6 += SUBFRAME_LEN, VAR_7++)", "harmonic_filter(hf + VAR_7, vector + PITCH_MAX + VAR_6, in + VAR_6);", "inverse_quant(cur_lsp, p->prev_lsp, p->lsp_index, 0);", "lsp_interpolate(qnt_lpc, cur_lsp, p->prev_lsp);", "memcpy(p->prev_lsp, cur_lsp, sizeof(int16_t) * LPC_ORDER);", "VAR_4 = 0;", "for (VAR_6 = 0; VAR_6 < SUBFRAMES; VAR_6++) {", "int16_t impulse_resp[SUBFRAME_LEN];", "int16_t residual[SUBFRAME_LEN + PITCH_ORDER - 1];", "int16_t flt_in[SUBFRAME_LEN];", "int16_t zero[LPC_ORDER], fir[LPC_ORDER], iir[LPC_ORDER];", "memset(zero, 0, sizeof(int16_t) * LPC_ORDER);", "memset(vector, 0, sizeof(int16_t) * PITCH_MAX);", "memset(flt_in, 0, sizeof(int16_t) * SUBFRAME_LEN);", "flt_in[0] = 1 << 13;", "synth_percept_filter(qnt_lpc + VAR_4, weighted_lpc + (VAR_4 << 1),\nzero, zero, flt_in, vector + PITCH_MAX, 1);", "harmonic_filter(hf + VAR_6, vector + PITCH_MAX, impulse_resp);", "flt_in[0] = 0;", "memcpy(fir, p->perf_fir_mem, sizeof(int16_t) * LPC_ORDER);", "memcpy(iir, p->perf_iir_mem, sizeof(int16_t) * LPC_ORDER);", "synth_percept_filter(qnt_lpc + VAR_4, weighted_lpc + (VAR_4 << 1),\nfir, iir, flt_in, vector + PITCH_MAX, 0);", "memcpy(vector, p->harmonic_mem, sizeof(int16_t) * PITCH_MAX);", "harmonic_noise_sub(hf + VAR_6, vector + PITCH_MAX, in);", "acb_search(p, residual, impulse_resp, in, VAR_6);", "gen_acb_excitation(residual, p->prev_excitation,p->pitch_lag[VAR_6 >> 1],\n&p->subframe[VAR_6], p->cur_rate);", "sub_acb_contrib(residual, impulse_resp, in);", "fcb_search(p, impulse_resp, in, VAR_6);", "gen_acb_excitation(impulse_resp, p->prev_excitation, p->pitch_lag[VAR_6 >> 1],\n&p->subframe[VAR_6], RATE_6300);", "memmove(p->prev_excitation, p->prev_excitation + SUBFRAME_LEN,\nsizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN));", "for (VAR_7 = 0; VAR_7 < SUBFRAME_LEN; VAR_7++)", "in[VAR_7] = av_clip_int16((in[VAR_7] << 1) + impulse_resp[VAR_7]);", "memcpy(p->prev_excitation + PITCH_MAX - SUBFRAME_LEN, in,\nsizeof(int16_t) * SUBFRAME_LEN);", "synth_percept_filter(qnt_lpc + VAR_4, weighted_lpc + (VAR_4 << 1),\np->perf_fir_mem, p->perf_iir_mem,\nin, vector + PITCH_MAX, 0);", "memmove(p->harmonic_mem, p->harmonic_mem + SUBFRAME_LEN,\nsizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN));", "memcpy(p->harmonic_mem + PITCH_MAX - SUBFRAME_LEN, vector + PITCH_MAX,\nsizeof(int16_t) * SUBFRAME_LEN);", "in += SUBFRAME_LEN;", "VAR_4 += LPC_ORDER;", "}", "if ((VAR_5 = ff_alloc_packet2(VAR_0, VAR_1, 24)))\nreturn VAR_5;", "*VAR_3 = 1;", "VAR_1->size = pack_bitstream(p, VAR_1->data, VAR_1->size);", "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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 25 ], [ 27 ], [ 31 ], [ 35 ], [ 37 ], [ 41 ], [ 43 ], [ 45 ], [ 51, 53 ], [ 55, 57 ], [ 59, 61 ], [ 63 ], [ 67 ], [ 71 ], [ 73 ], [ 75 ], [ 79 ], [ 83 ], [ 85 ], [ 89 ], [ 91 ], [ 95 ], [ 97 ], [ 99 ], [ 103 ], [ 105 ], [ 109 ], [ 111 ], [ 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ], [ 129 ], [ 141 ], [ 143 ], [ 145 ], [ 149 ], [ 151, 153 ], [ 155 ], [ 161 ], [ 163 ], [ 165 ], [ 169, 171 ], [ 173 ], [ 175 ], [ 179 ], [ 181, 183 ], [ 185 ], [ 189 ], [ 195, 197 ], [ 201, 203 ], [ 205 ], [ 207 ], [ 209, 211 ], [ 217, 219, 221 ], [ 223, 225 ], [ 227, 229 ], [ 233 ], [ 235 ], [ 237 ], [ 241, 243 ], [ 247 ], [ 249 ], [ 251 ], [ 253 ] ]
5,943
void ff_wmv2_idct_c(short * block){ int i; for(i=0;i<64;i+=8){ wmv2_idct_row(block+i); } for(i=0;i<8;i++){ wmv2_idct_col(block+i); } }
true
FFmpeg
e6bc38fd49c94726b45d5d5cc2b756ad8ec49ee0
void ff_wmv2_idct_c(short * block){ int i; for(i=0;i<64;i+=8){ wmv2_idct_row(block+i); } for(i=0;i<8;i++){ wmv2_idct_col(block+i); } }
{ "code": [ "void ff_wmv2_idct_c(short * block){", " int i;", " for(i=0;i<64;i+=8){", " wmv2_idct_row(block+i);", " for(i=0;i<8;i++){", " wmv2_idct_col(block+i);" ], "line_no": [ 1, 3, 7, 9, 13, 15 ] }
void FUNC_0(short * VAR_0){ int VAR_1; for(VAR_1=0;VAR_1<64;VAR_1+=8){ wmv2_idct_row(VAR_0+VAR_1); } for(VAR_1=0;VAR_1<8;VAR_1++){ wmv2_idct_col(VAR_0+VAR_1); } }
[ "void FUNC_0(short * VAR_0){", "int VAR_1;", "for(VAR_1=0;VAR_1<64;VAR_1+=8){", "wmv2_idct_row(VAR_0+VAR_1);", "}", "for(VAR_1=0;VAR_1<8;VAR_1++){", "wmv2_idct_col(VAR_0+VAR_1);", "}", "}" ]
[ 1, 1, 1, 1, 0, 1, 1, 0, 0 ]
[ [ 1 ], [ 3 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ] ]
5,944
type_init(parallel_register_types) static bool parallel_init(ISABus *bus, int index, CharDriverState *chr) { DeviceState *dev; ISADevice *isadev; isadev = isa_try_create(bus, "isa-parallel"); if (!isadev) { return false; } dev = DEVICE(isadev); qdev_prop_set_uint32(dev, "index", index); qdev_prop_set_chr(dev, "chardev", chr); if (qdev_init(dev) < 0) { return false; } return true; }
true
qemu
4bc6a3e54e06c47b8e23bfa3d873fa2f42dfec02
type_init(parallel_register_types) static bool parallel_init(ISABus *bus, int index, CharDriverState *chr) { DeviceState *dev; ISADevice *isadev; isadev = isa_try_create(bus, "isa-parallel"); if (!isadev) { return false; } dev = DEVICE(isadev); qdev_prop_set_uint32(dev, "index", index); qdev_prop_set_chr(dev, "chardev", chr); if (qdev_init(dev) < 0) { return false; } return true; }
{ "code": [ "static bool parallel_init(ISABus *bus, int index, CharDriverState *chr)", " isadev = isa_try_create(bus, \"isa-parallel\");", " if (!isadev) {", " return false;", " if (qdev_init(dev) < 0) {", " return false;", " return true;" ], "line_no": [ 5, 15, 17, 19, 29, 19, 35 ] }
FUNC_0(VAR_0) static bool parallel_init(ISABus *bus, int index, CharDriverState *chr) { DeviceState *dev; ISADevice *isadev; isadev = isa_try_create(bus, "isa-parallel"); if (!isadev) { return false; } dev = DEVICE(isadev); qdev_prop_set_uint32(dev, "index", index); qdev_prop_set_chr(dev, "chardev", chr); if (qdev_init(dev) < 0) { return false; } return true; }
[ "FUNC_0(VAR_0)\nstatic bool parallel_init(ISABus *bus, int index, CharDriverState *chr)\n{", "DeviceState *dev;", "ISADevice *isadev;", "isadev = isa_try_create(bus, \"isa-parallel\");", "if (!isadev) {", "return false;", "}", "dev = DEVICE(isadev);", "qdev_prop_set_uint32(dev, \"index\", index);", "qdev_prop_set_chr(dev, \"chardev\", chr);", "if (qdev_init(dev) < 0) {", "return false;", "}", "return true;", "}" ]
[ 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0 ]
[ [ 1, 5, 7 ], [ 9 ], [ 11 ], [ 15 ], [ 17 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ] ]
5,945
static void ehci_execute_complete(EHCIQueue *q) { EHCIPacket *p = QTAILQ_FIRST(&q->packets); assert(p != NULL); assert(p->qtdaddr == q->qtdaddr); assert(p->async != EHCI_ASYNC_INFLIGHT); p->async = EHCI_ASYNC_NONE; DPRINTF("execute_complete: qhaddr 0x%x, next %x, qtdaddr 0x%x, status %d\n", q->qhaddr, q->qh.next, q->qtdaddr, q->usb_status); if (p->usb_status < 0) { switch (p->usb_status) { case USB_RET_IOERROR: case USB_RET_NODEV: q->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_XACTERR); set_field(&q->qh.token, 0, QTD_TOKEN_CERR); ehci_record_interrupt(q->ehci, USBSTS_ERRINT); break; case USB_RET_STALL: q->qh.token |= QTD_TOKEN_HALT; ehci_record_interrupt(q->ehci, USBSTS_ERRINT); break; case USB_RET_NAK: set_field(&q->qh.altnext_qtd, 0, QH_ALTNEXT_NAKCNT); return; /* We're not done yet with this transaction */ case USB_RET_BABBLE: q->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_BABBLE); ehci_record_interrupt(q->ehci, USBSTS_ERRINT); break; default: /* should not be triggerable */ fprintf(stderr, "USB invalid response %d\n", p->usb_status); assert(0); break; } } else if ((p->usb_status > p->tbytes) && (p->pid == USB_TOKEN_IN)) { p->usb_status = USB_RET_BABBLE; q->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_BABBLE); ehci_record_interrupt(q->ehci, USBSTS_ERRINT); } else { // TODO check 4.12 for splits if (p->tbytes && p->pid == USB_TOKEN_IN) { p->tbytes -= p->usb_status; } else { p->tbytes = 0; } DPRINTF("updating tbytes to %d\n", p->tbytes); set_field(&q->qh.token, p->tbytes, QTD_TOKEN_TBYTES); } ehci_finish_transfer(q, p->usb_status); qemu_sglist_destroy(&p->sgl); usb_packet_unmap(&p->packet); q->qh.token ^= QTD_TOKEN_DTOGGLE; q->qh.token &= ~QTD_TOKEN_ACTIVE; if (q->qh.token & QTD_TOKEN_IOC) { ehci_record_interrupt(q->ehci, USBSTS_INT); } }
true
qemu
e2f89926f19d2940eda070542501f39f51a8c81f
static void ehci_execute_complete(EHCIQueue *q) { EHCIPacket *p = QTAILQ_FIRST(&q->packets); assert(p != NULL); assert(p->qtdaddr == q->qtdaddr); assert(p->async != EHCI_ASYNC_INFLIGHT); p->async = EHCI_ASYNC_NONE; DPRINTF("execute_complete: qhaddr 0x%x, next %x, qtdaddr 0x%x, status %d\n", q->qhaddr, q->qh.next, q->qtdaddr, q->usb_status); if (p->usb_status < 0) { switch (p->usb_status) { case USB_RET_IOERROR: case USB_RET_NODEV: q->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_XACTERR); set_field(&q->qh.token, 0, QTD_TOKEN_CERR); ehci_record_interrupt(q->ehci, USBSTS_ERRINT); break; case USB_RET_STALL: q->qh.token |= QTD_TOKEN_HALT; ehci_record_interrupt(q->ehci, USBSTS_ERRINT); break; case USB_RET_NAK: set_field(&q->qh.altnext_qtd, 0, QH_ALTNEXT_NAKCNT); return; case USB_RET_BABBLE: q->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_BABBLE); ehci_record_interrupt(q->ehci, USBSTS_ERRINT); break; default: fprintf(stderr, "USB invalid response %d\n", p->usb_status); assert(0); break; } } else if ((p->usb_status > p->tbytes) && (p->pid == USB_TOKEN_IN)) { p->usb_status = USB_RET_BABBLE; q->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_BABBLE); ehci_record_interrupt(q->ehci, USBSTS_ERRINT); } else { if (p->tbytes && p->pid == USB_TOKEN_IN) { p->tbytes -= p->usb_status; } else { p->tbytes = 0; } DPRINTF("updating tbytes to %d\n", p->tbytes); set_field(&q->qh.token, p->tbytes, QTD_TOKEN_TBYTES); } ehci_finish_transfer(q, p->usb_status); qemu_sglist_destroy(&p->sgl); usb_packet_unmap(&p->packet); q->qh.token ^= QTD_TOKEN_DTOGGLE; q->qh.token &= ~QTD_TOKEN_ACTIVE; if (q->qh.token & QTD_TOKEN_IOC) { ehci_record_interrupt(q->ehci, USBSTS_INT); } }
{ "code": [ " usb_packet_unmap(&p->packet);" ], "line_no": [ 111 ] }
static void FUNC_0(EHCIQueue *VAR_0) { EHCIPacket *p = QTAILQ_FIRST(&VAR_0->packets); assert(p != NULL); assert(p->qtdaddr == VAR_0->qtdaddr); assert(p->async != EHCI_ASYNC_INFLIGHT); p->async = EHCI_ASYNC_NONE; DPRINTF("execute_complete: qhaddr 0x%x, next %x, qtdaddr 0x%x, status %d\n", VAR_0->qhaddr, VAR_0->qh.next, VAR_0->qtdaddr, VAR_0->usb_status); if (p->usb_status < 0) { switch (p->usb_status) { case USB_RET_IOERROR: case USB_RET_NODEV: VAR_0->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_XACTERR); set_field(&VAR_0->qh.token, 0, QTD_TOKEN_CERR); ehci_record_interrupt(VAR_0->ehci, USBSTS_ERRINT); break; case USB_RET_STALL: VAR_0->qh.token |= QTD_TOKEN_HALT; ehci_record_interrupt(VAR_0->ehci, USBSTS_ERRINT); break; case USB_RET_NAK: set_field(&VAR_0->qh.altnext_qtd, 0, QH_ALTNEXT_NAKCNT); return; case USB_RET_BABBLE: VAR_0->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_BABBLE); ehci_record_interrupt(VAR_0->ehci, USBSTS_ERRINT); break; default: fprintf(stderr, "USB invalid response %d\n", p->usb_status); assert(0); break; } } else if ((p->usb_status > p->tbytes) && (p->pid == USB_TOKEN_IN)) { p->usb_status = USB_RET_BABBLE; VAR_0->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_BABBLE); ehci_record_interrupt(VAR_0->ehci, USBSTS_ERRINT); } else { if (p->tbytes && p->pid == USB_TOKEN_IN) { p->tbytes -= p->usb_status; } else { p->tbytes = 0; } DPRINTF("updating tbytes to %d\n", p->tbytes); set_field(&VAR_0->qh.token, p->tbytes, QTD_TOKEN_TBYTES); } ehci_finish_transfer(VAR_0, p->usb_status); qemu_sglist_destroy(&p->sgl); usb_packet_unmap(&p->packet); VAR_0->qh.token ^= QTD_TOKEN_DTOGGLE; VAR_0->qh.token &= ~QTD_TOKEN_ACTIVE; if (VAR_0->qh.token & QTD_TOKEN_IOC) { ehci_record_interrupt(VAR_0->ehci, USBSTS_INT); } }
[ "static void FUNC_0(EHCIQueue *VAR_0)\n{", "EHCIPacket *p = QTAILQ_FIRST(&VAR_0->packets);", "assert(p != NULL);", "assert(p->qtdaddr == VAR_0->qtdaddr);", "assert(p->async != EHCI_ASYNC_INFLIGHT);", "p->async = EHCI_ASYNC_NONE;", "DPRINTF(\"execute_complete: qhaddr 0x%x, next %x, qtdaddr 0x%x, status %d\\n\",\nVAR_0->qhaddr, VAR_0->qh.next, VAR_0->qtdaddr, VAR_0->usb_status);", "if (p->usb_status < 0) {", "switch (p->usb_status) {", "case USB_RET_IOERROR:\ncase USB_RET_NODEV:\nVAR_0->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_XACTERR);", "set_field(&VAR_0->qh.token, 0, QTD_TOKEN_CERR);", "ehci_record_interrupt(VAR_0->ehci, USBSTS_ERRINT);", "break;", "case USB_RET_STALL:\nVAR_0->qh.token |= QTD_TOKEN_HALT;", "ehci_record_interrupt(VAR_0->ehci, USBSTS_ERRINT);", "break;", "case USB_RET_NAK:\nset_field(&VAR_0->qh.altnext_qtd, 0, QH_ALTNEXT_NAKCNT);", "return;", "case USB_RET_BABBLE:\nVAR_0->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_BABBLE);", "ehci_record_interrupt(VAR_0->ehci, USBSTS_ERRINT);", "break;", "default:\nfprintf(stderr, \"USB invalid response %d\\n\", p->usb_status);", "assert(0);", "break;", "}", "} else if ((p->usb_status > p->tbytes) && (p->pid == USB_TOKEN_IN)) {", "p->usb_status = USB_RET_BABBLE;", "VAR_0->qh.token |= (QTD_TOKEN_HALT | QTD_TOKEN_BABBLE);", "ehci_record_interrupt(VAR_0->ehci, USBSTS_ERRINT);", "} else {", "if (p->tbytes && p->pid == USB_TOKEN_IN) {", "p->tbytes -= p->usb_status;", "} else {", "p->tbytes = 0;", "}", "DPRINTF(\"updating tbytes to %d\\n\", p->tbytes);", "set_field(&VAR_0->qh.token, p->tbytes, QTD_TOKEN_TBYTES);", "}", "ehci_finish_transfer(VAR_0, p->usb_status);", "qemu_sglist_destroy(&p->sgl);", "usb_packet_unmap(&p->packet);", "VAR_0->qh.token ^= QTD_TOKEN_DTOGGLE;", "VAR_0->qh.token &= ~QTD_TOKEN_ACTIVE;", "if (VAR_0->qh.token & QTD_TOKEN_IOC) {", "ehci_record_interrupt(VAR_0->ehci, USBSTS_INT);", "}", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19, 21 ], [ 25 ], [ 27 ], [ 29, 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41, 43 ], [ 45 ], [ 47 ], [ 49, 51 ], [ 53 ], [ 55, 57 ], [ 59 ], [ 61 ], [ 63, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 89 ], [ 91 ], [ 93 ], [ 95 ], [ 97 ], [ 101 ], [ 103 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 115 ], [ 117 ], [ 121 ], [ 123 ], [ 125 ], [ 127 ] ]
5,946
static void vector_fmul_reverse_vfp(float *dst, const float *src0, const float *src1, int len) { src1 += len; asm volatile( "fldmdbs %[src1]!, {s0-s3}\n\t" "fldmias %[src0]!, {s8-s11}\n\t" "fldmdbs %[src1]!, {s4-s7}\n\t" "fldmias %[src0]!, {s12-s15}\n\t" "fmuls s8, s3, s8\n\t" "fmuls s9, s2, s9\n\t" "fmuls s10, s1, s10\n\t" "fmuls s11, s0, s11\n\t" "1:\n\t" "subs %[len], %[len], #16\n\t" "fldmdbsge %[src1]!, {s16-s19}\n\t" "fmuls s12, s7, s12\n\t" "fldmiasge %[src0]!, {s24-s27}\n\t" "fmuls s13, s6, s13\n\t" "fldmdbsge %[src1]!, {s20-s23}\n\t" "fmuls s14, s5, s14\n\t" "fldmiasge %[src0]!, {s28-s31}\n\t" "fmuls s15, s4, s15\n\t" "fmulsge s24, s19, s24\n\t" "fldmdbsgt %[src1]!, {s0-s3}\n\t" "fmulsge s25, s18, s25\n\t" "fstmias %[dst]!, {s8-s13}\n\t" "fmulsge s26, s17, s26\n\t" "fldmiasgt %[src0]!, {s8-s11}\n\t" "fmulsge s27, s16, s27\n\t" "fmulsge s28, s23, s28\n\t" "fldmdbsgt %[src1]!, {s4-s7}\n\t" "fmulsge s29, s22, s29\n\t" "fstmias %[dst]!, {s14-s15}\n\t" "fmulsge s30, s21, s30\n\t" "fmulsge s31, s20, s31\n\t" "fmulsge s8, s3, s8\n\t" "fldmiasgt %[src0]!, {s12-s15}\n\t" "fmulsge s9, s2, s9\n\t" "fmulsge s10, s1, s10\n\t" "fstmiasge %[dst]!, {s24-s27}\n\t" "fmulsge s11, s0, s11\n\t" "fstmiasge %[dst]!, {s28-s31}\n\t" "bgt 1b\n\t" : [dst] "+&r" (dst), [src0] "+&r" (src0), [src1] "+&r" (src1), [len] "+&r" (len) : : "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", "cc", "memory"); }
true
FFmpeg
28215b3700723da0c0beb93945702b6fb2b3596d
static void vector_fmul_reverse_vfp(float *dst, const float *src0, const float *src1, int len) { src1 += len; asm volatile( "fldmdbs %[src1]!, {s0-s3}\n\t" "fldmias %[src0]!, {s8-s11}\n\t" "fldmdbs %[src1]!, {s4-s7}\n\t" "fldmias %[src0]!, {s12-s15}\n\t" "fmuls s8, s3, s8\n\t" "fmuls s9, s2, s9\n\t" "fmuls s10, s1, s10\n\t" "fmuls s11, s0, s11\n\t" "1:\n\t" "subs %[len], %[len], #16\n\t" "fldmdbsge %[src1]!, {s16-s19}\n\t" "fmuls s12, s7, s12\n\t" "fldmiasge %[src0]!, {s24-s27}\n\t" "fmuls s13, s6, s13\n\t" "fldmdbsge %[src1]!, {s20-s23}\n\t" "fmuls s14, s5, s14\n\t" "fldmiasge %[src0]!, {s28-s31}\n\t" "fmuls s15, s4, s15\n\t" "fmulsge s24, s19, s24\n\t" "fldmdbsgt %[src1]!, {s0-s3}\n\t" "fmulsge s25, s18, s25\n\t" "fstmias %[dst]!, {s8-s13}\n\t" "fmulsge s26, s17, s26\n\t" "fldmiasgt %[src0]!, {s8-s11}\n\t" "fmulsge s27, s16, s27\n\t" "fmulsge s28, s23, s28\n\t" "fldmdbsgt %[src1]!, {s4-s7}\n\t" "fmulsge s29, s22, s29\n\t" "fstmias %[dst]!, {s14-s15}\n\t" "fmulsge s30, s21, s30\n\t" "fmulsge s31, s20, s31\n\t" "fmulsge s8, s3, s8\n\t" "fldmiasgt %[src0]!, {s12-s15}\n\t" "fmulsge s9, s2, s9\n\t" "fmulsge s10, s1, s10\n\t" "fstmiasge %[dst]!, {s24-s27}\n\t" "fmulsge s11, s0, s11\n\t" "fstmiasge %[dst]!, {s28-s31}\n\t" "bgt 1b\n\t" : [dst] "+&r" (dst), [src0] "+&r" (src0), [src1] "+&r" (src1), [len] "+&r" (len) : : "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", "cc", "memory"); }
{ "code": [ " asm volatile(\r", " \"1:\\n\\t\"\r", " \"subs %[len], %[len], #16\\n\\t\"\r", " \"bgt 1b\\n\\t\"\r", " : \"s0\", \"s1\", \"s2\", \"s3\", \"s4\", \"s5\", \"s6\", \"s7\",\r", " \"s8\", \"s9\", \"s10\", \"s11\", \"s12\", \"s13\", \"s14\", \"s15\",\r", " \"s16\", \"s17\", \"s18\", \"s19\", \"s20\", \"s21\", \"s22\", \"s23\",\r", " \"s24\", \"s25\", \"s26\", \"s27\", \"s28\", \"s29\", \"s30\", \"s31\",\r", " \"cc\", \"memory\");\r", "static void vector_fmul_reverse_vfp(float *dst, const float *src0, const float *src1, int len)\r", " src1 += len;\r", " asm volatile(\r", " \"fldmdbs %[src1]!, {s0-s3}\\n\\t\"\r", " \"fldmias %[src0]!, {s8-s11}\\n\\t\"\r", " \"fldmdbs %[src1]!, {s4-s7}\\n\\t\"\r", " \"fldmias %[src0]!, {s12-s15}\\n\\t\"\r", " \"fmuls s8, s3, s8\\n\\t\"\r", " \"fmuls s9, s2, s9\\n\\t\"\r", " \"fmuls s10, s1, s10\\n\\t\"\r", " \"fmuls s11, s0, s11\\n\\t\"\r", " \"1:\\n\\t\"\r", " \"subs %[len], %[len], #16\\n\\t\"\r", " \"fldmdbsge %[src1]!, {s16-s19}\\n\\t\"\r", " \"fmuls s12, s7, s12\\n\\t\"\r", " \"fldmiasge %[src0]!, {s24-s27}\\n\\t\"\r", " \"fmuls s13, s6, s13\\n\\t\"\r", " \"fldmdbsge %[src1]!, {s20-s23}\\n\\t\"\r", " \"fmuls s14, s5, s14\\n\\t\"\r", " \"fldmiasge %[src0]!, {s28-s31}\\n\\t\"\r", " \"fmuls s15, s4, s15\\n\\t\"\r", " \"fmulsge s24, s19, s24\\n\\t\"\r", " \"fldmdbsgt %[src1]!, {s0-s3}\\n\\t\"\r", " \"fmulsge s25, s18, s25\\n\\t\"\r", " \"fstmias %[dst]!, {s8-s13}\\n\\t\"\r", " \"fmulsge s26, s17, s26\\n\\t\"\r", " \"fldmiasgt %[src0]!, {s8-s11}\\n\\t\"\r", " \"fmulsge s27, s16, s27\\n\\t\"\r", " \"fmulsge s28, s23, s28\\n\\t\"\r", " \"fldmdbsgt %[src1]!, {s4-s7}\\n\\t\"\r", " \"fmulsge s29, s22, s29\\n\\t\"\r", " \"fstmias %[dst]!, {s14-s15}\\n\\t\"\r", " \"fmulsge s30, s21, s30\\n\\t\"\r", " \"fmulsge s31, s20, s31\\n\\t\"\r", " \"fmulsge s8, s3, s8\\n\\t\"\r", " \"fldmiasgt %[src0]!, {s12-s15}\\n\\t\"\r", " \"fmulsge s9, s2, s9\\n\\t\"\r", " \"fmulsge s10, s1, s10\\n\\t\"\r", " \"fstmiasge %[dst]!, {s24-s27}\\n\\t\"\r", " \"fmulsge s11, s0, s11\\n\\t\"\r", " \"fstmiasge %[dst]!, {s28-s31}\\n\\t\"\r", " \"bgt 1b\\n\\t\"\r", " : [dst] \"+&r\" (dst), [src0] \"+&r\" (src0), [src1] \"+&r\" (src1), [len] \"+&r\" (len)\r", " : \"s0\", \"s1\", \"s2\", \"s3\", \"s4\", \"s5\", \"s6\", \"s7\",\r", " \"s8\", \"s9\", \"s10\", \"s11\", \"s12\", \"s13\", \"s14\", \"s15\",\r", " \"s16\", \"s17\", \"s18\", \"s19\", \"s20\", \"s21\", \"s22\", \"s23\",\r", " \"s24\", \"s25\", \"s26\", \"s27\", \"s28\", \"s29\", \"s30\", \"s31\",\r", " \"cc\", \"memory\");\r", " asm volatile(\r", " \"1:\\n\\t\"\r", " \"bgt 1b\\n\\t\"\r", " : \"s0\", \"s1\", \"s2\", \"s3\", \"s4\", \"s5\", \"s6\", \"s7\",\r", " \"s16\", \"s17\", \"s18\", \"s19\", \"s20\", \"s21\", \"s22\", \"s23\",\r", " \"cc\", \"memory\");\r" ], "line_no": [ 7, 25, 27, 85, 93, 95, 97, 99, 101, 1, 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, 73, 75, 77, 79, 81, 83, 85, 89, 93, 95, 97, 99, 101, 7, 25, 85, 93, 97, 101 ] }
static void FUNC_0(float *VAR_0, const float *VAR_1, const float *VAR_2, int VAR_3) { VAR_2 += VAR_3; asm volatile( "fldmdbs %[VAR_2]!, {s0-s3}\n\t" "fldmias %[VAR_1]!, {s8-s11}\n\t" "fldmdbs %[VAR_2]!, {s4-s7}\n\t" "fldmias %[VAR_1]!, {s12-s15}\n\t" "fmuls s8, s3, s8\n\t" "fmuls s9, s2, s9\n\t" "fmuls s10, s1, s10\n\t" "fmuls s11, s0, s11\n\t" "1:\n\t" "subs %[VAR_3], %[VAR_3], #16\n\t" "fldmdbsge %[VAR_2]!, {s16-s19}\n\t" "fmuls s12, s7, s12\n\t" "fldmiasge %[VAR_1]!, {s24-s27}\n\t" "fmuls s13, s6, s13\n\t" "fldmdbsge %[VAR_2]!, {s20-s23}\n\t" "fmuls s14, s5, s14\n\t" "fldmiasge %[VAR_1]!, {s28-s31}\n\t" "fmuls s15, s4, s15\n\t" "fmulsge s24, s19, s24\n\t" "fldmdbsgt %[VAR_2]!, {s0-s3}\n\t" "fmulsge s25, s18, s25\n\t" "fstmias %[VAR_0]!, {s8-s13}\n\t" "fmulsge s26, s17, s26\n\t" "fldmiasgt %[VAR_1]!, {s8-s11}\n\t" "fmulsge s27, s16, s27\n\t" "fmulsge s28, s23, s28\n\t" "fldmdbsgt %[VAR_2]!, {s4-s7}\n\t" "fmulsge s29, s22, s29\n\t" "fstmias %[VAR_0]!, {s14-s15}\n\t" "fmulsge s30, s21, s30\n\t" "fmulsge s31, s20, s31\n\t" "fmulsge s8, s3, s8\n\t" "fldmiasgt %[VAR_1]!, {s12-s15}\n\t" "fmulsge s9, s2, s9\n\t" "fmulsge s10, s1, s10\n\t" "fstmiasge %[VAR_0]!, {s24-s27}\n\t" "fmulsge s11, s0, s11\n\t" "fstmiasge %[VAR_0]!, {s28-s31}\n\t" "bgt 1b\n\t" : [VAR_0] "+&r" (VAR_0), [VAR_1] "+&r" (VAR_1), [VAR_2] "+&r" (VAR_2), [VAR_3] "+&r" (VAR_3) : : "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7", "s8", "s9", "s10", "s11", "s12", "s13", "s14", "s15", "s16", "s17", "s18", "s19", "s20", "s21", "s22", "s23", "s24", "s25", "s26", "s27", "s28", "s29", "s30", "s31", "cc", "memory"); }
[ "static void FUNC_0(float *VAR_0, const float *VAR_1, const float *VAR_2, int VAR_3)\n{", "VAR_2 += VAR_3;", "asm volatile(\n\"fldmdbs %[VAR_2]!, {s0-s3}\\n\\t\"", "\"fldmias %[VAR_1]!, {s8-s11}\\n\\t\"", "\"fldmdbs %[VAR_2]!, {s4-s7}\\n\\t\"", "\"fldmias %[VAR_1]!, {s12-s15}\\n\\t\"", "\"fmuls s8, s3, s8\\n\\t\"\n\"fmuls s9, s2, s9\\n\\t\"\n\"fmuls s10, s1, s10\\n\\t\"\n\"fmuls s11, s0, s11\\n\\t\"\n\"1:\\n\\t\"\n\"subs %[VAR_3], %[VAR_3], #16\\n\\t\"\n\"fldmdbsge %[VAR_2]!, {s16-s19}\\n\\t\"", "\"fmuls s12, s7, s12\\n\\t\"\n\"fldmiasge %[VAR_1]!, {s24-s27}\\n\\t\"", "\"fmuls s13, s6, s13\\n\\t\"\n\"fldmdbsge %[VAR_2]!, {s20-s23}\\n\\t\"", "\"fmuls s14, s5, s14\\n\\t\"\n\"fldmiasge %[VAR_1]!, {s28-s31}\\n\\t\"", "\"fmuls s15, s4, s15\\n\\t\"\n\"fmulsge s24, s19, s24\\n\\t\"\n\"fldmdbsgt %[VAR_2]!, {s0-s3}\\n\\t\"", "\"fmulsge s25, s18, s25\\n\\t\"\n\"fstmias %[VAR_0]!, {s8-s13}\\n\\t\"", "\"fmulsge s26, s17, s26\\n\\t\"\n\"fldmiasgt %[VAR_1]!, {s8-s11}\\n\\t\"", "\"fmulsge s27, s16, s27\\n\\t\"\n\"fmulsge s28, s23, s28\\n\\t\"\n\"fldmdbsgt %[VAR_2]!, {s4-s7}\\n\\t\"", "\"fmulsge s29, s22, s29\\n\\t\"\n\"fstmias %[VAR_0]!, {s14-s15}\\n\\t\"", "\"fmulsge s30, s21, s30\\n\\t\"\n\"fmulsge s31, s20, s31\\n\\t\"\n\"fmulsge s8, s3, s8\\n\\t\"\n\"fldmiasgt %[VAR_1]!, {s12-s15}\\n\\t\"", "\"fmulsge s9, s2, s9\\n\\t\"\n\"fmulsge s10, s1, s10\\n\\t\"\n\"fstmiasge %[VAR_0]!, {s24-s27}\\n\\t\"", "\"fmulsge s11, s0, s11\\n\\t\"\n\"fstmiasge %[VAR_0]!, {s28-s31}\\n\\t\"", "\"bgt 1b\\n\\t\"\n: [VAR_0] \"+&r\" (VAR_0), [VAR_1] \"+&r\" (VAR_1), [VAR_2] \"+&r\" (VAR_2), [VAR_3] \"+&r\" (VAR_3)\n:\n: \"s0\", \"s1\", \"s2\", \"s3\", \"s4\", \"s5\", \"s6\", \"s7\",\n\"s8\", \"s9\", \"s10\", \"s11\", \"s12\", \"s13\", \"s14\", \"s15\",\n\"s16\", \"s17\", \"s18\", \"s19\", \"s20\", \"s21\", \"s22\", \"s23\",\n\"s24\", \"s25\", \"s26\", \"s27\", \"s28\", \"s29\", \"s30\", \"s31\",\n\"cc\", \"memory\");", "}" ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7, 9 ], [ 11 ], [ 13 ], [ 15 ], [ 17, 19, 21, 23, 25, 27, 29 ], [ 31, 33 ], [ 35, 37 ], [ 39, 41 ], [ 43, 45, 47 ], [ 49, 51 ], [ 53, 55 ], [ 57, 59, 61 ], [ 63, 65 ], [ 67, 69, 71, 73 ], [ 75, 77, 79 ], [ 81, 83 ], [ 85, 89, 91, 93, 95, 97, 99, 101 ], [ 103 ] ]
5,947
static int64_t alloc_clusters_noref(BlockDriverState *bs, int64_t size) { BDRVQcowState *s = bs->opaque; int i, nb_clusters, refcount; nb_clusters = size_to_clusters(s, size); retry: for(i = 0; i < nb_clusters; i++) { int64_t next_cluster_index = s->free_cluster_index++; refcount = get_refcount(bs, next_cluster_index); if (refcount < 0) { return refcount; } else if (refcount != 0) { goto retry; } } #ifdef DEBUG_ALLOC2 fprintf(stderr, "alloc_clusters: size=%" PRId64 " -> %" PRId64 "\n", size, (s->free_cluster_index - nb_clusters) << s->cluster_bits); #endif return (s->free_cluster_index - nb_clusters) << s->cluster_bits; }
true
qemu
bb572aefbdac290363bfa5ca0e810ccce0a14ed6
static int64_t alloc_clusters_noref(BlockDriverState *bs, int64_t size) { BDRVQcowState *s = bs->opaque; int i, nb_clusters, refcount; nb_clusters = size_to_clusters(s, size); retry: for(i = 0; i < nb_clusters; i++) { int64_t next_cluster_index = s->free_cluster_index++; refcount = get_refcount(bs, next_cluster_index); if (refcount < 0) { return refcount; } else if (refcount != 0) { goto retry; } } #ifdef DEBUG_ALLOC2 fprintf(stderr, "alloc_clusters: size=%" PRId64 " -> %" PRId64 "\n", size, (s->free_cluster_index - nb_clusters) << s->cluster_bits); #endif return (s->free_cluster_index - nb_clusters) << s->cluster_bits; }
{ "code": [ "static int64_t alloc_clusters_noref(BlockDriverState *bs, int64_t size)", " int i, nb_clusters, refcount;", " int64_t next_cluster_index = s->free_cluster_index++;" ], "line_no": [ 1, 7, 17 ] }
static int64_t FUNC_0(BlockDriverState *bs, int64_t size) { BDRVQcowState *s = bs->opaque; int VAR_0, VAR_1, VAR_2; VAR_1 = size_to_clusters(s, size); retry: for(VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) { int64_t next_cluster_index = s->free_cluster_index++; VAR_2 = get_refcount(bs, next_cluster_index); if (VAR_2 < 0) { return VAR_2; } else if (VAR_2 != 0) { goto retry; } } #ifdef DEBUG_ALLOC2 fprintf(stderr, "alloc_clusters: size=%" PRId64 " -> %" PRId64 "\n", size, (s->free_cluster_index - VAR_1) << s->cluster_bits); #endif return (s->free_cluster_index - VAR_1) << s->cluster_bits; }
[ "static int64_t FUNC_0(BlockDriverState *bs, int64_t size)\n{", "BDRVQcowState *s = bs->opaque;", "int VAR_0, VAR_1, VAR_2;", "VAR_1 = size_to_clusters(s, size);", "retry:\nfor(VAR_0 = 0; VAR_0 < VAR_1; VAR_0++) {", "int64_t next_cluster_index = s->free_cluster_index++;", "VAR_2 = get_refcount(bs, next_cluster_index);", "if (VAR_2 < 0) {", "return VAR_2;", "} else if (VAR_2 != 0) {", "goto retry;", "}", "}", "#ifdef DEBUG_ALLOC2\nfprintf(stderr, \"alloc_clusters: size=%\" PRId64 \" -> %\" PRId64 \"\\n\",\nsize,\n(s->free_cluster_index - VAR_1) << s->cluster_bits);", "#endif\nreturn (s->free_cluster_index - VAR_1) << s->cluster_bits;", "}" ]
[ 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 11 ], [ 13, 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35, 37, 39, 41 ], [ 43, 45 ], [ 47 ] ]
5,949
double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max) { char *tail; const char *error; double d = av_strtod(numstr, &tail); if (*tail) error = "Expected number for %s but found: %s\n"; else if (d < min || d > max) error = "The value for %s was %s which is not within %f - %f\n"; else if (type == OPT_INT64 && (int64_t)d != d) error = "Expected int64 for %s but found %s\n"; else if (type == OPT_INT && (int)d != d) error = "Expected int for %s but found %s\n"; else return d; av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max); exit(1); return 0; }
true
FFmpeg
636ced8e1dc8248a1353b416240b93d70ad03edb
double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max) { char *tail; const char *error; double d = av_strtod(numstr, &tail); if (*tail) error = "Expected number for %s but found: %s\n"; else if (d < min || d > max) error = "The value for %s was %s which is not within %f - %f\n"; else if (type == OPT_INT64 && (int64_t)d != d) error = "Expected int64 for %s but found %s\n"; else if (type == OPT_INT && (int)d != d) error = "Expected int for %s but found %s\n"; else return d; av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max); exit(1); return 0; }
{ "code": [ " exit(1);", " exit(1);" ], "line_no": [ 35, 35 ] }
double FUNC_0(const char *VAR_0, const char *VAR_1, int VAR_2, double VAR_3, double VAR_4) { char *VAR_5; const char *VAR_6; double VAR_7 = av_strtod(VAR_1, &VAR_5); if (*VAR_5) VAR_6 = "Expected number for %s but found: %s\n"; else if (VAR_7 < VAR_3 || VAR_7 > VAR_4) VAR_6 = "The value for %s was %s which is not within %f - %f\n"; else if (VAR_2 == OPT_INT64 && (int64_t)VAR_7 != VAR_7) VAR_6 = "Expected int64 for %s but found %s\n"; else if (VAR_2 == OPT_INT && (int)VAR_7 != VAR_7) VAR_6 = "Expected int for %s but found %s\n"; else return VAR_7; av_log(NULL, AV_LOG_FATAL, VAR_6, VAR_0, VAR_1, VAR_3, VAR_4); exit(1); return 0; }
[ "double FUNC_0(const char *VAR_0, const char *VAR_1, int VAR_2,\ndouble VAR_3, double VAR_4)\n{", "char *VAR_5;", "const char *VAR_6;", "double VAR_7 = av_strtod(VAR_1, &VAR_5);", "if (*VAR_5)\nVAR_6 = \"Expected number for %s but found: %s\\n\";", "else if (VAR_7 < VAR_3 || VAR_7 > VAR_4)\nVAR_6 = \"The value for %s was %s which is not within %f - %f\\n\";", "else if (VAR_2 == OPT_INT64 && (int64_t)VAR_7 != VAR_7)\nVAR_6 = \"Expected int64 for %s but found %s\\n\";", "else if (VAR_2 == OPT_INT && (int)VAR_7 != VAR_7)\nVAR_6 = \"Expected int for %s but found %s\\n\";", "else\nreturn VAR_7;", "av_log(NULL, AV_LOG_FATAL, VAR_6, VAR_0, VAR_1, VAR_3, VAR_4);", "exit(1);", "return 0;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13, 15 ], [ 17, 19 ], [ 21, 23 ], [ 25, 27 ], [ 29, 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ] ]
5,950
static int qemu_rbd_snap_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) { BDRVRBDState *s = bs->opaque; QEMUSnapshotInfo *sn_info, *sn_tab = NULL; int i, snap_count; rbd_snap_info_t *snaps; int max_snaps = RBD_MAX_SNAPS; do { snaps = g_malloc(sizeof(*snaps) * max_snaps); snap_count = rbd_snap_list(s->image, snaps, &max_snaps); if (snap_count <= 0) { g_free(snaps); } } while (snap_count == -ERANGE); if (snap_count <= 0) { goto done; } sn_tab = g_malloc0(snap_count * sizeof(QEMUSnapshotInfo)); for (i = 0; i < snap_count; i++) { const char *snap_name = snaps[i].name; sn_info = sn_tab + i; pstrcpy(sn_info->id_str, sizeof(sn_info->id_str), snap_name); pstrcpy(sn_info->name, sizeof(sn_info->name), snap_name); sn_info->vm_state_size = snaps[i].size; sn_info->date_sec = 0; sn_info->date_nsec = 0; sn_info->vm_clock_nsec = 0; } rbd_snap_list_end(snaps); g_free(snaps); done: *psn_tab = sn_tab; return snap_count; }
true
qemu
5839e53bbc0fec56021d758aab7610df421ed8c8
static int qemu_rbd_snap_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) { BDRVRBDState *s = bs->opaque; QEMUSnapshotInfo *sn_info, *sn_tab = NULL; int i, snap_count; rbd_snap_info_t *snaps; int max_snaps = RBD_MAX_SNAPS; do { snaps = g_malloc(sizeof(*snaps) * max_snaps); snap_count = rbd_snap_list(s->image, snaps, &max_snaps); if (snap_count <= 0) { g_free(snaps); } } while (snap_count == -ERANGE); if (snap_count <= 0) { goto done; } sn_tab = g_malloc0(snap_count * sizeof(QEMUSnapshotInfo)); for (i = 0; i < snap_count; i++) { const char *snap_name = snaps[i].name; sn_info = sn_tab + i; pstrcpy(sn_info->id_str, sizeof(sn_info->id_str), snap_name); pstrcpy(sn_info->name, sizeof(sn_info->name), snap_name); sn_info->vm_state_size = snaps[i].size; sn_info->date_sec = 0; sn_info->date_nsec = 0; sn_info->vm_clock_nsec = 0; } rbd_snap_list_end(snaps); g_free(snaps); done: *psn_tab = sn_tab; return snap_count; }
{ "code": [ " sn_tab = g_malloc0(snap_count * sizeof(QEMUSnapshotInfo));" ], "line_no": [ 43 ] }
static int FUNC_0(BlockDriverState *VAR_0, QEMUSnapshotInfo **VAR_1) { BDRVRBDState *s = VAR_0->opaque; QEMUSnapshotInfo *sn_info, *sn_tab = NULL; int VAR_2, VAR_3; rbd_snap_info_t *snaps; int VAR_4 = RBD_MAX_SNAPS; do { snaps = g_malloc(sizeof(*snaps) * VAR_4); VAR_3 = rbd_snap_list(s->image, snaps, &VAR_4); if (VAR_3 <= 0) { g_free(snaps); } } while (VAR_3 == -ERANGE); if (VAR_3 <= 0) { goto done; } sn_tab = g_malloc0(VAR_3 * sizeof(QEMUSnapshotInfo)); for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) { const char *VAR_5 = snaps[VAR_2].name; sn_info = sn_tab + VAR_2; pstrcpy(sn_info->id_str, sizeof(sn_info->id_str), VAR_5); pstrcpy(sn_info->name, sizeof(sn_info->name), VAR_5); sn_info->vm_state_size = snaps[VAR_2].size; sn_info->date_sec = 0; sn_info->date_nsec = 0; sn_info->vm_clock_nsec = 0; } rbd_snap_list_end(snaps); g_free(snaps); done: *VAR_1 = sn_tab; return VAR_3; }
[ "static int FUNC_0(BlockDriverState *VAR_0,\nQEMUSnapshotInfo **VAR_1)\n{", "BDRVRBDState *s = VAR_0->opaque;", "QEMUSnapshotInfo *sn_info, *sn_tab = NULL;", "int VAR_2, VAR_3;", "rbd_snap_info_t *snaps;", "int VAR_4 = RBD_MAX_SNAPS;", "do {", "snaps = g_malloc(sizeof(*snaps) * VAR_4);", "VAR_3 = rbd_snap_list(s->image, snaps, &VAR_4);", "if (VAR_3 <= 0) {", "g_free(snaps);", "}", "} while (VAR_3 == -ERANGE);", "if (VAR_3 <= 0) {", "goto done;", "}", "sn_tab = g_malloc0(VAR_3 * sizeof(QEMUSnapshotInfo));", "for (VAR_2 = 0; VAR_2 < VAR_3; VAR_2++) {", "const char *VAR_5 = snaps[VAR_2].name;", "sn_info = sn_tab + VAR_2;", "pstrcpy(sn_info->id_str, sizeof(sn_info->id_str), VAR_5);", "pstrcpy(sn_info->name, sizeof(sn_info->name), VAR_5);", "sn_info->vm_state_size = snaps[VAR_2].size;", "sn_info->date_sec = 0;", "sn_info->date_nsec = 0;", "sn_info->vm_clock_nsec = 0;", "}", "rbd_snap_list_end(snaps);", "g_free(snaps);", "done:\n*VAR_1 = sn_tab;", "return VAR_3;", "}" ]
[ 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, 3, 5 ], [ 7 ], [ 9 ], [ 11 ], [ 13 ], [ 15 ], [ 19 ], [ 21 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 35 ], [ 37 ], [ 39 ], [ 43 ], [ 47 ], [ 49 ], [ 53 ], [ 55 ], [ 57 ], [ 61 ], [ 63 ], [ 65 ], [ 67 ], [ 69 ], [ 71 ], [ 73 ], [ 77, 79 ], [ 81 ], [ 83 ] ]
5,951
static void init_fps(int bf, int audio_preroll, int fps) { AVStream *st; ctx = avformat_alloc_context(); if (!ctx) exit(1); ctx->oformat = av_guess_format(format, NULL, NULL); if (!ctx->oformat) exit(1); ctx->pb = avio_alloc_context(iobuf, sizeof(iobuf), AVIO_FLAG_WRITE, NULL, NULL, io_write, NULL); if (!ctx->pb) exit(1); ctx->flags |= AVFMT_FLAG_BITEXACT; st = avformat_new_stream(ctx, NULL); if (!st) exit(1); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_H264; st->codec->width = 640; st->codec->height = 480; st->time_base.num = 1; st->time_base.den = 30; st->codec->extradata_size = sizeof(h264_extradata); st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) exit(1); memcpy(st->codec->extradata, h264_extradata, sizeof(h264_extradata)); st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; video_st = st; st = avformat_new_stream(ctx, NULL); if (!st) exit(1); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_AAC; st->codec->sample_rate = 44100; st->codec->channels = 2; st->time_base.num = 1; st->time_base.den = 44100; st->codec->extradata_size = sizeof(aac_extradata); st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) exit(1); memcpy(st->codec->extradata, aac_extradata, sizeof(aac_extradata)); st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; audio_st = st; if (avformat_write_header(ctx, &opts) < 0) exit(1); av_dict_free(&opts); frames = 0; gop_size = 30; duration = video_st->time_base.den / fps; audio_duration = 1024 * audio_st->time_base.den / audio_st->codec->sample_rate; if (audio_preroll) audio_preroll = 2048 * audio_st->time_base.den / audio_st->codec->sample_rate; bframes = bf; video_dts = bframes ? -duration : 0; audio_dts = -audio_preroll; }
true
FFmpeg
5b70fb8fee4af3b13f29a2dc7222fd3c9782f79b
static void init_fps(int bf, int audio_preroll, int fps) { AVStream *st; ctx = avformat_alloc_context(); if (!ctx) exit(1); ctx->oformat = av_guess_format(format, NULL, NULL); if (!ctx->oformat) exit(1); ctx->pb = avio_alloc_context(iobuf, sizeof(iobuf), AVIO_FLAG_WRITE, NULL, NULL, io_write, NULL); if (!ctx->pb) exit(1); ctx->flags |= AVFMT_FLAG_BITEXACT; st = avformat_new_stream(ctx, NULL); if (!st) exit(1); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_H264; st->codec->width = 640; st->codec->height = 480; st->time_base.num = 1; st->time_base.den = 30; st->codec->extradata_size = sizeof(h264_extradata); st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) exit(1); memcpy(st->codec->extradata, h264_extradata, sizeof(h264_extradata)); st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; video_st = st; st = avformat_new_stream(ctx, NULL); if (!st) exit(1); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_AAC; st->codec->sample_rate = 44100; st->codec->channels = 2; st->time_base.num = 1; st->time_base.den = 44100; st->codec->extradata_size = sizeof(aac_extradata); st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) exit(1); memcpy(st->codec->extradata, aac_extradata, sizeof(aac_extradata)); st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; audio_st = st; if (avformat_write_header(ctx, &opts) < 0) exit(1); av_dict_free(&opts); frames = 0; gop_size = 30; duration = video_st->time_base.den / fps; audio_duration = 1024 * audio_st->time_base.den / audio_st->codec->sample_rate; if (audio_preroll) audio_preroll = 2048 * audio_st->time_base.den / audio_st->codec->sample_rate; bframes = bf; video_dts = bframes ? -duration : 0; audio_dts = -audio_preroll; }
{ "code": [ " audio_duration = 1024 * audio_st->time_base.den / audio_st->codec->sample_rate;", " audio_preroll = 2048 * audio_st->time_base.den / audio_st->codec->sample_rate;" ], "line_no": [ 111, 115 ] }
static void FUNC_0(int VAR_0, int VAR_1, int VAR_2) { AVStream *st; ctx = avformat_alloc_context(); if (!ctx) exit(1); ctx->oformat = av_guess_format(format, NULL, NULL); if (!ctx->oformat) exit(1); ctx->pb = avio_alloc_context(iobuf, sizeof(iobuf), AVIO_FLAG_WRITE, NULL, NULL, io_write, NULL); if (!ctx->pb) exit(1); ctx->flags |= AVFMT_FLAG_BITEXACT; st = avformat_new_stream(ctx, NULL); if (!st) exit(1); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_H264; st->codec->width = 640; st->codec->height = 480; st->time_base.num = 1; st->time_base.den = 30; st->codec->extradata_size = sizeof(h264_extradata); st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) exit(1); memcpy(st->codec->extradata, h264_extradata, sizeof(h264_extradata)); st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; video_st = st; st = avformat_new_stream(ctx, NULL); if (!st) exit(1); st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_AAC; st->codec->sample_rate = 44100; st->codec->channels = 2; st->time_base.num = 1; st->time_base.den = 44100; st->codec->extradata_size = sizeof(aac_extradata); st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) exit(1); memcpy(st->codec->extradata, aac_extradata, sizeof(aac_extradata)); st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; audio_st = st; if (avformat_write_header(ctx, &opts) < 0) exit(1); av_dict_free(&opts); frames = 0; gop_size = 30; duration = video_st->time_base.den / VAR_2; audio_duration = 1024 * audio_st->time_base.den / audio_st->codec->sample_rate; if (VAR_1) VAR_1 = 2048 * audio_st->time_base.den / audio_st->codec->sample_rate; bframes = VAR_0; video_dts = bframes ? -duration : 0; audio_dts = -VAR_1; }
[ "static void FUNC_0(int VAR_0, int VAR_1, int VAR_2)\n{", "AVStream *st;", "ctx = avformat_alloc_context();", "if (!ctx)\nexit(1);", "ctx->oformat = av_guess_format(format, NULL, NULL);", "if (!ctx->oformat)\nexit(1);", "ctx->pb = avio_alloc_context(iobuf, sizeof(iobuf), AVIO_FLAG_WRITE, NULL, NULL, io_write, NULL);", "if (!ctx->pb)\nexit(1);", "ctx->flags |= AVFMT_FLAG_BITEXACT;", "st = avformat_new_stream(ctx, NULL);", "if (!st)\nexit(1);", "st->codec->codec_type = AVMEDIA_TYPE_VIDEO;", "st->codec->codec_id = AV_CODEC_ID_H264;", "st->codec->width = 640;", "st->codec->height = 480;", "st->time_base.num = 1;", "st->time_base.den = 30;", "st->codec->extradata_size = sizeof(h264_extradata);", "st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);", "if (!st->codec->extradata)\nexit(1);", "memcpy(st->codec->extradata, h264_extradata, sizeof(h264_extradata));", "st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;", "video_st = st;", "st = avformat_new_stream(ctx, NULL);", "if (!st)\nexit(1);", "st->codec->codec_type = AVMEDIA_TYPE_AUDIO;", "st->codec->codec_id = AV_CODEC_ID_AAC;", "st->codec->sample_rate = 44100;", "st->codec->channels = 2;", "st->time_base.num = 1;", "st->time_base.den = 44100;", "st->codec->extradata_size = sizeof(aac_extradata);", "st->codec->extradata = av_mallocz(st->codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);", "if (!st->codec->extradata)\nexit(1);", "memcpy(st->codec->extradata, aac_extradata, sizeof(aac_extradata));", "st->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;", "audio_st = st;", "if (avformat_write_header(ctx, &opts) < 0)\nexit(1);", "av_dict_free(&opts);", "frames = 0;", "gop_size = 30;", "duration = video_st->time_base.den / VAR_2;", "audio_duration = 1024 * audio_st->time_base.den / audio_st->codec->sample_rate;", "if (VAR_1)\nVAR_1 = 2048 * audio_st->time_base.den / audio_st->codec->sample_rate;", "bframes = VAR_0;", "video_dts = bframes ? -duration : 0;", "audio_dts = -VAR_1;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0 ]
[ [ 1, 3 ], [ 5 ], [ 7 ], [ 9, 11 ], [ 13 ], [ 15, 17 ], [ 19 ], [ 21, 23 ], [ 25 ], [ 29 ], [ 31, 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51, 53 ], [ 55 ], [ 57 ], [ 59 ], [ 63 ], [ 65, 67 ], [ 69 ], [ 71 ], [ 73 ], [ 75 ], [ 77 ], [ 79 ], [ 81 ], [ 83 ], [ 85, 87 ], [ 89 ], [ 91 ], [ 93 ], [ 97, 99 ], [ 101 ], [ 105 ], [ 107 ], [ 109 ], [ 111 ], [ 113, 115 ], [ 119 ], [ 121 ], [ 123 ], [ 125 ] ]
5,952
GList *g_list_insert_sorted_merged(GList *list, gpointer data, GCompareFunc func) { GList *l, *next = NULL; Range *r, *nextr; if (!list) { list = g_list_insert_sorted(list, data, func); return list; } nextr = data; l = list; while (l && l != next && nextr) { r = l->data; if (ranges_can_merge(r, nextr)) { range_merge(r, nextr); l = g_list_remove_link(l, next); next = g_list_next(l); if (next) { nextr = next->data; } else { nextr = NULL; } } else { l = g_list_next(l); } } if (!l) { list = g_list_insert_sorted(list, data, func); } return list; }
true
qemu
7c47959d0cb05db43014141a156ada0b6d53a750
GList *g_list_insert_sorted_merged(GList *list, gpointer data, GCompareFunc func) { GList *l, *next = NULL; Range *r, *nextr; if (!list) { list = g_list_insert_sorted(list, data, func); return list; } nextr = data; l = list; while (l && l != next && nextr) { r = l->data; if (ranges_can_merge(r, nextr)) { range_merge(r, nextr); l = g_list_remove_link(l, next); next = g_list_next(l); if (next) { nextr = next->data; } else { nextr = NULL; } } else { l = g_list_next(l); } } if (!l) { list = g_list_insert_sorted(list, data, func); } return list; }
{ "code": [ "GList *g_list_insert_sorted_merged(GList *list, gpointer data,", "GList *g_list_insert_sorted_merged(GList *list, gpointer data,", " GCompareFunc func)", " list = g_list_insert_sorted(list, data, func);", " list = g_list_insert_sorted(list, data, func);" ], "line_no": [ 1, 1, 3, 15, 15 ] }
GList *FUNC_0(GList *list, gpointer data, GCompareFunc func) { GList *l, *next = NULL; Range *r, *nextr; if (!list) { list = g_list_insert_sorted(list, data, func); return list; } nextr = data; l = list; while (l && l != next && nextr) { r = l->data; if (ranges_can_merge(r, nextr)) { range_merge(r, nextr); l = g_list_remove_link(l, next); next = g_list_next(l); if (next) { nextr = next->data; } else { nextr = NULL; } } else { l = g_list_next(l); } } if (!l) { list = g_list_insert_sorted(list, data, func); } return list; }
[ "GList *FUNC_0(GList *list, gpointer data,\nGCompareFunc func)\n{", "GList *l, *next = NULL;", "Range *r, *nextr;", "if (!list) {", "list = g_list_insert_sorted(list, data, func);", "return list;", "}", "nextr = data;", "l = list;", "while (l && l != next && nextr) {", "r = l->data;", "if (ranges_can_merge(r, nextr)) {", "range_merge(r, nextr);", "l = g_list_remove_link(l, next);", "next = g_list_next(l);", "if (next) {", "nextr = next->data;", "} else {", "nextr = NULL;", "}", "} else {", "l = g_list_next(l);", "}", "}", "if (!l) {", "list = g_list_insert_sorted(list, data, func);", "}", "return list;", "}" ]
[ 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 ]
[ [ 1, 3, 5 ], [ 7 ], [ 9 ], [ 13 ], [ 15 ], [ 17 ], [ 19 ], [ 23 ], [ 25 ], [ 27 ], [ 29 ], [ 31 ], [ 33 ], [ 35 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47 ], [ 49 ], [ 51 ], [ 53 ], [ 55 ], [ 59 ], [ 61 ], [ 63 ], [ 67 ], [ 69 ] ]
5,953
static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf, int* buf_size, int type, uint32_t **lace_buf, int *laces) { int res = 0, n, size = *buf_size; uint8_t *data = *buf; uint32_t *lace_size; if (!type) { *laces = 1; *lace_buf = av_mallocz(sizeof(int)); if (!*lace_buf) return AVERROR(ENOMEM); *lace_buf[0] = size; return 0; } av_assert0(size > 0); *laces = *data + 1; data += 1; size -= 1; lace_size = av_mallocz(*laces * sizeof(int)); if (!lace_size) return AVERROR(ENOMEM); switch (type) { case 0x1: /* Xiph lacing */ { uint8_t temp; uint32_t total = 0; for (n = 0; res == 0 && n < *laces - 1; n++) { while (1) { if (size == 0) { res = AVERROR_INVALIDDATA; break; } temp = *data; lace_size[n] += temp; data += 1; size -= 1; if (temp != 0xff) break; } total += lace_size[n]; } if (size <= total) { res = AVERROR_INVALIDDATA; break; } lace_size[n] = size - total; break; } case 0x2: /* fixed-size lacing */ if (size % (*laces)) { res = AVERROR_INVALIDDATA; break; } for (n = 0; n < *laces; n++) lace_size[n] = size / *laces; break; case 0x3: /* EBML lacing */ { uint64_t num; uint64_t total; n = matroska_ebmlnum_uint(matroska, data, size, &num); if (n < 0) { av_log(matroska->ctx, AV_LOG_INFO, "EBML block data error\n"); res = n; break; } data += n; size -= n; total = lace_size[0] = num; for (n = 1; res == 0 && n < *laces - 1; n++) { int64_t snum; int r; r = matroska_ebmlnum_sint(matroska, data, size, &snum); if (r < 0) { av_log(matroska->ctx, AV_LOG_INFO, "EBML block data error\n"); res = r; break; } data += r; size -= r; lace_size[n] = lace_size[n - 1] + snum; total += lace_size[n]; } if (size <= total) { res = AVERROR_INVALIDDATA; break; } lace_size[*laces - 1] = size - total; break; } } *buf = data; *lace_buf = lace_size; *buf_size = size; return res; }
true
FFmpeg
115c3bc41f24185477de7e012b799e47693e3b5e
static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf, int* buf_size, int type, uint32_t **lace_buf, int *laces) { int res = 0, n, size = *buf_size; uint8_t *data = *buf; uint32_t *lace_size; if (!type) { *laces = 1; *lace_buf = av_mallocz(sizeof(int)); if (!*lace_buf) return AVERROR(ENOMEM); *lace_buf[0] = size; return 0; } av_assert0(size > 0); *laces = *data + 1; data += 1; size -= 1; lace_size = av_mallocz(*laces * sizeof(int)); if (!lace_size) return AVERROR(ENOMEM); switch (type) { case 0x1: { uint8_t temp; uint32_t total = 0; for (n = 0; res == 0 && n < *laces - 1; n++) { while (1) { if (size == 0) { res = AVERROR_INVALIDDATA; break; } temp = *data; lace_size[n] += temp; data += 1; size -= 1; if (temp != 0xff) break; } total += lace_size[n]; } if (size <= total) { res = AVERROR_INVALIDDATA; break; } lace_size[n] = size - total; break; } case 0x2: if (size % (*laces)) { res = AVERROR_INVALIDDATA; break; } for (n = 0; n < *laces; n++) lace_size[n] = size / *laces; break; case 0x3: { uint64_t num; uint64_t total; n = matroska_ebmlnum_uint(matroska, data, size, &num); if (n < 0) { av_log(matroska->ctx, AV_LOG_INFO, "EBML block data error\n"); res = n; break; } data += n; size -= n; total = lace_size[0] = num; for (n = 1; res == 0 && n < *laces - 1; n++) { int64_t snum; int r; r = matroska_ebmlnum_sint(matroska, data, size, &snum); if (r < 0) { av_log(matroska->ctx, AV_LOG_INFO, "EBML block data error\n"); res = r; break; } data += r; size -= r; lace_size[n] = lace_size[n - 1] + snum; total += lace_size[n]; } if (size <= total) { res = AVERROR_INVALIDDATA; break; } lace_size[*laces - 1] = size - total; break; } } *buf = data; *lace_buf = lace_size; *buf_size = size; return res; }
{ "code": [ " if (size == 0) {", " total += lace_size[n];" ], "line_no": [ 65, 87 ] }
static int FUNC_0(MatroskaDemuxContext *VAR_0, uint8_t **VAR_1, int* VAR_2, int VAR_3, uint32_t **VAR_4, int *VAR_5) { int VAR_6 = 0, VAR_7, VAR_8 = *VAR_2; uint8_t *data = *VAR_1; uint32_t *lace_size; if (!VAR_3) { *VAR_5 = 1; *VAR_4 = av_mallocz(sizeof(int)); if (!*VAR_4) return AVERROR(ENOMEM); *VAR_4[0] = VAR_8; return 0; } av_assert0(VAR_8 > 0); *VAR_5 = *data + 1; data += 1; VAR_8 -= 1; lace_size = av_mallocz(*VAR_5 * sizeof(int)); if (!lace_size) return AVERROR(ENOMEM); switch (VAR_3) { case 0x1: { uint8_t temp; uint32_t total = 0; for (VAR_7 = 0; VAR_6 == 0 && VAR_7 < *VAR_5 - 1; VAR_7++) { while (1) { if (VAR_8 == 0) { VAR_6 = AVERROR_INVALIDDATA; break; } temp = *data; lace_size[VAR_7] += temp; data += 1; VAR_8 -= 1; if (temp != 0xff) break; } total += lace_size[VAR_7]; } if (VAR_8 <= total) { VAR_6 = AVERROR_INVALIDDATA; break; } lace_size[VAR_7] = VAR_8 - total; break; } case 0x2: if (VAR_8 % (*VAR_5)) { VAR_6 = AVERROR_INVALIDDATA; break; } for (VAR_7 = 0; VAR_7 < *VAR_5; VAR_7++) lace_size[VAR_7] = VAR_8 / *VAR_5; break; case 0x3: { uint64_t num; uint64_t total; VAR_7 = matroska_ebmlnum_uint(VAR_0, data, VAR_8, &num); if (VAR_7 < 0) { av_log(VAR_0->ctx, AV_LOG_INFO, "EBML block data error\VAR_7"); VAR_6 = VAR_7; break; } data += VAR_7; VAR_8 -= VAR_7; total = lace_size[0] = num; for (VAR_7 = 1; VAR_6 == 0 && VAR_7 < *VAR_5 - 1; VAR_7++) { int64_t snum; int VAR_9; VAR_9 = matroska_ebmlnum_sint(VAR_0, data, VAR_8, &snum); if (VAR_9 < 0) { av_log(VAR_0->ctx, AV_LOG_INFO, "EBML block data error\VAR_7"); VAR_6 = VAR_9; break; } data += VAR_9; VAR_8 -= VAR_9; lace_size[VAR_7] = lace_size[VAR_7 - 1] + snum; total += lace_size[VAR_7]; } if (VAR_8 <= total) { VAR_6 = AVERROR_INVALIDDATA; break; } lace_size[*VAR_5 - 1] = VAR_8 - total; break; } } *VAR_1 = data; *VAR_4 = lace_size; *VAR_2 = VAR_8; return VAR_6; }
[ "static int FUNC_0(MatroskaDemuxContext *VAR_0, uint8_t **VAR_1,\nint* VAR_2, int VAR_3,\nuint32_t **VAR_4, int *VAR_5)\n{", "int VAR_6 = 0, VAR_7, VAR_8 = *VAR_2;", "uint8_t *data = *VAR_1;", "uint32_t *lace_size;", "if (!VAR_3) {", "*VAR_5 = 1;", "*VAR_4 = av_mallocz(sizeof(int));", "if (!*VAR_4)\nreturn AVERROR(ENOMEM);", "*VAR_4[0] = VAR_8;", "return 0;", "}", "av_assert0(VAR_8 > 0);", "*VAR_5 = *data + 1;", "data += 1;", "VAR_8 -= 1;", "lace_size = av_mallocz(*VAR_5 * sizeof(int));", "if (!lace_size)\nreturn AVERROR(ENOMEM);", "switch (VAR_3) {", "case 0x1: {", "uint8_t temp;", "uint32_t total = 0;", "for (VAR_7 = 0; VAR_6 == 0 && VAR_7 < *VAR_5 - 1; VAR_7++) {", "while (1) {", "if (VAR_8 == 0) {", "VAR_6 = AVERROR_INVALIDDATA;", "break;", "}", "temp = *data;", "lace_size[VAR_7] += temp;", "data += 1;", "VAR_8 -= 1;", "if (temp != 0xff)\nbreak;", "}", "total += lace_size[VAR_7];", "}", "if (VAR_8 <= total) {", "VAR_6 = AVERROR_INVALIDDATA;", "break;", "}", "lace_size[VAR_7] = VAR_8 - total;", "break;", "}", "case 0x2:\nif (VAR_8 % (*VAR_5)) {", "VAR_6 = AVERROR_INVALIDDATA;", "break;", "}", "for (VAR_7 = 0; VAR_7 < *VAR_5; VAR_7++)", "lace_size[VAR_7] = VAR_8 / *VAR_5;", "break;", "case 0x3: {", "uint64_t num;", "uint64_t total;", "VAR_7 = matroska_ebmlnum_uint(VAR_0, data, VAR_8, &num);", "if (VAR_7 < 0) {", "av_log(VAR_0->ctx, AV_LOG_INFO,\n\"EBML block data error\\VAR_7\");", "VAR_6 = VAR_7;", "break;", "}", "data += VAR_7;", "VAR_8 -= VAR_7;", "total = lace_size[0] = num;", "for (VAR_7 = 1; VAR_6 == 0 && VAR_7 < *VAR_5 - 1; VAR_7++) {", "int64_t snum;", "int VAR_9;", "VAR_9 = matroska_ebmlnum_sint(VAR_0, data, VAR_8, &snum);", "if (VAR_9 < 0) {", "av_log(VAR_0->ctx, AV_LOG_INFO,\n\"EBML block data error\\VAR_7\");", "VAR_6 = VAR_9;", "break;", "}", "data += VAR_9;", "VAR_8 -= VAR_9;", "lace_size[VAR_7] = lace_size[VAR_7 - 1] + snum;", "total += lace_size[VAR_7];", "}", "if (VAR_8 <= total) {", "VAR_6 = AVERROR_INVALIDDATA;", "break;", "}", "lace_size[*VAR_5 - 1] = VAR_8 - total;", "break;", "}", "}", "*VAR_1 = data;", "*VAR_4 = lace_size;", "*VAR_2 = VAR_8;", "return VAR_6;", "}" ]
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
[ [ 1, 3, 5, 7 ], [ 9 ], [ 11 ], [ 13 ], [ 17 ], [ 19 ], [ 21 ], [ 23, 25 ], [ 29 ], [ 31 ], [ 33 ], [ 37 ], [ 39 ], [ 41 ], [ 43 ], [ 45 ], [ 47, 49 ], [ 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 ], [ 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, 165 ], [ 167 ], [ 169 ], [ 171 ], [ 173 ], [ 175 ], [ 177 ], [ 179 ], [ 181 ], [ 183 ], [ 185 ], [ 187 ], [ 189 ], [ 191 ], [ 193 ], [ 195 ], [ 197 ], [ 201 ], [ 203 ], [ 205 ], [ 209 ], [ 211 ] ]